Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

RE: graphing in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54435] RE: [mg54344] graphing in Mathematica
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sun, 20 Feb 2005 00:10:05 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

I have to admit that getting ContourPlot3D to work relatively efficiently,
or to work at all takes a certain amount of trial and error. It helps if you
have a good idea of the actual surface.

In any case, the following works fairly well.

ContourPlot3D[
    x^2 + y^2 + 4z^2 - 1, {x, -1.1, 1.1}, {y, -1.1, 1.1}, {z, -0.6, 0.6},
    PlotPoints -> {4, 6},
    PlotRange -> {{-1.1, 1.1}, {-1.1, 1.1}, {-0.6, 0.6}}];

If we solve for z we could try to parametrize the surface.

Solve[x^2 + y^2 + 4z^2 == 1, z]
{{z -> (-(1/2))*Sqrt[1 - x^2 - y^2]},
  {z -> (1/2)*Sqrt[1 - x^2 - y^2]}}

The following does not work because of the warning messages and the ragged
edges.

ParametricPlot3D[{{x, y, (-(1/2))*Sqrt[1 - x^2 - y^2]},
    {x, y, (1/2)*Sqrt[1 - x^2 - y^2]}}, {x, -2, 2}, {y, -2, 2}];

Using the DrawGraphics package at my web site we can plot in polar
coordinates and then transform to Cartesian coordinates. This will plot
faster.

Needs["DrawGraphics`DrawingMaster`"]

Draw3DItems[
  {{ParametricDraw3D[{{r, \[Theta], (1/2)*Sqrt[1 - r^2]},
        {r, \[Theta], (-2^(-1))*Sqrt[1 - r^2]}}, {r, 0, 1},
       {\[Theta], 0, 2*Pi}]} /. DrawingTransform3D[#1*Cos[#2] & ,
      #1*Sin[#2] & , #3 & ]},
 BoxRatios -> {1, 1, 0.5},
 Background -> Linen,
 ImageSize -> 450];

As usual we obtain less than a smooth rendering near the 'equator' because
of the steepness of the z function there. The following does a somewhat
better job by a nonlinear scaling of the r parameter.

Draw3DItems[
  {{ParametricDraw3D[{{s, \[Theta], (1/2)*Sqrt[1 - s^(2/3)]},
        {s, \[Theta], (-2^(-1))*Sqrt[1 - s^(2/3)]}}, {s, 0, 1},
       {\[Theta], 0, 2*Pi}]} /. DrawingTransform3D[#1^(1/3)*Cos[#2] & ,
      #1^(1/3)*Sin[#2] & , #3 & ]},
 BoxRatios -> {1, 1, 0.5},
 Background -> Linen,
 ImageSize -> 450];

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/




From: Nick [mailto:nch2198 at louisiana.edu]
To: mathgroup at smc.vnet.net

How do I graph the function x^2+y^2+4z^2=1?
I am using Mathematica version 4 and
using ContourPlot3D doesn't work.




  • Prev by Date: Re: Elegant syntax for multiple conditional assignment?
  • Next by Date: Re: Re: Elegant syntax for multiple conditional assignment?
  • Previous by thread: Re: graphing in Mathematica
  • Next by thread: Question about an integral