Lesson 6 of 18
Geometric Series
Geometric Series
A geometric series has each term a constant multiple of the previous:
Closed-Form Formula
For :
S_n = a cdot rac{1 - r^n}{1 - r}
Convergence
The infinite geometric series converges if and only if :
sum_{k=0}^{infty} a cdot r^k = rac{a}{1 - r} quad ext{when } |r| < 1
| Series behavior | |
|---|---|
| converges to | |
| diverges (grows linearly) | |
| diverges (grows exponentially) | |
| oscillates (diverges) |
Example
, , :
ight) approx 1.9980$$ The infinite sum: $rac{1}{1-0.5} = 2$ — the partial sum already reached $1.998$. ### Your Task Implement `double geometric_partial(double a, double r, int n)` that computes $sum_{k=0}^{n-1} a cdot r^k$ using a loop.TCC compiler loading...
Loading...
Click "Run" to execute your code.