You will write three functions for the alternating series , whose th term is .
The idea. The sum lies between two consecutive partial sums, and the error after terms is at most the first term left out, .
Your tasks.
partial(N). Return the sum of the first N terms.terms_needed(tol). Return the smallest N for which 1 / (N + 1) ** 2 is less than tol.trap(N). Return a pair (low, high) with the smaller and the larger of partial(N) and partial(N + 1).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…