# Plot using NSolve

NSolve[ - 8 a^2 x + 9 x^2 -12 x^3 + 4 x^4 == 0, x];
Plot[Evaluate[  x   /.   %  ],    {a, -0.6, 0.6}]


How can I show only positive roots in this plot?

This equation is one of the case of Equation (32) given in this paper.

• Hello again. It's really a good ideas to 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 minimal working example of your code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. I have edited your question for you this time. Commented Aug 21, 2018 at 18:29
• If you want to clarify the question, please edit the original question, not one of the answers. If you want to ask about a new problem (even if related to this one), please ask a new question. Commented Aug 24, 2018 at 9:58

NSolve is for finding numerical solutions and is not appropriate when there are non-numerical parameters, such as a in your example. Use Solve instead.

If you only need a plot, an alterative approach to solve-and-plot is to plot the implicit equation directly using ContourPlot.

ContourPlot[-8 a^2 x + 9 x^2 - 12 x^3 + 4 x^4 == 0,
{a, -.6, .6}, {x, -1, 3},
FrameLabel -> Automatic,
MaxRecursion -> 4, PlotPoints -> 100,
RegionFunction -> Function[{a, x}, x > 1*^-16]]


MaxRecursion and PlotPoints are used to increase accuracy. RegionFunction is to eliminate non-positive solutions. Since x == 0 is always a solution, I needed to use a value marginally higher than 0 to define the region and exclude the x == 0 line.

Plot[
Evaluate[
x /. NSolve[
{
-8 a^2 x + 9 x^2 - 12 x^3 + 4 x^4 == 0
, x > 0
}
, x
, Reals
]
]
, {a, -0.6, 0.6}
, PlotTheme -> "Scientific"
]


• Thank you for this help.
– Emma
Commented Aug 21, 2018 at 19:12