RE: How to plot Implicitly Defined Space Curves.
- To: mathgroup at smc.vnet.net
- Subject: [mg38573] RE: [mg38559] How to plot Implicitly Defined Space Curves.
- From: Jan Mangaldan <hokenjan at yahoo.com>
- Date: Fri, 27 Dec 2002 02:15:12 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I know. This specific case I gave happens to give easily to elimination of variables. But how about this: x^3 -3x y^2 -x^2 y^4 ==1 and 2 x^3 -5y z^4 +3 z^2 ==2. (I wonder if Eliminate[] or Solve[] might help. I'm not sure.) What I am asking for is a general routine, not a solution to a specific case. Please help! Jan M. (~_^) David Park <djmp at earthlink.net> wrote:Jan, In general I believe it will be difficult to solve for the intersection. But in your specific case it is easy to make the plot. Substitute your second equation into the first equation to obtain... eqn1 = x^2 + y^2 + z^2 == 1; eqn2 = eqn1 /. z -> Sin[x*y] x^2 + y^2 + Sin[x*y]^2 == 1 Now we use Mathematica's ImplicitPlot command to plot the curve in the xy-plane. Needs["Graphics`ImplicitPlot`"] plot1 = ImplicitPlot[eqn2, {x, -1, 1}, {y, -1, 1}]; We convert the resulting ContourGraphics to Graphics, take the first part, which contains all the Line primitives, and extract all the lines with the Cases statement. lines2d = Cases[First[Graphics[plot1]], Line[_], Infinity]; We then convert all the 2D points to 3D points using a rule and your second equation to obtain the z coordinate, and display the resulting curve in 3D. lines2d = Cases[First[Graphics[plot1]], Line[_], Infinity]; Show[Graphics3D[ {lines2d /. {x_?NumberQ, y_?NumberQ} -> {x, y, Sin[x y]}}]]; This can be done a little more easily with the DrawGraphics package at my web site below becuase the ImplicitDraw routine automataically extracts the primitive graphics and there is an explicit RaiseTo3D command. Needs["DrawGraphics`DrawingMaster`"] Draw3DItems[ {ImplicitDraw[x^2 + y^2 + Sin[x y]^2 == 1, {x, -1, 1}, {y, -1, 1}] // RaiseTo3D[Sin[#1 #2] &]}]; David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Jan Mangaldan [mailto:hokenjan at yahoo.com] To: mathgroup at smc.vnet.net I want to ask if anyone has tried to write a function that can plot, say, a space curve defined as the intersection of the surfaces x^2 +y^2 +z^2 == 1 and z == Sin[x y]. If not, how can I do it? I'd appreciate any feedback on this. Jan M. (~_~)