Re: How to plot this
- To: mathgroup at smc.vnet.net
- Subject: [mg64454] Re: How to plot this
- From: Jon Harrop <usenet at jdh30.plus.com>
- Date: Fri, 17 Feb 2006 04:12:35 -0500 (EST)
- References: <dt1coe$5j$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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