Possible Duplicate:
Proof of the formula $1+x+x^2+x^3+ \cdots +x^n =\frac{x^{n+1}-1}{x-1}$
Value of $\sum\limits_n x^n$
I'm working on some math programming and ran into the following recursive series.
$\displaystyle\sum\limits_{i=1}^n a_n$. Where $a_{n} = Ca_{n-1}$ and $0 \leq C \leq 1$ and $a_0$ is given;
Because my constant values are always between 0 and 1, I know that the series converges and I can't help but thinking that there must be a solution.
My code looks something like
value = 1000000;
constant = 0.9999;
total = 0;
tolerance = 0.001;
while(value > tolerance)
{
value = constant * value;
total = total + value;
}
Problem is, as is the case with the initial values provided in the snippet above, the algorithm takes a long time to complete when $C$ approaches $1$
You can find on how to evaluate a geometric progression in the link below.
(http://math.stackexchange.com/questions/29023/)
– Jun 16 '12 at 19:29