Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168733
Image: ubuntu2004
g2d = Graphics() #for planar region and approx. rectangles g3d = Graphics() #for solid of revolution and approx. disks f(x)=5-4*x^2 g(x)=1 #function defining the solid of revolution n = 5 #size of partition a = 0 b = 1 #interval of the region dx= (b-a)/n #size of subintervals surface1=revolution_plot3d(f(x),(x,a,b),opacity=0.5,rgbcolor='blue',show_curve=False,parallel_axis='x') surface2=revolution_plot3d(g(x),(x,a,b),opacity=0.5,rgbcolor='red',show_curve=False,parallel_axis='x') g3d = surface1 + surface2 curve1=plot(f(x),(x,a,b),rgbcolor='blue') curve2=plot(g(x),(x,a,b),rgbcolor='red') g2d=curve1+curve2 for i in range(n): xi=a+(2*i+1)*dx/2 #using midpoint as sample point Rectangle = line([[xi-dx/2,g(xi)], [xi+dx/2,g(xi)], [xi+dx/2,f(xi)], [xi-dx/2,f(xi)], [xi-dx/2,g(xi)]], rgbcolor='green') OuterDisk = revolution_plot3d(f(xi),(x,xi-dx/2,xi+dx/2),opacity=0.5,rgbcolor='green',show_curve=False,parallel_axis='x') InnerDisk = revolution_plot3d(g(xi),(x,xi-dx/2,xi+dx/2),opacity=0.5,rgbcolor='green',show_curve=False,parallel_axis='x') g3d = g3d + OuterDisk + InnerDisk g2d = g2d + Rectangle g2d.show(figsize = [8,8]) g3d.show(figsize = [8,8],zoom=1)
g2d = Graphics() #for planar region and approx. rectangles g3d = Graphics() #for solid of revolution and approx. disks a=0 b=1 #interval of the region in terms of x f(x)=5-4*x^2 g(x)=1 #function defining the solid of revolution ay = 1 by = 5 #interval of the region in terms of y fy(y)=((5-y)/4)^(1/2) gy(y)=0 #functions in terms of y defining the solid of revolution f(x)=5-4*x^2 n = 5 #size of partition dy= (by-ay)/n #size of subintervals surface1=revolution_plot3d(f(x),(x,a,b),opacity=0.5,rgbcolor='blue',show_curve=False,parallel_axis='x') surface2=revolution_plot3d(g(x),(x,a,b),opacity=0.5,rgbcolor='red',show_curve=False,parallel_axis='x') g3d = surface1 + surface2 curve1=plot(f(x),(x,a,b),rgbcolor='blue') curve2=plot(g(x),(x,a,b),rgbcolor='red') g2d=curve1+curve2 for i in range(n): yi=ay+(2*i+1)*dy/2 #using midpoint as sample point Rectangle = line([[gy(yi),yi-dy/2], [gy(yi),yi+dy/2], [fy(yi),yi+dy/2], [fy(yi),yi-dy/2], [gy(yi),yi-dy/2]], rgbcolor='green') OuterDisk = revolution_plot3d(yi+dy/2,(x,gy(yi),fy(yi)),opacity=0.5,rgbcolor='green',show_curve=False,parallel_axis='x') InnerDisk = revolution_plot3d(yi-dy/2,(x,gy(yi),fy(yi)),opacity=0.5,rgbcolor='green',show_curve=False,parallel_axis='x') g3d = g3d + OuterDisk + InnerDisk g2d = g2d + Rectangle g2d.show(figsize = [8,8]) g3d.show(figsize = [8,8],zoom=1)