# Possible ways to numerically solve this equation

I have the following equation:

eq 1:

$f=100 \left(\left(\frac{z^{c/252}}{y^{b/252}}\right)^{\frac{252}{c-b}}-1\right)-100 \left(\left(\frac{y^{b/252}}{x^{a/252}}\right)^{\frac{252}{b-a}}-1\right)$

Given [a, b, c, x, y, z], solving for f is trivial, e.g.:

eq 2:

$100 \left(\left(\frac{1.1030^{1188/252}}{1.1015^{937/252}}\right)^{\frac{252}{1188-937}}-1\right)-100 \left(\left(\frac{1.1015^{937/252}}{1.0979^{687/252}}\right)^{\frac{252}{937-687}}-1\right) = -0.283604$

The problem is solving for y given [a, b, c, x, z, f].

I tried WolframAlpha and inputing the values does give me a numerical solution for y so I know it's possible. The following for example returns y $\approx$ 1.10150000054474...

eq 3:

$100 \left(\left(\frac{1.1030^{1188/252}}{y^{937/252}}\right)^{\frac{252}{1188-937}}-1\right)-100 \left(\left(\frac{y^{937/252}}{1.0979^{687/252}}\right)^{\frac{252}{937-687}}-1\right) = -0.283604$

I've read about Newton–Raphson but I'm not sure how to implement it since I can't isolate y and neither can WolframAlpha aparently. Asking it to solve for y results in a timeout.

Any ideas on an alternative method or maybe some way to isolate the y variable on eq 1?

UPDATE Limitless' comments below seem to confirm that there is no closed-form way to solve for y, so the focus is on finding an appropriate numerical method to achieve that.

UPDATE 2:

a,b,c are non-zero positive integers

x,z may be positive or negative, but not zero. Though I will accept solutions that assume they are positive only.

-
The best I can get is the following simplification: $$\frac{f}{100}=z^{\frac{c}{c-b}}y^{\frac{b}{b-c}}-x^{\frac{a}{a-b}}y^{\frac{b}{‌​b-a}}$$ –  000 Apr 17 '12 at 20:17
By making substitutions, it seems $y$ does not have a solution in terms of $a,b,c,x,z,\text{ and } \vec{f}$. See Wolfram Alpha's wisdom. –  000 Apr 17 '12 at 20:25
Well, WA did solve it though. See eq3 where I have all terms but y. It resulted in "Numerical Solution: y $\approx$ 1.10150000054474..." –  indiosmo Apr 17 '12 at 20:30
Just because WA solved it does not mean it has a solution in terms of the variables. (That's akin to saying sextics have a general solution because WA can solve them. ;)) Most likely, it is a numerical method (that I do not know, as none of the obvious possibilities are coming to mind as likely. . .) that is being employed. –  000 Apr 17 '12 at 20:33
To be fair, my question does ask specifically for a numerical method to solve this, as I realize it can't be solved analytically. –  indiosmo Apr 17 '12 at 20:35

## 1 Answer

Since Newton Raphson requires the first derivative of this equation (hard to compute symbolically), here is a Regula-Falsi implementation that converges to 1.101500000544740 written in C (compile with gcc and run).

http://pastebin.com/hQ3JYLCC

-
You could also post a copy of that here. –  000 Apr 17 '12 at 22:04
Done. I prefer using pastebin though. –  chemeng Apr 17 '12 at 22:06
I'll study the method to understand it better but I tested with several values and it works, so I'm accepting your answer. –  indiosmo Apr 17 '12 at 22:17
The Regula-Falsi method is actually an alternative of the Newton-Raphson. Instead of using the first derivative it uses an approximation of the form $f'(x_n)\approx \frac{f(x_n)-f(x_{n-1})}{x_n-x_{n-1}}$ and therefore doesn't require the calculation of the first derivative. Anyway,glad i could help. –  chemeng Apr 17 '12 at 22:21