# Hyperbolic Paraboloid
@interact
def Hyperbolid_Paraboloid(a=slider(1,5,step_size=0.2,default=3),
b=slider(1,5,step_size=0.2,default=3),
c=slider(1,5,step_size=0.2,default=2),
slice = selector(["x","y","z"],default="z"),
slice_constant =slider(-5,5,step_size=0.2,default=1),
color=selector(["red","green","blue"],label="Color",default="green"),
threeD=checkbox(default=false,label='3D view (Red/Cyan glasses)') ):
x1, x2, y1, y2, z1, z2 = -a, a, -b, b, -c, c
var("x,y,z,t")
surf = -x^2/a^2+y^2/b^2-z==0
G = implicit_plot3d(surf, (x,5*x1,5*x2), (y,5*y1,5*y2), (z,5*z1,5*z2),
color=color,opacity=0.5)
pretty_print(html(latex(surf)))
if slice=="x":
T = "$$ x = k \\\ y = t \\\ z = -\\frac{k^2}{a^2} + \\frac{t^2}{b^2} $$"
G += parametric_plot3d([slice_constant,t,-slice_constant^2/a^2+t^2/b^2 ],[t,-10,10],color='yellow',thickness=10)
pretty_print(html(T))
if slice=="y":
T = "$$ x = t \\\ y = k \\\ z = \\frac{t^2}{a^2} + \\frac{k^2}{b^2} $$"
G += parametric_plot3d([t,slice_constant,-t^2/a^2+slice_constant^2/b^2 ],[t,-10,10],color='yellow',thickness=10)
pretty_print(html(T))
if slice=="z":
r = sqrt(abs(slice_constant))
if slice_constant > 0:
G += parametric_plot3d([a*tan(t)*r,b*sec(t)*r,slice_constant ],[t,-1.3,1.3],color='yellow',thickness=10)
G += parametric_plot3d([-a*tan(t)*r,-b*sec(t)*r,slice_constant ],[t,-1.3,1.3],color='yellow',thickness=10)
T = "$$ x = \\pm a\sqrt{k}\\tan(t) \\\ y = \\pm b\\sqrt{k}\sec(t) \\\ z = k $$"
if slice_constant < 0:
G += parametric_plot3d([a*sec(t)*r,b*tan(t)*r,slice_constant ],[t,-1.3,1.3],color='yellow',thickness=10)
G += parametric_plot3d([-a*sec(t)*r,-b*tan(t)*r,slice_constant ],[t,-1.3,1.3],color='yellow',thickness=10)
T = "$$ x = \\pm a\sqrt{k}\\sec(t) \\\ y = \pm b\\sqrt{k}\tan(t) \\\ z = k $$"
pretty_print(html(T))
if threeD:
show(G,stereo='redcyan',spin=true,figsize=(8,12),aspect_ratio=(1,1,1))
else:
show(G,spin=false,perspective_depth=true,figsize=(8,12),aspect_ratio=(1,1,1))
|
Click to the left again to hide and once more to show the dynamic interactive window
|