Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
1  
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 :) –  Sektor Sep 18 '13 at 8:33
    
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? –  user9584 Sep 18 '13 at 9:13
1  
You should provide Vsimp in Mathematica InputForm so it can be easily copied. –  RunnyKine Sep 18 '13 at 9:13
    
Is that better? –  user9584 Sep 18 '13 at 11:35
    
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? –  gpap Sep 18 '13 at 15:08

1 Answer 1

up vote 2 down vote accepted

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]}}
{0}

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}
share|improve this answer
    
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! –  user9584 Sep 18 '13 at 13:31
    
I think it is because root is multivalued function in the complex domain. –  ybeltukov Sep 18 '13 at 13:39
    
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? –  user9584 Sep 18 '13 at 13:44
    
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. –  user9584 Sep 18 '13 at 13:53
    
If you change sign of root in V than solutions swap. The problem is how to chose the correct sheet of the Riemann surface. –  ybeltukov Sep 18 '13 at 14:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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