Wednesday, August 23, 2017

Solution to simple recursive series












I'm working on some math programming and ran into the following recursive series.



ni=1an.
Where an=Can1 and 0C1 and a0 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


Answer



ak can be written as:



ak=a0CCCk times=a0Ck



Where a0=1000000 and C=0.9999. (0<C<1)



The sum is a geometric series. It has the following closed form:




nk=0ak=a01Cn+11C



And as n:



n=0an=C01C




On the other hand, if C=1, then ak=a0 and the sum becomes:



nk=0ak=(n+1)ak



And this diverges as n.


No comments:

Post a Comment

analysis - Injection, making bijection

I have injection f:AB and I want to get bijection. Can I just resting codomain to f(A)? I know that every function i...