# rotating y = f(x), a < x < b about the x-axis
u,v,t,x = var('u,v,t,x')
f = sin(x^2)/x # Gabriel's Horn
a = 1
b = 10
fx = u
fy = f(x=u)*cos(v)
fz = f(x=u)*sin(v)
ua = a
ub = b
va = 0
vb = 2*pi
p1 = parametric_plot3d([fx, fy, fz], (u, ua, ub), (v, va, vb),color="orange",plot_points = [180,180],opacity=0.8)
# Now, to find the Surface Area
r_u = vector([derivative(fx,u),derivative(fy,u),derivative(fz,u)])
r_v = vector([derivative(fx,v),derivative(fy,v),derivative(fz,v)])
N = (r_u.cross_product(r_v))
A = N.norm()
print "To get the surface area, integrate this:"
show(A)
surface_integral = False
if surface_integral:
B = integrate(A,u,ua,ub)
SA = integrate(B,v,va,vb)
print
html("Surface Area for the red ring is $%s$"%str(latex(SA)))
# Trying to approximate numerically is unproductive here
# var('d,h')
# SA_approx = numerical_integral(lambda h: numerical_integral(lambda d:A, ua,ub)[0], va, vb)
# print SA_approx
# And show a normal vector
@interact
def _(u0 = slider(ua,ub,0.1,ua), v0 = slider(va,vb,0.1,va)):
x0 = fx(u=u0,v=v0)
y0 = fy(u=u0,v=v0)
z0 = fz(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 + p3 + p4).show(aspect_ratio=True,axes=True)
|
Click to the left again to hide and once more to show the dynamic interactive window
|