3
$\begingroup$

I tried to plot roots of my equations with Plot, but because these graphs are not functions in some region Mathematica can not handle it. How can I sketch my equation?

Plot[n /. NSolve[n (1/4 + (a - 6 n/10^3)^2) == 40 && n > 0, Reals], {a, -3, 3}]
$\endgroup$
4
$\begingroup$
ContourPlot[n (1/4 + (a - 6 n/10^3)^2) == 40, {a, -3, 3}, {n, 0, 170}]

does the job.

| improve this answer | |
$\endgroup$
3
$\begingroup$
Clear["Global`*"]

sol = n /. Solve[n (1/4 + (a - 6 n/10^3)^2) == 40 && n > 0, n, Reals];

There are three roots

Length@sol

(* 3 *)

To see the full curve you need to increase the function sampling (PlotPoints option) particularly at transitions between the solutions (MaxRecursions option)

Plot[Evaluate[sol], {a, -3, 3},
 PlotStyle -> {Green, Blue, Red},
 PlotPoints -> 100,
 MaxRecursion -> 10,
 AxesLabel -> (Style[#, 14, Bold] & /@ {a, n}),
 PlotLegends -> Placed[Automatic, {0.25, 0.6}]]

enter image description here

| improve this answer | |
$\endgroup$

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.