# Implicit plot3d in Sage Math

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!

• I just want to mention that I replicated SAGE's mysterious reaction to this command myself. I have used SAGE for a while, and it seems like your syntax is right. I'm not sure what's going on. Nov 10, 2014 at 3:31
• When you replicated it, did you get the same result? Or did you actually get the graph? Nov 10, 2014 at 3:55
• Same result. Also I was running an install on my home server. Were you on SageMathCloud when you tried it? Nov 10, 2014 at 4:10
• I'm not too familiar with the SageMathCloud, but I was running it from a Virtual Machine on my laptop if that's what you were referring to? Nov 11, 2014 at 3:24

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) = ....

• Thank you very much for your help! So is my problem setting $f(x,y,z)$ to a level surface other than $0$? Nov 11, 2014 at 3:26
• There is no problem! Just try some other level surface which is nonempty and fits inside your bounds; it should work fine. Nov 11, 2014 at 19:40
• Do you think you could give a syntax example? I apologize, I'm new to this and wanted to make sure I was understanding. Thanks again for your help! Nov 12, 2014 at 2:11
• Okay, though I was hoping to encourage you to start trying things for yourself - it's only with the struggle that we really internalize things. Anyway, hope this helps, and good luck! Nov 13, 2014 at 15:22