You will write three small functions that apply the ratio test by computer. A series is given by a function a(n) that returns its th term.
The idea. The ratio test looks at for large . If it settles below the series converges. If it settles above the series diverges. If it settles near the test cannot decide.
Your tasks.
ratio_at(a, n). Return the absolute value of a(n + 1) / a(n).ratio_limit(a). Return ratio_at(a, 100) as an estimate of the limit.verdict(L). Return "converges" if L < 0.95, "diverges" if L > 1.05, and "unknown" otherwise.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…