Lesson 9 of 18
Ratio Test
Ratio Test
For a series , compute:
ight|$$ - **$L < 1$**: series converges absolutely - **$L > 1$**: series diverges - **$L = 1$**: inconclusive (try another test) ### Why It Works If the ratio approaches $L < 1$, the tail of the series eventually behaves like a geometric series with ratio $L$, which converges. ### Examples **Factorial series** $sum rac{1}{n!}$: $$left|rac{a_{n+1}}{a_n} ight| = rac{n!}{(n+1)!} = rac{1}{n+1} o 0 quad (L=0 < 1, ext{ converges})$$ **Power series** $sum rac{x^n}{n!}$ (Taylor series for $e^x$): $$left|rac{a_{n+1}}{a_n} ight| = rac{|x|}{n+1} o 0 quad ( ext{converges for all } x)$$ **Geometric series** $sum r^n$: $$left|rac{a_{n+1}}{a_n} ight| = |r| quad ( ext{constant — converges iff } |r| < 1)$$ **Harmonic** $sum rac{1}{n}$: $$left|rac{a_{n+1}}{a_n} ight| = rac{n}{n+1} o 1 quad (L=1, ext{ inconclusive})$$ ### Numerically Compute $a_n(n+1) / a_n(n)$ for a large $n$ to approximate $L$. ### Your Task Implement `double ratio_test_limit(double (*a_n)(int), int n)` that returns $a_n(n+1) / a_n(n)$, approximating the ratio test limit.TCC compiler loading...
Loading...
Click "Run" to execute your code.