You will write three small functions. The first estimates a partial derivative. The second tests whether is exact. The third finds the change in the solution function between two points, by adding up thin strips.
The idea. The partial derivative is the slope of when only changes. Estimate it from two nearby values: . The equation is exact when at every point. The change in from to has two parts. The first is the integral of along the line from to . The second is the integral of along the line from to .
Your tasks.
slope_in_y(f, x, y). Return the estimate above, with h = H.is_exact(M, N, points). Return True when and differ by less than 0.001 at every point in the list. For you need a slope in , which slope_in_x already gives.change_in_F(M, N, x0, y0, x1, y1). Use the midpoint rule with n = 2000 strips for each of the two integrals.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…