You will write four functions for the pendulum and the straight-line graph. They follow the least-squares formulas of the lesson.
The idea. The line through the points has the slope and the intercept . For a pendulum the slope of against is .
Your tasks.
slope, return the least-squares slope of the points xs, ys.intercept, return the least-squares intercept.g_from_slope, return g for the slope of the graph of against .percent_error, return the percentage error of a result value with an absolute error delta.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…