| Download
All published worksheets from http://sagenb.org
Project: sagenb.org published worksheets
Views: 168756Image: ubuntu2004
Two Cylinders
Tim McLarnan, Earlham CollegeThis is just a small worksheet I produced for a class who were working on the classic calculus problem of computing the volume shared by two cylinders of equal radius which meet at right angles. Students were having trouble visualizing the intersection, and my drawings were not helping; so I went to Sage for backup. Notice that all the figures here can be grabbed and rotated.
var('theta t') tube1 = parametric_plot3d([t, cos(theta), sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'brown', opacity=1) tube2 = parametric_plot3d([cos(theta), t, sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'blue', opacity=1) show(tube1+tube2, aspect_ratio=[1,1,1])
curve1 = parametric_plot3d([cos(theta), cos(theta), sin(theta)], [theta, 0, 2*pi], color='black', thickness=2) curve2 = parametric_plot3d([cos(theta), -cos(theta), sin(theta)], [theta, 0, 2*pi], color='black', thickness=2) tube1 = parametric_plot3d([t, cos(theta), sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'brown', opacity=0.5) tube2 = parametric_plot3d([cos(theta), t, sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'blue', opacity=1.0) show(tube1+tube2+curve1+curve2, aspect_ratio=[1,1,1])
curve1 = parametric_plot3d([cos(theta), cos(theta), sin(theta)], [theta, 0, 2*pi], color='black', thickness=2) curve2 = parametric_plot3d([cos(theta), -cos(theta), sin(theta)], [theta, 0, 2*pi], color='black', thickness=2) tube1 = parametric_plot3d([t, cos(theta), sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'brown', opacity=0.5) tube2 = parametric_plot3d([cos(theta), t, sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'blue', opacity=0.5) show(tube1+tube2+curve1+curve2, aspect_ratio=[1,1,1])
curve1 = parametric_plot3d([cos(theta), cos(theta), sin(theta)], [theta, 0, 2*pi], color='black', thickness=2) curve2 = parametric_plot3d([cos(theta), -cos(theta), sin(theta)], [theta, 0, 2*pi], color='black', thickness=2) tube1 = parametric_plot3d([t, cos(theta), sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'brown', opacity=0.2) tube2 = parametric_plot3d([cos(theta), t, sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'blue', opacity=0.2) face1 = parametric_plot3d([t*cos(theta), cos(theta), sin(theta)], (theta, 0, 2*pi), (t, -1, 1), color='brown') face2 = parametric_plot3d([cos(theta), t*cos(theta), sin(theta)], (theta, -pi, pi), (t, -1, 1), color='blue') show(curve1+curve2+face1+face2+tube1+tube2, aspect_ratio=[1,1,1])
curve1 = parametric_plot3d([cos(theta), cos(theta), sin(theta)], [theta, 0, 2*pi], color='black', thickness=2) curve2 = parametric_plot3d([cos(theta), -cos(theta), sin(theta)], [theta, 0, 2*pi], color='black', thickness=2) tube1 = parametric_plot3d([t, cos(theta), sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'brown', opacity=0) tube2 = parametric_plot3d([cos(theta), t, sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'blue', opacity=0) face1 = parametric_plot3d([t*cos(theta), cos(theta), sin(theta)], (theta, 0, 2*pi), (t, -1, 1), color='brown') face2 = parametric_plot3d([cos(theta), t*cos(theta), sin(theta)], (theta, -pi, pi), (t, -1, 1), color='blue') show(tube1+tube2+curve1+curve2+face1+face2, aspect_ratio=[1,1,1])
curve1 = parametric_plot3d([cos(theta), cos(theta), sin(theta)], [theta, 0, 2*pi], color='black', thickness=2) curve2 = parametric_plot3d([cos(theta), -cos(theta), sin(theta)], [theta, 0, 2*pi], color='black', thickness=2) @interact def _(stage = (j for j in range(29))): if stage<8: tube1 = parametric_plot3d([t, cos(theta), sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'brown', opacity=1-0.1*stage) tube2 = parametric_plot3d([cos(theta), t, sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'blue', opacity=1) show(tube1+tube2+curve1+curve2, aspect_ratio=[1,1,1]) elif stage < 16: tube1 = parametric_plot3d([t, cos(theta), sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'brown', opacity=0.2) tube2 = parametric_plot3d([cos(theta), t, sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'blue', opacity=1-0.1*(stage-8)) show(tube1+tube2+curve1+curve2, aspect_ratio=[1,1,1]) elif stage <24: tube1 = parametric_plot3d([t, cos(theta), sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'brown', opacity=0.2) tube2 = parametric_plot3d([cos(theta), t, sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'blue', opacity=0.2) face1 = parametric_plot3d([t*cos(theta), cos(theta), sin(theta)], (theta, 0, 2*pi), (t, -1, 1), color='brown',opacity=0.125*(stage-16)) face2 = parametric_plot3d([cos(theta), t*cos(theta), sin(theta)], (theta, -pi, pi), (t, -1, 1), color='blue',opacity=0.125*(stage-16)) show(tube1+tube2+face1+face2+curve1+curve2, aspect_ratio=[1,1,1]) else: tube1 = parametric_plot3d([t, cos(theta), sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'brown', opacity=0.2-0.05*(stage-24)) tube2 = parametric_plot3d([cos(theta), t, sin(theta)], (theta,0,2*pi), (t, -2, 2), color = 'blue', opacity=0.2-0.05*(stage-24)) face1 = parametric_plot3d([t*cos(theta), cos(theta), sin(theta)], (theta, 0, 2*pi), (t, -1, 1), color='brown',opacity=0.125*(stage-16)) face2 = parametric_plot3d([cos(theta), t*cos(theta), sin(theta)], (theta, -pi, pi), (t, -1, 1), color='blue',opacity=0.125*(stage-16)) show(tube1+tube2+face1+face2+curve1+curve2, aspect_ratio=[1,1,1])
var('theta phi') outside = parametric_plot3d([cos(theta)*sin(phi), sin(theta)* sin(phi), cos(phi)], [theta,0,2*pi], [phi,pi/4,3*pi/4], color='brown', aspect_ratio=[1,1,1]) inside = parametric_plot3d([sqrt(2)*cos(theta)/2, sqrt(2)*sin(theta)/2, t], [theta, 0, 2*pi], [t, -sqrt(2)/2, sqrt(2)/2], color='brown', aspect_ratio=[1,1,1]) show(outside+inside)