FindMinimum with Manipulate

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.

• This works (i diveded function energy by 10^10 to help FindMinimum) Manipulate[ Plot[\[Sigma] /. FindMinimum[ Rationalize[ energy[7*10^6, \[Sigma], 8.055*10^6, 0.0000659176, p, \[CapitalDelta], 1], 0]/10^10, {\[Sigma], .01, 10}, MaxIterations -> 500, PrecisionGoal -> 5, WorkingPrecision -> 20][[2]], {p, 0, 10}], {\[CapitalDelta], 10^-6, 1000, Appearance -> "Labeled"}]  – Akku14 Nov 3 '20 at 3:15
• Your input parameters have MachinePrecision. See Precision[0.0000659176]  which is $MachinePrecision  about 16, depending an processor. Since i noticed that FindMinimum need higher Precision, i Rationalize the input to infinite precision. Otherwise WorkingPrecision -> 20  wouldn't work. Second, working with version 8.0, id didn't get any error messages. – Akku14 Nov 5 '20 at 5:06 1 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"}]  • When picking parts [[1]] and [[2]], could you please explain why it should be this way? I mean when plotting$sigma\$ for the values in which the expression of the energy is minimum, you have to choose [[2]] and not [[1]]. I am still a lit bit confused with it. – HeitorGalacian Nov 3 '20 at 15:34
• Look at the output of With[{p = 5, \[CapitalDelta] = 500}, FindMinimum[{energy[7*10^6, \[Sigma], 8055*^3, 659176*^-10, p, \[CapitalDelta], 1], \[Sigma] > 0}, {\[Sigma], 10^-6}]]. The first part is the minimum energy and the second part is a rule with the value of \[Sigma] at which the minimum occurred. See documentation for FindMinimum – Bob Hanlon Nov 3 '20 at 15:43
• I cannot reproduce the errors that you mention. I am using v12.1.1 The errors that you report appear to indicate that FindMinimum may be returning unevaluated for you. Perhaps it is timing out. The starting value that you used (and I continued with) for σ of 10^-6 (in both FindMinimum) seems too small. Try converting both values to 1/10` and see if that helps. – Bob Hanlon Nov 5 '20 at 0:03