You will write a small program that adds thin strips between two curves, and compare it with the shortcut for a parabola cut by a line. The checker uses a line and a parabola, two parabolas, and the shortcut.
The idea. A strip at has height , where is the upper curve. Add many strips of width . The shortcut for a parabola with coefficient , cut by a line at and , is .
Your tasks.
strip_height(f, g, x). Return the height of the strip at x, the upper curve f minus the lower curve g.area_between(f, g, a, b). Use 2000 strips of equal width between a and b, and the middle of each strip.segment_area(a, x1, x2). Return the shortcut area.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…