Ask Your Question

Revision history [back]

Sage lacks support for plotting parametric surfaces $M(u, v)$ where the range of $v$ depends on the value of $u$.

However, a workaround is to use a change of variable.

For the example in the question, we can write $r = t(1 - \cos\theta)$.

Then, instead of varying $r$ in $[0, 1 - \cos(\theta)]$, vary $t$ in $[0, 1]$.

sage: t, theta = SR.var('r, theta')

sage: x = t*(1 - cos(theta)) * cos(theta)
sage: y = t*(1 - cos(theta)) * sin(theta)
sage: z = x^2
sage: xyz = (x, y, z)

sage: parametric_plot3d(xyz, (theta, 0, 2*pi), (t, 0, 1), plot_points=[360, 60])

Parametric surface plotted in Sage: cardioid cutout of a parabolic cylinder