RE: Drawing an ellipse
- To: mathgroup at smc.vnet.net
- Subject: [mg36724] RE: [mg36654] Drawing an ellipse
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
- Date: Fri, 20 Sep 2002 04:16:47 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
>-----Original Message----- >From: pimak [mailto:piotrowski.maciek at interia.pl] To: mathgroup at smc.vnet.net >Sent: Wednesday, September 18, 2002 8:09 AM >Subject: [mg36724] [mg36654] Drawing an ellipse > > >Hello, >I am new with Mathematica, I have one question, >I know that the sollution might be very easy, but I wasn't able to >find it by now. >I would like to draw an ellipse, the formula let's say is as follows: > > > >0.09 x^2 +0.04 x y + 0.06 y^2 = 4 > >Thanks > >Maciej > > > Two methods: (1) solve for explit functions y = f[x] and plot those: In[2]:= eqn = 0.09 x^2 + 0.04 x y + 0.06 y^2 == 4 ... just for convenience; In[5]:= sols = Solve[eqn, y] In[6]:= y /. sols ...these are the two functions for y expressed by x. To find the minimum and maximum values for x, we spot the discriminant, and solve for x: In[12]:= {xmin, xmax} = x /. Solve[ Cases[y /. sols[[1]], Sqrt[disc_] :> disc, Infinity] == 0, x] ...now we may use Plot: In[18]:= Plot[Evaluate[y /. sols], {x, xmin, xmax}, AspectRatio -> Automatic] (2) guess approximate values for xmin, xmax and let Mathematica do all that work: In[1]:= << Graphics`ImplicitPlot` ...load the package In[19]:= ImplicitPlot[eqn, {x, -7, 7}] ...done. -- hw