I am having problems minimizing a potential:

$\text{V}(h,\eta)=\gamma \left(-h^2\right) \left(\eta ^2 \cos ^2(\theta )+\eta \cos (\delta ) \sqrt{-\eta ^2-h^2+1} \sin (2 \theta )+\left(-\eta ^2-h^2+1\right) \sin ^2(\theta )\right)$ (Input code below)

V = -h^2 γ (η^2 Cos[θ]^2 + (1 - h^2 - η^2) Sin[θ]^2 + η Sqrt[1 - h^2 - η^2] Cos[δ] Sin[2 θ])

I try to minimize simply using:

sol = Solve[{D[V, h] == 0, D[V, η] == 0}, {h, η}]

It seems to solve quickly and with no problems giving me 9 solutions, these solutions depend on the parameters $\theta, \delta, \gamma$.

However if for example I try to calculate:

Chop[N[D[V,h] /. sol /. θ -> 1 /. δ -> 1 /. γ -> 1]]

The output it gives is:

{0, -0.104069, 0, 0, -0.484451, 0.104069, 0, 0, 0.484451}

As you can see extrema 2, 5, 6 and 9 are not even close to zero! It seems Mathematica is solving this incorrectly, or maybe the solutions are only valid in specific regions (not the full domain)?

Does anyone have any ideas? I thought maybe the problem was with the square root in the function (otherwise it's a simple polynomial) but have tried solving it using the Lagrange multiplier method taking a function $V(h,η,s)$ and $s=\sqrt{1-h^2-η^2}$ but it also doesn't seem to give me all zero solutions when I sub it in to the Lagrange equation $\frac{\partial V}{\partial h}+\lambda \frac{\partial g}{\partial g}$, where $g=s-\sqrt{1-h^2-η^2}=0$, the constraint applied to this function.

Any ideas what's happening ? Has anyone encountered this problem before?

  • 1
    $\begingroup$ Hello ! It increases the quality of your question when you format appropriately your code and provide it in InputForm rather than $\LaTeX$. See the help centre for guidelines on how to properly format your code :) $\endgroup$
    – Sektor
    Commented Sep 18, 2013 at 8:33
  • $\begingroup$ The only part where I have put code is in the input, although its in latex form its pretty self explantory, only 1 line and its simply checking the value of the derivative of V w.r.t h at the extrema calculated by solsimp, for some random values of θ,δ,γ,Δ,ϵ. I have changed it to input text for your liking though. Do you have any ideas about my problem Nikola? $\endgroup$
    – user9584
    Commented Sep 18, 2013 at 9:13
  • 1
    $\begingroup$ You should provide Vsimp in Mathematica InputForm so it can be easily copied. $\endgroup$
    – RunnyKine
    Commented Sep 18, 2013 at 9:13
  • $\begingroup$ Is that better? $\endgroup$
    – user9584
    Commented Sep 18, 2013 at 11:35
  • $\begingroup$ Why not change your username into something a little more memorable? As far as your problem is concerned, I'd try and write the $ \sin(2\theta) = 2 \sin(\theta)\cos(\theta) $ and then complete the square. Then you will have a square plus "something" which will be easier to feed to Reduce. Solve uses generic parameters whereas Reduce finds you their domains as well (see this question for instance). I assume you are wanting a solution in the complex domain? $\endgroup$
    – gpap
    Commented Sep 18, 2013 at 15:08

1 Answer 1


There are minimum example of your problem

f = Sqrt[a^2 - x^2] + x;
Plot[{f /. a -> 1}, {x, -1, 1}]

enter image description here

It obviously has only one extremum, but Solve returns two

sol = Solve[D[f, x] == 0, {x}]
D[f, x] /. sol /. a -> 1
{{x -> -(a/Sqrt[2])}, {x -> a/Sqrt[2]}}
{2, 0}

It is because Sqrt is a multivalued function in the complex domain. Let's plot both Riemann surface sheets of Sqrt

f2 = -Sqrt[a^2 - x^2] + x;
Plot[{f /. a -> 1, f2 /. a -> 1}, {x, -1, 1}]

enter image description here

Now it is clear that the parasitic solution came from the -Sqrt.

If you solve over Reals domain the result is correct

sol = Solve[D[f, x] == 0, {x}, Reals]
D[f, x] /. sol /. a -> 1
{{x -> Sqrt[a^2]/Sqrt[2]}}

The original problem is too complicated to solve it over the real domain. But you can always select right solutions manually.

Another possibility is setting parameters θ,δ,γ before Solve

θ = 1;
δ = 1;
γ = 1;
sol = Solve[D[V, h] == 0 && D[V, \[Eta]] == 0, {h, \[Eta]}];
Chop[N[D[V, h] /. sol]]
{0, 0, 0, 0, 0}
  • $\begingroup$ I'm sorry, I see what you are saying but I do not understand why this is the case. I think I am simply being very thick here but why is there this degeneracy in the solutions when you do not solve over the reals? Why is there no reflection when I swap $\delta$ from 1 to -1? Is it because it isn't squared in the potential? I don't understand why this is happening (but what you have shown seems to be the cause of my problem). Thanks for your help so far! $\endgroup$
    – user9584
    Commented Sep 18, 2013 at 13:31
  • $\begingroup$ I think it is because root is multivalued function in the complex domain. $\endgroup$
    – ybeltukov
    Commented Sep 18, 2013 at 13:39
  • $\begingroup$ I see...I think. However,I can't really pick the right solution by hand because this function is in an automated process which uses it and its extrema to calculate relevant phenomenology. I need to somehow automatically pick up the correct solution. What I am actually looking for is the global minima of a function (a more complicated version of the function I showed here) for a scan of the parameters theta, delta and some other parameters. So if I find the global minima but D[V,h] at this minima is non zero, this probably means that the global minima is at minus theta? $\endgroup$
    – user9584
    Commented Sep 18, 2013 at 13:44
  • $\begingroup$ No...it doesn't matter if D[V,h] is non zero this should still be a correct extrema of the function, as the function is degenerate in a reflection in theta. So there should be no problem I think? It's simply a problem in mathematica that it isn't able to solve it simply. $\endgroup$
    – user9584
    Commented Sep 18, 2013 at 13:53
  • $\begingroup$ If you change sign of root in V than solutions swap. The problem is how to chose the correct sheet of the Riemann surface. $\endgroup$
    – ybeltukov
    Commented Sep 18, 2013 at 14:09

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.