You will turn the separation method into code. The two integrals of a separable equation are found by adding thin strips, and the unknown is found by halving an interval.
The idea. For , the separated form is . The right side is a number. The left side grows with (when ), so a halving search finds the that makes the two sides equal.
Your tasks.
integral(f, a, b, n). Use strips and the height at the middle of each strip.left_side(g, y0, y). Return the integral of from y0 to y.solve_separable(f, g, x0, y0, x1, lo, hi). Halve the interval from lo to hi sixty times. Keep the half where the two sides meet.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…