CoCalc Public FilesLab 8 / Lab8-turnin.ipynb
Author: nathan nguyen
Views : 38
Compute Environment: Ubuntu 20.04 (Default)
In [ ]:
# Name: Nathan Nguyen
# I worked on this code with: Eri, Mika, Cindy

# Please do all of your work for this week's lab in this worksheet. If
# you wish to create other worksheets for scratch work, you can, but
# this is the one that will be graded. You do not need to do anything
# to turn in your lab. It will be collected by your TA at the beginning
# of (or right before) next week’s lab.

# Be sure to clearly label which question you are answering as you go and to


In [9]:
#1
var("X,Y")
func1 = (X^2)+(Y^2)+(3*X)+(5*Y)
plot3d(func1, (X,-5,5),(Y,-5,5))

In [10]:
#2
func2 = X^2+3*X
der2 = diff(func2,X)
der2a = der2(0) #slope at x = 0
plot(func2)+plot(0+der2a*(X),color="red", axes_labels = ["X","Z"])

In [11]:
#3
func3 = Y^2+5*Y
der3 = diff(func3,Y)
der3a = der3(0) #slope at y = 0
plot(func3)+plot(der3(0)*X,color="red", axes_labels = ["Y","Z"])

In [12]:
#4
var("X,Y")
plot3d(der2a*X+der3a*Y,(X,-5,5),(Y,-5,5), color = "red", opacity = 0.5) + plot3d(func1, (X,-5,5),(Y,-5,5))

In [13]:
#5
z5 = 2*(X-2)-1*(Y-3)+7
plot3d(z5,(X,-10,10),(Y,-10,10)) + point3d((2,3,7), size = 100, color = "red")

In [14]:
#6
func6 = (X^2)+(Y^2)+(3*X)+(5*Y)
func6a = X^2 + 3*X # (when y = 0)
der6a = diff(func6,X)
der6a1 = der6a(1) #slope at x = 1

func6b = Y^2 + 5*Y # (when x = 0)
der6b = diff(func6b,Y)
der6b1 = der6b(-1) # slope at y = -1

znaught = func6.subs([X==1,Y==-1])
z6 = der6a1*(X-1)+der6b1*(Y+1) + znaught

plot3d(func6,(X,-10,10),(Y,-10,10))+plot3d(z6,(X,-10,10),(Y,-10,10), opacity = 0.5)+point3d((1,-1,znaught), color = "red", size = 100)