0
$\begingroup$

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

Can someone please help me with a code for this one?

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.

Thanks in advance!

$\endgroup$
3
  • 1
    $\begingroup$ ContourPlot[expression == 0, {p, -23, 41}, {V, -1, 22}, PlotPoints -> 80, MaxRecursion -> 4] $\endgroup$
    – cvgmt
    Jul 4 '21 at 3:15
  • $\begingroup$ @cvgmt I tried this one and all I get is an empty graph :( $\endgroup$
    – timothy
    Jul 4 '21 at 3:26
  • $\begingroup$ 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. $\endgroup$
    – A.G.
    Jul 4 '21 at 7:31
1
$\begingroup$

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}}]

enter image description here

$\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.