# MATLAB Newton non-linear equation

I have the following non-linear equation: where $w0=0.25,w0=0.5,w0=0.75$. I have to prove that if $k$ is a root, then also $−k$ is a root and that there exists only one $k∈(0,1)$ root, but my MATLAB code doesn't return any solution.

Using wolframalpha I have computed the derivative of w0 and obtained, the constants $w0=0.25=0.5=0.75$ were ignored. In MATLAB I have the following function to compute the roots of non-linear equations: And my test file looks like this: Any idea to make my code functional is appreciated.

• Cross post: scicomp.stackexchange.com/questions/11654/… May 19 '14 at 20:32
• Note that your derivative in W|A has $(1+k)(1-k)$ in the log function, whereas what you posted has $(1+k)/(1-k)$. May 19 '14 at 20:35

Note that for $-1 < x < 1$, $1\pm x > 0$.

Further note that $f(x) = 2x$ is an odd function. It suffices to show that $g(x) = \log \frac{1+x}{1-x}$ is odd.

$$g(-x) = \log \frac{1+(-x)}{1-(-x)} = \log 1-x - \log 1+x = -\left[\log 1+x -\log 1-x\right] = -g(x).$$

Therefore, $h(x) = \frac{2x}{\log \frac{1+x}{1-x}}$ is even, so $h(-x) = h(x)$ for $-1 < x < 1$.

By plotting your function for the indicated values of $$\omega_0$$, it seems that there's no real solution for the equation $$f(k;\omega_0) = 0$$. I haven't tested your Newton-Raphson code but it fails to converge because of this, most likely.

See the figure below: Cheers!