Easiest way to find (or approximate) x that gives maximum y of this function

24 Views Asked by At

I'm trying to find $x$, $x>0$ that maximizes a relatively complicated function $f_n$.

The function $f_n$ is defined as:

$f_n=C_{n,1}-\frac{C_{n,2}}{C_{n,3}-\frac{C_{n,4}}{C_{n,5}-f_{n-1}}} - x$

Where:

$f_{n-1} = C_{n-1}-\frac{C_{n-1,2}}{C_{n-1,3}-\frac{C_{n-1,4}}{C_{n-1,5}-f_{n-2}}}$

...

$f_0=C_{0,1}-\frac{C_{0,1}}{C_{0,2}-\frac{C_{0,3}}{C_{0,4}-x}}$

${C_{n,i}}$ are constants, ${C_{n,i}}>0$, $n\geq0$.

One way to do it is to find the derivative and solve for $x$. It's relatively easy for $f_0$, harder for large $n$.

Another method is to use golden section search. It is appropriate for my use case (solving the problem programatically), but it requires a specified interval, and in my case that's $[0, \infty >$.

I'm hoping someone more experienced could point me to the right direction. Is there a good way to approach this problem? Thank you.