Lesson 5 of 18
Partial Sums of Series
Partial Sums of Series
An infinite series is defined as the limit of partial sums:
If , the series converges to .
Famous Series
Harmonic series (diverges):
sum rac{1}{k} = 1 + rac{1}{2} + rac{1}{3} + rac{1}{4} + cdots o infty
Basel problem (converges to ):
sum rac{1}{k^2} = 1 + rac{1}{4} + rac{1}{9} + rac{1}{16} + cdots
Telescoping (exact finite sum):
sum_{k=1}^n rac{1}{k(k+1)} = 1 - rac{1}{n+1}
Because rac{1}{k(k+1)} = rac{1}{k} - rac{1}{k+1}, most terms cancel.
Convergence Test: Divergence
If , the series must diverge. (But alone doesn't guarantee convergence — the harmonic series is the classic counterexample.)
Your Task
Implement double partial_sum(double (*a_n)(int), int n) that computes .
TCC compiler loading...
Loading...
Click "Run" to execute your code.