You will write three small functions that add up strips under a curve: one with the height at the left end of each strip, one with the right end and one with the middle. The checker tests them on a parabola and on a line.
The idea. Cut into strips of width . The strip , counted from , runs from to . Its area is the height times . The sum of all the strips estimates the area under the curve.
Your tasks.
left_sum(f, a, b, n). Use the height at the left end of each strip.right_sum(f, a, b, n). Use the height at the right end of each strip.midpoint_sum(f, a, b, n). Use the height at the middle of each strip.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…