TransWikia.com

FindMinimum with Manipulate

Mathematica Asked by HeitorGalacian on March 21, 2021

I have an expression for the energy of a given physical system and I need to plot its minimum with respect to one of the parameters while the others are allowed to vary.

The expression is the following:

energy[c_,σ_,k_,Λ_,p2_,Δ_,Γ_]:=c/(2 σ^2) - (k*Λ)^2/ 2*Δ/(Δ^2 + Γ^2/4)*p2*c - π (k*Λ)^2*Δ*σ^2*p2*PolyLog[2, -(c/(2 *(Δ^2 + Γ^2/4)*π*σ^2))];

I want to plot this expression for the value of $sigma$ (I start from a small value in FindMinimum, for instance, $10^{-6}$ in order to avoid the zero) which makes it minimum while $p$ and $Delta$ are allowed to vary. The remaining variables have definite values. In my attempts, I have tried the following:

Manipulate[Plot[FindMinimum[energy[7*10^6, σ, 8.055*10^6, 0.0000659176, p, Δ, 1], {σ, 10^-6}][[2]], {p, 0, 10}], {Δ, 10^-6, 1000}]

When I run this last line, it gives me the manipulate plot. Nevertheless, it does return the following mistakes:

FindMinimum: The line search decreased the step size to within the tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the function. You may need more than MachinePrecision digits of working precision to meet these tolerances

and

General: "Further output of FindMinimum::lstol will be suppressed during this calculation."

I am not sure this is the correct way to achieve what I need, so I wonder if anyone may shed some light on this problem.

Thanks in advance.

One Answer

Clear["Global`*"]

energy[c_, σ_, k_, Λ_, p2_, Δ_, Γ_] :=
  c/(2 σ^2) - (k*Λ)^2/2*Δ/(Δ^2 + Γ^2/4)*
    p2*c - π (k*Λ)^2*Δ*σ^2*p2*
    PolyLog[2, -(c/(2*(Δ^2 + Γ^2/4)*π*σ^2))];

Manipulate[Column@{
   Plot[FindMinimum[
      {energy[7*10^6, σ, 8055*^3, 659176*^-10, 
        p, Δ, 1], σ > 0}, {σ, 10^-6}][[1]],
    {p, 0, 10},
    WorkingPrecision -> 15,
    Frame -> True,
    FrameLabel -> (Style[#, 12, Bold] & /@
       {p, Subscript[energy, min]}),
    ImageSize -> Medium,
    ImagePadding -> {{70, 10}, {Automatic, 10}}],
   Plot[σ /. FindMinimum[
       {energy[7*10^6, σ, 8055*^3, 659176*^-10, 
         p, Δ, 1], σ > 0}, {σ, 10^-6}][[2]],
    {p, 0, 10},
    WorkingPrecision -> 15,
    Frame -> True,
    FrameLabel -> (Style[#, 12, Bold] & /@ {p, σ}),
    ImageSize -> Medium,
    ImagePadding -> {{70, 10}, {Automatic, 0}}]},
 {{Δ, 500, Style[Δ, 12, Bold]}, 10^-6, 1000, Appearance -> "Labeled"}]

enter image description here

Correct answer by Bob Hanlon on March 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP