I came across this recursive function in some code, and it is within a function called "interpolate". Essentially the rule is:
$x_i = x_{i-1}^2 / x_{i-2}$
which can also be defined as:
$x_i = \sqrt{x_{i-1} * x_{i+1}}$
with $x_0$ initialized to 1, and the last element of $x$ initialized to a value which specifies the max value of the function.
Can anyone tell me what this function is supposed to be approximating? There are no comments in the code indicating what this is.
Given: A sequence $x_0,\,x_1,\,x_2,\,\cdots\,x_p$ with $x_0=1$ and $x_p=x$ where $x$ is a known value and $p$ is a known integer, and for $i\ge2$
$$ x_i = x_{i-1}^2 / x_{i-2} $$
This condition implies that $x_i$ and $x_{i-2}$ have the same sign, and it can be re-written
$$ x_{i-1}=\sqrt{x_ix_{i-2}} $$
so that $x_{i-1}$ is the geometric mean of $x_i$ and $x_{i-2}$. This, in turn, implies that $\left\lbrace x_i\right\rbrace$ is a geometric sequence with
$$ x_i=r^i$$
for some $r$.
But we know that
$$ r^p=x $$
Thus
$$r=x^{1/p}$$
So the equation for the sequence is
$$ x_i=x^{i/p} $$