3
$\begingroup$

The ContourPlot[] of the below two equations demonstrates that there should be two solutions to them,

ContourPlot[{1 - u Log[Sqrt[(1 + u)^2 + v^2]/Sqrt[u^2 + v^2]] + 
v (ArcTan[1 + u, v] - ArcTan[u, v]) == 
0.8371, -v Log[Sqrt[(1 + u)^2 + v^2]/Sqrt[u^2 + v^2]] - 
u (ArcTan[1 + u, v] - ArcTan[u, v]) == 0}, {u, -2, 2}, {v, -2, 2}]

enter image description here

However, the FindRoot[] cannot find the solution lies on the left-hand plane,

FindRoot[{1 - u Log[Sqrt[(1 + u)^2 + v^2]/Sqrt[u^2 + v^2]] + 
v (ArcTan[1 + u, v] - ArcTan[u, v]) == 
0.8371, -v Log[Sqrt[(1 + u)^2 + v^2]/Sqrt[u^2 + v^2]] - 
u (ArcTan[1 + u, v] - ArcTan[u, v]) == 
0}, {u, -1, -0.001}, {v, -0.5, 0.5}]

Why doesn't FindRoot[] find the solution around {u, -0.571}, {v, 0.0001}?

$\endgroup$
4
  • $\begingroup$ What is your question? Please always make the question clear and explicit. $\endgroup$
    – Szabolcs
    Commented Nov 2, 2016 at 10:25
  • $\begingroup$ @Szabolcs Thanks for your attention. How can I find the solution which lies on the left-hand plane using the FindRoot? $\endgroup$
    – an Idiot
    Commented Nov 2, 2016 at 10:29
  • $\begingroup$ It is possible this has to do with ArcTan[] which has a removable continuity. $\endgroup$
    – Feyre
    Commented Nov 2, 2016 at 10:40
  • $\begingroup$ @Szabolcs If in my question the number 0.8371 replaced by 1.1584, although the ContourPlot gives a specific diagram (there are one or two solutions), why does the FindRoot give different solutions for different ranges of u and v? What other method can I use instead of the FindRoot? Thanks for your attention. $\endgroup$
    – an Idiot
    Commented Nov 5, 2016 at 16:53

1 Answer 1

9
$\begingroup$

This ContourPlot is misleading. Your second expression is not zero for $u<0$ and $v=0$. To understand what is going on, try putting in $u=-1/2$ and see how it changes with $v$.

Plot[-v Log[Sqrt[(1 + u)^2 + v^2]/Sqrt[u^2 + v^2]] - 
    u (ArcTan[1 + u, v] - ArcTan[u, v]) /. u -> -1/2 // 
  Evaluate, {v, -1, 1}]

enter image description here

As you can see, the expression never becomes zero. There is no solution to your equations for $u < 0$. This is why FindRoot cannot give consistent results.

In version 11, both Plot and ContourPlot got smarter about detecting this sort of thing symbolically and ContourPlot will produce this for the above expression:

enter image description here

$\endgroup$
4
  • $\begingroup$ If in my question the number 0.8371 replaced by 1.1584, although the ContourPlot gives a specific diagram (there are one or two solutions), why does the FindRoot give different solutions for different ranges of u and v? What other method can I use instead of the FindRoot? Thanks for your attention. $\endgroup$
    – an Idiot
    Commented Nov 5, 2016 at 12:12
  • $\begingroup$ @anIdiot The solution from FindRoot is not always good. It uses numerical methods described here (second section). These methods have limitations, and may give fake results. Substitute these back to see how well they satisfy your equation. It turns out: not at all. Mathematica will give warnings about this (it did when I tried). $\endgroup$
    – Szabolcs
    Commented Nov 6, 2016 at 19:54
  • $\begingroup$ Don't you think that the second expression can be zero for $u < 0$ and $v = 0$, but when $u < -1$? $\endgroup$
    – an Idiot
    Commented Nov 7, 2016 at 10:45
  • $\begingroup$ @anIdiot Clearly, you can analyse the situation for different $u$. I updated this question in response to your comments about why FindRoot gives inconsistent results here, and your comments on your deleted question from yesterday where you wouldn't accept that there is no solution in the point you showed because ContourPlot is showing one. That point was between $-1 < u <0$. $\endgroup$
    – Szabolcs
    Commented Nov 7, 2016 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.