# Discontinuous plot problem while plotting after using NSolve

My problem is when I try to numerically solve an equation, and then substitute the solution in my function (i.e substituting y in the x's in my function), the plot appears to be discontinuous (it shouldn't) and I don't know what to do about it, I'm really new to the program.

My code is as follows:

y = NSolve[-a + t/(2 x) + 1/(8 Pi x^4) - 1/(8 Pi x^2) == 0, x];

f[x_] = 1/4 (x - 8 Pi/3 (a*x^3) + 3/x)

solution = Table[f[x] /. y, {a, {0.0013, 0.0033}}];

Plot[solution, {t, 0, 0.05}, PlotRange -> {0, 2}]


Both plots must be continuous and smooth, this is my main problem. Thank you for helping me.

• Welcome to the Mathematica Stack Exchange. Could you please add a picture showing the discontinuous plot? And perhaps how you want it modified. At this point, it is not clear what you are asking.
– Syed
Jun 19 at 13:15
• Your functions have complex values. Plot shows the graph only when the imaginary part is zero. Try ReImPlot instead. Jun 19 at 13:16
• I uploaded a picture Jun 19 at 13:46
• Thank you, Syed I appreciate your help Jun 19 at 13:58

y = NSolve[-a + t/(2 x) + 1/(8 Pi x^4) - 1/(8 Pi x^2) == 0, x, Reals];
f[x_] := 1/4 (x - 8 Pi/3 (a*x^3) + 3/x)
solution = Table[f[x] /. y, {a, {0.0013, 0.0033}}];
p1 = Plot[Evaluate@First@solution, {t, 0, 0.05}, PlotRange -> {0, 2}]
p2 = Plot[Evaluate@Last@solution, {t, 0, 0.05}, PlotRange -> {0, 2}]
GraphicsRow[{p1, p2}]


EDIT

Show[p1, p2]


• Thank you, it works, I appreciate your help! Jun 19 at 13:56