MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to plot this


siegmund natter wrote:
> Can anyone tell why this is wrong?
> 
> eqn1 = x + y == 2*x*y;
> eqn1 /.y -> y[x];
> Plot[y[x], {x, 1, 3}]
> 
> How do I do it correctly? (This is just an example; I want to do this
> with a much more difficult equation)
> Thanks a lot.

You can solve for y to get an expression for y[x]:

  In[1]:= eqn1 = x + y == 2*x*y;

  In[2]:= y[x_] = First[y /. Solve[eqn1, {y}]]

             x
  Out[2]= --------
          -1 + 2 x

which you can then plot:

  In[3]:= Plot[y[x], {x, 1, 3}];

You could also use something like InequalityPlot to highlight the same
border:

  In[4]:= << Graphics`InequalityGraphics`

  In[5]:= InequalityPlot[x + y < 2*x*y , {x, -3, 3}, {y, -3, 3}];

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/ocaml_for_scientists/chapter1.html


  • Prev by Date: Re: Eliminate Complex Roots
  • Next by Date: SetOptions with Column
  • Previous by thread: Re: How to plot this
  • Next by thread: Re: How to plot this