Re: Plotting a x,y,z function
- To: mathgroup at smc.vnet.net
- Subject: [mg98706] Re: Plotting a x,y,z function
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 16 Apr 2009 04:18:41 -0400 (EDT)
On 4/15/09 at 4:59 AM, raeanne.napoleon at gmail.com (chem_chick) wrote: >I needed help plotting the following function: >f[x_,y_,z_] = (x^2+y^2+z^2) e^-(r^2/2) >ContourPlot3D[(x^2 + y^2 - z^2) Exp[-r^2/2], {x, -10, 10}, {y, -10, >10}, {z, -10, 10}] >does not work because it doesn't understand what r (radius) >is....what is the keyword/whatever for radius? There is none. >Or do I have to define r in terms of x,y,z somehow?! Yes. >Help with syntax will be great! Assuming standard cartesian coordinates, then r^2 should be x^2+y^2+z^2 and the following code will give you the desired graphic ContourPlot3D[(x^2 + y^2 - z^2) Exp[-(x^2 + y^2 - z^2)/2], {x, -10, 10}, {y, -10, 10}, {z, -10, 10}] Or, the function you wrote when corrected as folllows: f[x_,y_,z_] = (x^2+y^2+z^2) E^-((x^2 + y^2 - z^2)/2) can be used to create the graphic using ContourPlot3D[f[x,y,z], {x, -10, 10}, {y, -10, 10}, {z, -10, 10}]