Implicit plot3d in Sage Math

1.2k Views Asked by At

I am currently trying out using the math software Sage. I am currently in a Calculus III class at my university so I was hoping to be able to leverage its 3D graphing capabilities. In one particular problem I have:

Evaluate the triple integral: f(x,y,z) = $1/(x^2 + y^2 + z^2)^{1/2}$ over the bottom half of the sphere of radius 5 centered at the origin.

To get a good feel for the region I am supposed to integrate over, I wanted to see if I could plot the function in Sage. Below is my syntax:

x,y,z = var('x,y,z')

f(x,y,z) = 1/(x^2 + y^2 + z^2) ^(1/2)

implicit_plot3d(f,(x,-0.5,0.5), (y,-0.5,0.5), (z,-0.5,0.5))

The syntax runs as shown, but when the graph pops up I get nothing. Would someone be able to help troubleshoot me? Is the function too complex for Sage? Is my syntax wrong? Is there another way I could approach plotting the region?

Thank you very much in advance for your help, I really appreciate it!

1

There are 1 best solutions below

4
On BEST ANSWER

Let's think about what you are plotting. Implicit plotting will plot exactly what you ask it to. But this is a function of three variables, so its graph would live in four dimensions... So when that function $f(x,y,z)$ is implicitly plotted, there must be a "level surface" being plotted, not the whole graph. The level surface you have chosen is for $f(x,y,z)=0$. Think about when this expression equals zero (which is what Sage will default to if you don't ask it for more). Note that you should get a graph viewer, just not the graph itself, right?

PS: You may have to change the bounds of the plot too, if you try the right thing; you have pretty small bounds in this case.

PPS: If it weren't for the math error, it really isn't a math.sx question, but one for ask.sagemath or SO.com itself, since it's not a math question per se. Anyway, good luck!


Edit: persistence pays off.

f(x,y,z) = 1/(x^2 + y^2 + z^2) ^(1/2)
implicit_plot3d(f==1,(x,-1,1), (y,-1,1), (z,-1,1))

See also this live version. Also note you don't have to explicitly declare these variables because you declare them with f(x,y,z) = ....