Freedom and necessity in the sciences