# two interlinked tori
u, v, t = var('u,v,t')
f1 = (4+(3+cos(v))*sin(u), 4+(3+cos(v))*cos(u), 4+sin(v))
f2 = (8+(3+cos(v))*cos(u), 3+sin(v), 4+(3+cos(v))*sin(u))
p1 = parametric_plot3d(f1, (u,0,2*pi), (v,0,2*pi), texture="red")
p2 = parametric_plot3d(f2, (u,0,2*pi), (v,0,2*pi), texture="blue")
ua = 0
ub = 2*pi
va = 0
vb = 2*pi
# Now, finding the Surface Area
r_u = vector([derivative(f1[0],u),derivative(f1[1],u),derivative(f1[2],u)])
r_v = vector([derivative(f1[0],v),derivative(f1[1],v),derivative(f1[2],v)])
N = (r_u.cross_product(r_v))
A = N.norm()
print "To get the surface area, integrate this:"
show(A)
surface_integral = True
if surface_integral:
B = integrate(A,u,ua,ub)
SA = integrate(B,v,va,vb)
print
pretty_print(html("Surface Area for the red ring is $%s$"%str(latex(SA))))
# And show a normal vector on the red ring
@interact
def _(u0 = slider(ua,ub,0.1,ua), v0 = slider(va,vb,0.1,va)):
x0 = f1[0](u=u0,v=v0)
y0 = f1[1](u=u0,v=v0)
z0 = f1[2](u=u0,v=v0)
p3 = point3d((x0,y0,z0),size=20)
n = [x0+t*N[0](u=u0,v=v0),y0+t*N[1](u=u0,v=v0),z0+t*N[2](u=u0,v=v0)]
p4 = parametric_plot3d(n,(t,-1,1),color='green',thickness=5)
(p1 + p2 + p3 + p4 ).show(aspect_ratio=True)
|
Click to the left again to hide and once more to show the dynamic interactive window
|