You will write a small least squares fit and use it to find the Freundlich constants of a gas on a solid. No library is needed: the slope and intercept come from sums.
The idea. For points the least squares slope is , and the intercept is . Here and .
Your tasks.
line(xs, ys). It returns the slope and the intercept.freundlich(pressures, amounts). It takes logarithms (base 10), calls line, and returns 1/n and k.predict(k, inv_n, p). It returns at the pressure p.Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…