I have the equation
$$
x(\phi)=\frac{1}{2\sqrt2}\left(\frac{-2}{\phi}+\log\left(\frac{1+\phi}{1-\phi}\right)\right)
$$
I need to find the dependence $\phi(x)$, so I use NSolve:
B = 20;
NSteps = 2*B*100;
H = N[2*B/NSteps];
X = Range[-B, B, H];
F[i_] := NSolve[x[ϕ] == i && (-1.0 <= ϕ <= 0.0), ϕ];
Monitor[PhiTable = Table[ϕ /. F[i], {i, -B, B, H}], i]
And I get this output:
NSolve can't find the solution and it gives an empty result at the values from about -15 and lower. I suppose this bug is caused by exponential asymptotic of the function $\phi(x)$.
But when I write
F[i_] := NSolve[x[ϕ] == i, ϕ, Reals];
Monitor[PhiTable = Table[ϕ /. F[i][[1]], {i, -B, B, H}], i]
It finds roots at the begining but freezes at the point 16.44 and higher.
Is there a way to fix it? Or shall I use another function, not NSolve?
Added:
x[ϕ_] := 1/(2 Sqrt[2]) (-2/ϕ + Log[(1 + ϕ)/(1 - ϕ)]);



- As you receive help, try to give it too, by answering questions in your area of expertise.
- Take the tour and check the faqs!
- When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– Aug 11 '16 at 18:35x[\[Phi]]? Could be similar to this question. – Chris K Aug 11 '16 at 18:55