0
$\begingroup$

Consider the following plot:

Plot[(22500 + T^2/3) ϕ^2 + 320 ϕ^3 + ϕ^4 /. T -> 96.43650760992945`, {ϕ, -200, 20}]

I would like to find the value of $\Phi<0$ and $T>0$ to obtain the first minimum of the above function.

These two values can be obtained with

FindRoot[
  {(22500 + T^2/3) ϕ^2 + 320 ϕ^3 + ϕ^4 == 0 , 
   D[(22500 + T^2/3) ϕ^2 + 320 ϕ^3 + ϕ^4, {ϕ, 1}] == 0}, 
  {{ϕ, -200}, {T, 1}}]

which yields

FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances.
{ϕ -> -160., T -> 96.4365}

However, I would like to obtain it with NSolve but it does not work:

NSolve[
  {(22500 + T^2/3) ϕ^2 + 320 ϕ^3 + ϕ^4 == 0, 
   D[(22500 + T^2/3) ϕ^2 + 320 ϕ^3 + ϕ^4, {ϕ, 1}] == 0}, 
  {ϕ, T}]

which gives

NSolve::infsolns: Infinite solution set has dimension at least 1. Returning intersection of solutions with -((92291 T)/87992)-(121001 [Phi])/175984 == 1.
{{ϕ -> 0., T -> -0.953419}}

as a solution, which is obviously wrong.

$\endgroup$

2 Answers 2

0
$\begingroup$
eqns = {(22500 + T^2/3) ϕ^2 + 320 ϕ^3 + ϕ^4 == 0,
    D[(22500 + T^2/3) ϕ^2 + 320 ϕ^3 + ϕ^4, ϕ] == 0,
    ϕ < 0, T > 0} // Simplify;

Use Solve rather than NSolve

sol = Solve[eqns, {ϕ, T}, Reals][[1]]

(* {ϕ -> -160, T -> 10 Sqrt[93]} *)

Verifying that sol satisfies eqns

And @@ (eqns /. sol)

(* True *)

The approximate values are

sol // N

(* {ϕ -> -160., T -> 96.4365} *)

EDIT: To use NSolve, use the option Method->{"UseSlicingHyperplanes" -> False}

soln = NSolve[eqns, {ϕ, T}, Reals, 
   Method -> {"UseSlicingHyperplanes" -> False}][[1]]

(* {ϕ -> -160., T -> 96.4365} *)
$\endgroup$
2
  • $\begingroup$ Thanks but why is NSolve not working? $\endgroup$
    – ketherok
    Sep 13, 2019 at 8:01
  • $\begingroup$ @ketherok There is a dimensional component to the solution set (when phi is 0). It can be removed to get the finite solution set as follows: In[119]:= poly = (22500 + t^2/3)*phi^2 + 320 phi^3 + phi^4; NSolve[{poly, D[poly, phi], phi*recip - 1} == 0] Out[120]= {{phi -> -160., recip -> -0.00625, t -> 96.4365076099}, {phi -> -160., recip -> -0.00625, t -> -96.4365076099}} $\endgroup$ Sep 13, 2019 at 20:04
1
$\begingroup$

When we use ContourPlot we see that min is at roughly T=0 and $\Phi=-175$

    ContourPlot[(22500 + T^2/3) ϕ^2 + 
  320 ϕ^3 + ϕ^4, {T, -100, 100}, {ϕ, -250, 0}, 
 PlotLegends -> Automatic]

enter image description here

We then use NMinimize

NMinimize[{(22500 + T^2/3) ϕ^2 + 320 ϕ^3 + ϕ^4,   0 < T < 100, -250 < ϕ < 0}, {ϕ, T}]

{-8.80964*10^7, {$\Phi$ -> -176.125, T -> 2.97721*10^-11}}

Plot3D[(22500 + T^2/3) ϕ^2 + 320 ϕ^3 + ϕ^4, {T, -100, 
  100}, {ϕ, -200, 20}]

enter image description here

$\endgroup$

Your Answer

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

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