I have a set of two equations regarding equations of state of some stars. I have a lot of variables that depend upon each other (all the μ's). I also have a parameter, ρ. Ideally I'd like to get the analytical solutions as functions of ρ (i.e. μu (ρ) etc.), but I realize that's probably too much to ask for. NSolve either returns an empty set or hangs on "Running", depending on how I present the problem, while I'm pretty sure that my equations are correct.

mu = 5; md = 7; ms = 150; me = 5 10^(-1); ρ = 3 10^(-1);
ku := Sqrt[μu^2 + mu^2];
kd := Sqrt[μd^2 + md^2];
ks := Sqrt[μs^2 + ms^2];
ke := Sqrt[μe^2 + me^2];
e1 = μd == μu + μe;
e2 = μs == μd;
e3 = ku^3/(3 Pi^2) + kd^3/(3 Pi^2) + ks^3/(3 Pi^2) == ρ;
e4 = (2 ku^3)/(3 Pi^2) - kd^3/(3 Pi^2) - ks^3/(3 Pi^2) - ke^3/(3 Pi^2) == 0;
NSolve[{e1,e2,e3,e4},{μu, μd, μs, μe}]

This is a copy-paste of my code. I hope the Greek letters don't mess anything up but if they do I'll edit my post with some other symbol.

  • 1
    $\begingroup$ What are the parameter ranges? $\endgroup$ – Ulrich Neumann Jul 8 '19 at 10:04
  • $\begingroup$ Welcome to Mma.SE. Start by taking the tour now and learning about asking and what's on-topic. Always edit if improvable, show due diligence, give brief context, include informtion about your parameters domain and range. A minimal working example of your code is a must. Thanks for using formatted form. By doing all this you help us to help you and likely you will inspire great answers. $\endgroup$ – rhermans Jul 8 '19 at 10:18

Your set of equations seems to have no real solution:

NMinimize[#.# &[{e1, e2, e3, e4} /. Equal -> Subtract], {\[Mu]u, \[Mu]d, \[Mu]s, \[Mu]e}]
(* {2.33919*10^10, {\[Mu]u -> 87.5809, \[Mu]d -> 0.000601605, \[Mu]s ->1.92908*10^-10, \[Mu]e -> -0.0252355}}*)

because the minimum of residuals isn't zero!

| improve this answer | |
  • $\begingroup$ You are right, I tought it was my Mathematica illiteracy but I had other errors too. Thanks for your effort! $\endgroup$ – Sotiris Jul 9 '19 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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