222 - Topic 26 - Parametric Surface of Revolution

1495 days ago by Professor222

John Travis

Mississippi College

# 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

# rotate y = f(x), a < x < b about both x and y axes # Will need f inverse when rotating about y-axis u,v,t,x,y,z = var('u,v,t,x,y,z') f = sin(x) a = 0 b = pi assume(a<x<b) g(x) = f - y finv = g.roots(x, multiplicities=False)[0] print "The inverse of f is ",finv ua = a ub = b va = 0 vb = 2*pi # Graph y = f(x) as a curve in the xy-plane p0 = parametric_plot3d([t,f(x=t),0],(t,a,b),thickness=10,color='blue') # Rotate about x-axis p1 = parametric_plot3d([u, f(x=u)*cos(v), f(x=u)*sin(v)], (u, ua, ub), (v, va, vb),color="red",plot_points = [180,180],opacity=0.8) # Rotate about y-axis p2 = parametric_plot3d([finv(y=u)*cos(v), u, finv(y=u)*sin(v)], (u, ua, ub), (v, va, vb),color="green",plot_points = [180,180],opacity=0.8) # Since the inverse is a multi-valued functions, do the other half separately p2 += parametric_plot3d([(b - finv(y=u))*cos(v), u, (b-finv(y=u))*sin(v)], (u, ua, ub), (v, va, vb),color="green",plot_points = [180,180],opacity=0.8) (p0+p1+p2).show(aspect_ratio=True,axes=True) 
       
from sage.plot.plot3d.parametric_surface import ParametricSurface, MobiusStrip def f(x,y): return x+y, sin(x)*sin(y), x*y P = ParametricSurface(f, (srange(0,2*pi,0.1), srange(-pi,pi,0.1))) show(P) 
       
S = MobiusStrip(1/4,.1) S.is_enclosed() S.show()