222 - Topic 25 - Parametric Surfaces

1709 days ago by Professor222

John Travis

Mississippi College

Parametric Surfaces:  Areas and Normal lines

(Many of these graphs come from sagemath.org.)

# 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

# cylindrical Star of David u,v,t = var('u,v,t') fx = cos(u)*cos(v)*(abs(cos(3*v/4))^500 + abs(sin(3*v/4))^500)^(-1/260)*(abs(cos(4*u/4))^200 + abs(sin(4*u/4))^200)^(-1/200) fy = cos(u)*sin(v)*(abs(cos(3*v/4))^500 + abs(sin(3*v/4))^500)^(-1/260)*(abs(cos(4*u/4))^200 + abs(sin(4*u/4))^200)^(-1/200) fz = sin(u)*(abs(cos(4*u/4))^200 + abs(sin(4*u/4))^200)^(-1/200) ua = -pi ub = pi 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 pretty_print(html("Surface Area 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) # absolute values make it harder to do derivatives and deal with Surface Area 
       

Click to the left again to hide and once more to show the dynamic interactive window

# Double heart u, v, t = var('u,v,t') fx = ( abs(v) - abs(u) - abs(tanh((1/sqrt(2))*u)/(1/sqrt(2))) + abs(tanh((1/sqrt(2))*v)/(1/sqrt(2))) )*sin(v) fy = ( abs(v) - abs(u) - abs(tanh((1/sqrt(2))*u)/(1/sqrt(2))) - abs(tanh((1/sqrt(2))*v)/(1/sqrt(2))) )*cos(v) fz = sin(u)*(abs(cos(4*u/4))^1 + abs(sin(4*u/4))^1)^(-1/1) ua = 0 ub = pi va = -pi vb = pi p1 = parametric_plot3d([fx, fy, fz], (u, ua, ub), (v, va, vb),opacity=0.8,color='pink') # Now, finding 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 pretty_print(html("Surface Area 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+.1,ub-.1,0.1,ua+.1), v0 = slider(va+.1,vb-.1,0.1,va+.1)): 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) 
       

Click to the left again to hide and once more to show the dynamic interactive window

# Heart u,v,t = var('u,v,t') fx = cos(u)*(4*sqrt(1-v^2)*sin(abs(u))^abs(u)) fy = sin(u) *(4*sqrt(1-v^2)*sin(abs(u))^abs(u)) fz = v ua = -pi ub = pi va = -1 vb = 1 p1 = parametric_plot3d([fx, fy, fz], (u, ua, ub), (v, va, vb) ,plot_points = [180,180], frame=False, color="red") # Now, finding 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 pretty_print(html("Surface Area 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+.1,ub-.1,0.1,ua+.1), v0 = slider(va+.1,vb-.1,0.1,va+.1)): 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) 
       

Click to the left again to hide and once more to show the dynamic interactive window

# Bowtie u, v, t = var('u,v,t') f_x = sin(u) / (sqrt(2) + sin(v)) f_y = sin(u) / (sqrt(2) + cos(v)) f_z = cos(u) / (1 + sqrt(2)) p1 = parametric_plot3d([f_x, f_y, f_z], (u, -pi, pi), (v, -pi, pi), frame=False, color="green") # Now, finding the Surface Area r_u = vector([derivative(f_x,u),derivative(f_y,u),derivative(f_z,u)]) r_v = vector([derivative(f_x,v),derivative(f_y,v),derivative(f_z,v)]) N = (r_u.cross_product(r_v)) print N 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 pretty_print(html("Surface Area is $%s$"%str(latex(SA)))) # And show a normal vector u0 = 3*pi/5 v0 = 2*pi/3 x0 = f_x(u=u0,v=v0) y0 = f_y(u=u0,v=v0) z0 = f_z(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='red',thickness=5) (p1 + p3 + p4 ).show(aspect_ratio=True) 
       
# Boy’s surface http://en.wikipedia.org/wiki/Boy’s_surface u, v = var('u,v') fx = 2/3* (cos(u)* cos(2*v) + sqrt(2)* sin(u)* cos(v))* cos(u) / (sqrt(2) - sin(2*u)* sin(3*v)) fy = 2/3* (cos(u)* sin(2*v) - sqrt(2)* sin(u)* sin(v))* cos(u) / (sqrt(2) - sin(2*u)* sin(3*v)) fz = sqrt(2)* cos(u)* cos(u) / (sqrt(2) - sin(2*u)* sin(3*v)) parametric_plot3d([fx, fy, fz], (u, -2*pi, 2*pi), (v, 0, pi), plot_points = [90,90], frame=False, color="orange") # long time -- about 30 seconds 
       
