I have tried for some time to solve this problem and I'm stuck, so any help would be greatly appreciated. I'm not a math guy, so I apologize if I am missing something basic.
I have a function $f(x)$ $$f(x) = \sum_{i=1}^x dr^{i-1}$$ where
$x$ is a positive integer
$d$ is an initial delta and
$r$ is a factor which defines the rate at which each subsequent $f(x)$ value increase.
Specifically: \begin{align} f(1) =&\; d r^0 = d\\ f(2) =&\; f(1) + d r^1\\ f(3) =&\; f(2) + d r^2\\ f(4) =&\; f(3) + d r^3 \end{align} And more concretely, if $d=5$, $r=1.1$, and $n=5$ then \begin{align} f(1) = &\;5 \\ f(2) = &\;10.5 &= &\; 5 &&+ 5(1.1)^1\quad \text{(increase by }5.5)\\ f(3) = &\;16.55 &= &\; 10.5 &&+ 5(1.1)^2\quad \text{(increase by }6.05)\\ f(4) = &\;23.205 &= &\; 16.55 &&+ 5(1.1)^3\quad \text{(increase by }6.655)\\ f(5) = &\;30.5255 &= &\; 23.205 &&+ 5(1.1)^4\quad \text{(increase by }7.3205) \end{align}
Here is the problem I have not been able to solve:
If I am given:
$d$ (the initial increase)
$n$ (the number of periods)
and $y_n$ (the final value at $f(n)=y_n$)
1) How can I solve for $r$?
Right now I'm using a brute force interpolation in Python, but it seems like there must be a better way. I guess it is worth mentioning that I'm ultimately solving for $r$ programmatically in Python as opposed to using a pencil and paper, but I can write the code if you can give me the right math pointers.
So, as another concrete example, if I'm given $d=2$, $n=100$, and $f(100)=2000$, then how do I find that $r=1.0370626397$
2) Is there a way to calculate $f(x)$ without knowing $f(x-1)$?
Right now, I can only get to $f(x)$ by calculating all prior values.
Any help or even just advice telling me it there is no shortcut solution would be greatly appreciated.
$$f(n)=\sum_{i=1}^n dr^{i-1}=\frac{d(1-r^{n})}{1-r}$$
$$f(n)(1-r)=d(1-r^n)$$
which is an $n$-th degree polynomial.
Hence your problem is equivalent to solving the roots, $r$, of the following:
$$dr^n-f(n)r+f(n)-d=0$$
Note that for positive $r$, $\frac{1-r^n}{1-r}$ is an increasing function, you might like to use bisection to solve for when it is equal to $\frac{f(n)}{d}$.