You will write three functions: the linear estimate of from a nearby point , the percentage error of an estimate, and a helper that finds the perfect square nearest to a number. The checker tests several functions.
The idea. The estimate is . The derivative can be found from a short balanced interval. The percentage error is .
Your tasks.
linear_estimate(f, a, x).percent_error(true, estimate).nearest_square(n). Return the perfect square closest to n, as a whole number.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…