# Maeder’s_Owl u, v = var('u,v') fx = v *cos(u) - 0.5* v^2 * cos(2* u) fy = -v *sin(u) - 0.5* v^2 * sin(2* u) fz = 4 *v^1.5 * cos(3 *u / 2) / 3 parametric_plot3d([fx, fy, fz], (u, -2*pi, 2*pi), (v, 0, 1),plot_points = [90,90], frame=False, color="purple") 
       
# Klein bottle u, v = var('u,v') fx = (3*(1+sin(v)) + 2*(1-cos(v)/2)*cos(u))*cos(v) fy = (4+2*(1-cos(v)/2)*cos(u))*sin(v) fz = -2*(1-cos(v)/2) * sin(u) parametric_plot3d([fx, fy, fz], (u, 0, 2*pi), (v, 0, 2*pi), frame=False, color="green") 
       
# Dini’s spiral u, v = var('u,v') fx = cos(u)*sin(v) fy = sin(u)*sin(v) fz = (cos(v)+log(tan(v/2))) + 0.2*u parametric_plot3d([fx, fy, fz], (u, 0, 12.4), (v, 0.1, 2),frame=False, color="red") 
       
# A Conchoid u, v = var('u,v') k = 1.2; k_2 = 1.2; a = 1.5 f = (k^u*(1+cos(v))*cos(u), k^u*(1+cos(v))*sin(u), k^u*sin(v)-a*k_2^u) parametric_plot3d(f, (u,0,6*pi), (v,0,2*pi), plot_points=[40,40], texture=(0,0.5,0)) 
       
# An ellipsoid u, v = var('u,v') parametric_plot3d([3*sin(u)*cos(v), 2*sin(u)*sin(v), cos(u)], (u,0, 2*pi), (v, 0, 2*pi),plot_points=[50,50], aspect_ratio=[1,1,1],opacity=0.7) 
       
# A Cone u, v = var('u,v') parametric_plot3d([u*cos(v), u*sin(v), u], (u, -1, 1), (v, 0, 2*pi+0.5), plot_points=[50,50]) 
       
# A Paraboloid u, v = var('u,v') parametric_plot3d([u*cos(v), u*sin(v), u^2], (u, 0, 1), (v, 0, 2*pi+0.4), plot_points=[50,50]) 
       
# A Hyperboloid u, v = var('u,v') plot3d(u^2-v^2, (u, -1, 1), (v, -1, 1), plot_points=[50,50]).show() 
       
# fun var('u,v,t') ua = -25 ub = 25 va = -25 vb = 25 f_x = u - u^3/3 + u*v^2 f_y = v - v^3/3 + v*u^2 f_z = u^2 - v^2 p1 = parametric_plot3d([f_x, f_y, f_z], (u, ua, ub), (v, va, vb), plot_points = [50,50], frame=False, color="green") # Now, finding the Surface Area r_u = vector([derivative(f_x,u),derivative(f_y,u),derivative(f_z,u)]) r_v = vector([derivative(f_x,v),derivative(f_y,v),derivative(f_z,v)]) N = (r_u.cross_product(r_v)) print N A = N.norm() print show(A) print # B = integrate(A,u,ua,ub) # SA = integrate(B,v,va,vb) print # print "Surface Area for one of the rings is ",SA # Need to play with assume to get rid of the absolute values in A above. # And show a normal vector u0 = (ub-ua)/3 + ua v0 = (vb-va)/4 + va x0 = f_x(u=u0,v=v0) y0 = f_y(u=u0,v=v0) z0 = f_z(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,0,1/40),color='red',thickness=5) (p1 + p3 + p4 ).show() 
       
# astroidal sphere from textbook a=2 u,v,t = var('u,v,t') fx = a*sin(u)^3*cos(v)^3 fy = a*sin(u)^3*sin(v)^3 fz = a*cos(u)^3 ua = 0 ub = pi va = 0 vb = 2*pi p1 = parametric_plot3d([fx, fy, fz], (u, ua, ub), (v, va, vb),color="pink",plot_points = [180,180],opacity=0.8) u0 = pi/3 v0 = 3*pi/4 x0 = fx(u=u0,v=v0) y0 = fy(u=u0,v=v0) z0 = fz(u=u0,v=v0) p2 = point3d([x0,y0,z0],pointsize=10) (p1+p2).show(aspect_ratio=True,frame=0,viewer="jmol") # absolute values make it harder to do derivatives and deal with Surface Area