2.5.2 Three-Dimensional Plots

Sage produces three-dimensional plots using an open source package called [Jmol]. Here are a few examples:

Yellow Whitney's umbrella http://en.wikipedia.org/wiki/Whitney_umbrella:

sage: u, v = var('u,v')
sage: fx = u*v
sage: fy = u
sage: fz = v^2
sage: P = parametric_plot3d([fx, fy, fz], (u, -1, 1), (v, -1, 1),
...   frame=False, color="yellow")
sage: show(P)
Once you have evaluated show(P), so that the plot is visible, you can click and drag on it to rotate the figure.

Cross cap http://en.wikipedia.org/wiki/Cross-cap:

sage: u, v = var('u,v')
sage: fx = (1+cos(v))*cos(u)
sage: fy = (1+cos(v))*sin(u)
sage: fz = -tanh((2/3)*(u-pi))*sin(v)
sage: P = parametric_plot3d([fx, fy, fz], (u, 0, 2*pi), (v, 0, 2*pi),
...   frame=False, color="red")
sage: show(P)

Twisted torus:

sage: u, v = var('u,v')
sage: fx = (3+sin(v)+cos(u))*cos(2*v)
sage: fy = (3+sin(v)+cos(u))*sin(2*v)
sage: fz = sin(u)+2*cos(v)
sage: P = parametric_plot3d([fx, fy, fz], (u, 0, 2*pi), (v, 0, 2*pi),
...   frame=False, color="red")
sage: show(P)

See About this document... for information on suggesting changes.