# Plotting relationship between two variables when their relationship is given by a polynomial (2)

I would like to plot the following function $$p$$ in the $$x$$-axis and $$V$$ in the $$y$$-axis. The function is given by:

62.77142857142857*(6.5+2*(18.57 - V))*(0.005*p*(18.57-V)+(6.5+2 *(18.57-V))*V)*(0.01*p*(18.57-V)+(6.5+2*(18.57-V))*V)*(0.01 *(0.65+ 0.01*(18.57-V))+0.002275*(18.57-V)*V)+0.01*(65+0.0017499999999999998*(18.57-V))*(18.57-V)*((6.5 +2*(18.57-V))*V*(0.005*p*(18.57-V)+(6.5 +2*(18.57-V))*V)-(6.5+2*(18.57-V))*V*(0.01*p*(18.57-V)+(6.5 +2*(18.57-V))*V)+2*(0.005*p*(18.57-V)+ (6.5 +2*(18.57-V))*V)*(0.01*p*(18.57-V)+(6.5+2*(18.57-V))*V))*(-0.05869954325800593*(18.57-V)+0.39*(6.5+2*(18.57-V))*(0.01*(0.65+0.01*(18.57-V))+0.002275*(18.57-V)*V))=0

Note:

I posted a similar question yesterday and @Bob Hanlon was kind enough to provide me with a very helpful code. I tried doing the same thing for this polynomial today, and Mathematica shows an error.

• ContourPlot[expression == 0, {p, -23, 41}, {V, -1, 22}, PlotPoints -> 80, MaxRecursion -> 4] Jul 4, 2021 at 3:15
• @cvgmt I tried this one and all I get is an empty graph :( Jul 4, 2021 at 3:26
• Not clear what you are asking for. Is your code the function? Why does it end with "=0"? Is p a function or a variable? Please clarify.
– A.G.
Jul 4, 2021 at 7:31

If you are getting an error, post the actual code used and the error message.

Clear["Global*"]


To Rationalize the polynomial you need to use the two-argument form Rationalize[#, 0]&. This will enable you to use whatever WorkingPrecision you need in the plot.

eqn = 62.77142857142857*(6.5 +
2*(18.57 - V))*(0.005*p*(18.57 - V) + (6.5 + 2*(18.57 - V))*V)*(0.01*
p*(18.57 - V) + (6.5 + 2*(18.57 - V))*
V)*(0.01*(0.65 + 0.01*(18.57 - V)) + 0.002275*(18.57 - V)*V) +
0.01*(65 + 0.0017499999999999998*(18.57 - V))*(18.57 -
V)*((6.5 + 2*(18.57 - V))*
V*(0.005*p*(18.57 - V) + (6.5 + 2*(18.57 - V))*V) - (6.5 +
2*(18.57 - V))*V*(0.01*p*(18.57 - V) + (6.5 + 2*(18.57 - V))*V) +
2*(0.005*p*(18.57 - V) + (6.5 + 2*(18.57 - V))*V)*(0.01*
p*(18.57 - V) + (6.5 + 2*(18.57 - V))*
V))*(-0.05869954325800593*(18.57 - V) +
0.39*(6.5 + 2*(18.57 - V))*(0.01*(0.65 + 0.01*(18.57 - V)) +
0.002275*(18.57 - V)*V)) == 0 // Rationalize[#, 0] & // Simplify;


To get a feel for the range of V solve for a specific value of p

Solve[eqn /. p -> 1, V, Reals] // N

(* {{V -> 7.61125*10^-20}, {V -> 18.7221}, {V -> 21.8628},
{V -> 142.557}, {V -> 37037.2}} *)

Manipulate[
ContourPlot[Evaluate@eqn, {p, 0, 3}, {V, -1, vMax},
WorkingPrecision -> 40,
PlotPoints -> {25, 200},
MaxRecursion -> 5,
FrameLabel -> (Style[#, 12, Bold] & /@ {p, V})],
{{vMax, 25}, {25, 150, 40000}}]
`