@interact
def _(a = (1, (0, 5)), b = (1, (-5, 5)), c = (1, (-5, 5))):
html("<div class='math'>x^2 / %f %s y^2 / %f %s z^2 / %f = 1</div>" %
(abs(a), sign(b), abs(b), sign(c), abs(c)))
var('u v')
if b >= 0 and c >= 0:
x = sqrt(a) * cos(u) * sin(v)
y = sqrt(b) * sin(u) * sin(v)
z = sqrt(c) * cos(v)
umin = pi / 2
umax = 3 * pi / 2
vmin = 0
vmax = pi
elif b >= 0 and c < 0:
x = sqrt(a) * cos(u) * cosh(v)
y = sqrt(b) * sin(u) * cosh(v)
z = sqrt(-c) * sinh(v)
umin = pi / 2
umax = 3 * pi / 2
vmin = -1
vmax = 1
elif b < 0 and c >= 0:
x = sqrt(a) * cos(u) * cosh(v)
y = sqrt(-b) * sinh(v)
z = sqrt(c) * sin(u) * cosh(v)
umin = pi / 2
umax = 3 * pi / 2
vmin = -1
vmax = 1
else:
x = sqrt(a) * cosh(v)
y = sqrt(-b) * cos(u) * sinh(v)
z = sqrt(-c) * sin(u) * sinh(v)
umin = 0
umax = 2 * pi
vmin = -1
vmax = 1
P = parametric_plot3d([[-x, y, z], [x, y, z]], (u, umin, umax), (v, vmin, vmax),
aspect_ratio = [1, 1, 1])
show(P)
|
Click to the left again to hide and once more to show the dynamic interactive window
|