Calc III - Worksheet 1

119 days ago by becci

Welcome to SAGE!  

We can do all sorts of cool things with SAGE.

First, let's plot a few points.

points([(0,0), (1,1), (2,pi)], pointsize=30) 
       

In 3-D!

points([(0,0,0), (1, 1, 1), (2, pi, -4)]) 
       
p=vector((0,2,4)) q=vector((1,1,1)) 
       
p-q 
       
(-1, 1, 3)
(-1, 1, 3)

norm gives the length of the vector

norm(p-q) 
       
sqrt(11)
sqrt(11)
plot(p) + plot(q) + plot(p-q, color='red') 
       
@interact def _(p=input_box(default=(0,2,4)),q=input_box(default=(1,1,1))): show(plot(vector(p)) + plot(vector(q)) + plot(vector(p)-vector(q), color='red')) print html('Enter vectors p and q. This will plot p and q in blue and p-q in red.') 
       

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

Now we plot the (boundary of) the cylinder we talked about in class!  

Grab it (with your mouse) to rotate it around and view it from different angles.

var('x,y,z') equation=x^2+z^2==9 equation 
       
x^2 + z^2 == 9
x^2 + z^2 == 9
implicit_plot3d(equation, (x,-5,5),(y,-5,5),(z,-5,5)) 
       
 
       
var('x,y,z') @interact def _(equation=input_box(default=(x-1)^2+(y-2)^2+(z+3)^2==16), size=(5)): show(implicit_plot3d(equation, (x,-size,size),(y,-size,size),(z,-size,size))) print html('Enter implicitly defined surface in 3-d (in variables x, y and z) and size of display box.') 
       
equation 
size 

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