# How can i plot graph and its root?

I am using this code.

wn = 100;
aap = 0.2;
ome = 9;
Solve[{(2 x + 2) ((dco - wn aap x)^2 + 1) + 4*ome*x == 0}, {x}]
Plot[{x /. %}, {dco, -40, 0}]


I am using this upper code and getting the right graph. But the Problem is that I do not want the result in this form as it is showing like this: I want to calculate roots.

{{x -> 0.0333333 (-10. + dco) + ((5.20833*10^-6 - 9.0211*10^-6 I) (-548800. - 64000. dco - 1600. dco^2))/(-6560. - 1371. dco - 60. dco^2 - 1. dco^3 + 5.19615 Sqrt[ 99259. + 143320. dco + 24722. dco^2 + 1160. dco^3 + 19. dco^4])^( 1/3) - (0.00833333 + 0.0144338 I) (-6560. - 1371. dco - 60. dco^2 - 1. dco^3 + 5.19615 Sqrt[ 99259. + 143320. dco + 24722. dco^2 + 1160. dco^3 + 19. dco^4])^(1/3)}, {x -> 0.0333333 (-10. + dco) + ((5.20833*10^-6 + 9.0211*10^-6 I) (-548800. - 64000. dco - 1600. dco^2))/(-6560. - 1371. dco - 60. dco^2 - 1. dco^3 + 5.19615 Sqrt[ 99259. + 143320. dco + 24722. dco^2 + 1160. dco^3 + 19. dco^4])^( 1/3) - (0.00833333 - 0.0144338 I) (-6560. - 1371. dco - 60. dco^2 - 1. dco^3 + 5.19615 Sqrt[ 99259. + 143320. dco + 24722. dco^2 + 1160. dco^3 + 19. dco^4])^(1/3)}, {x -> 0.0333333 (-10. + dco) - ( 0.0000104167 (-548800. - 64000. dco - 1600. dco^2))/(-6560. - 1371. dco - 60. dco^2 - 1. dco^3 + 5.19615 Sqrt[ 99259. + 143320. dco + 24722. dco^2 + 1160. dco^3 + 19. dco^4])^(1/3) + 0.0166667 (-6560. - 1371. dco - 60. dco^2 - 1. dco^3 + 5.19615 Sqrt[ 99259. + 143320. dco + 24722. dco^2 + 1160. dco^3 + 19. dco^4])^(1/3)}}

I want my answer in interpolation form. I think you can help me.

• @vijay Okay, after deleting and inserting several spaces, I am confident that I was able to reproduce the code that you actually used. Please, always copy the code (in input form) from you notebook to your post. Otherwise, important information might be lost. – Henrik Schumacher Feb 5 at 9:40
• @vijay It is still unclear what you want because you attempt to solve a polynomial equation of order three. What you see is are the three general solution of which one or more may be complex. The plotting routine returns nonreal input. – Henrik Schumacher Feb 5 at 9:43
• @gwr Sorry, now question is clear. i have edited it. i want to find out roots and plot it. – vijay Feb 5 at 10:31
• Have you tried Reduce[{(2 x + 2) ((dco - wn aap x)^2 + 1) + 4*ome*x == 0}, {x}]? You can convert the conditions to rules for plotting by using ToRules. – gwr Feb 5 at 13:32

wn = 100;
aap = 1/5;
ome = 9;

sol = Solve[{(2 x + 2) ((dco - wn aap x)^2 + 1) + 4*ome*x == 0}, x] //
FullSimplify

(* {{x -> 1/30 (-10 + dco) + (343 +
dco (40 + dco))/(60 (-6560 - dco (1371 + dco (60 + dco)) +
3 √(297777 +
3 dco (143320 + dco (24722 + dco (1160 + 19 dco)))))^(1/3)) +
1/60 (-6560 - dco (1371 + dco (60 + dco)) +
3 √(297777 +
3 dco (143320 + dco (24722 + dco (1160 + 19 dco)))))^(1/3)}, {x ->
1/30 (-10 +
dco) - (I (-I + Sqrt[3]) (343 + dco (40 + dco)))/(120 (-6560 -
dco (1371 + dco (60 + dco)) +
3 √(297777 +
3 dco (143320 + dco (24722 + dco (1160 + 19 dco)))))^(1/3)) +
1/120 I (I + Sqrt[3]) (-6560 - dco (1371 + dco (60 + dco)) +
3 √(297777 +
3 dco (143320 + dco (24722 + dco (1160 + 19 dco)))))^(1/3)}, {x ->
1/30 (-10 +
dco) + (I (I + Sqrt[3]) (343 + dco (40 + dco)))/(120 (-6560 -
dco (1371 + dco (60 + dco)) +
3 √(297777 +
3 dco (143320 + dco (24722 + dco (1160 + 19 dco)))))^(1/3)) +
1/120 (-1 - I Sqrt[3]) (-6560 - dco (1371 + dco (60 + dco)) +
3 √(297777 +
3 dco (143320 + dco (24722 + dco (1160 + 19 dco)))))^(1/3)}} *)


If you use Evaluate (Attributes of Plot include HoldAll) you will see that the curve is composed of segments from each of the three roots. No single function can represent the curve since the curve is not single-valued for all values of dco.

Plot[Evaluate@(x /. sol), {dco, -40, 0},
PlotStyle -> (Directive[Thick, ColorData[97][#]] & /@ {1, 3, 2}),
PlotLegends -> Placed[Automatic, {0.5, 0.625}]]


If you want only real expressions, then the roots will be ConditionalExpressions and be expressed in the form of Root objects.

(solr = Solve[{(2 x + 2) ((dco - wn aap x)^2 + 1) + 4*ome*x == 0}, x,
Reals] // Simplify) // Short[#, 5] &


Plot[Evaluate@(x /. solr), {dco, -40, 0},
WorkingPrecision -> 15,
MaxRecursion -> 10,
PlotStyle -> (Directive[Thick, ColorData[97][#]] & /@ {1, 3, 2}),
PlotLegends -> Placed[Automatic, {0.5, 0.625}]]


• Thankyou very much. – vijay Feb 6 at 5:01