미분적분학실습2-Week-2

914 days ago by jhlee2chn

var('x, y, z') plot3d(3, (x, -2, 2), (y, -2, 2), opacity=0.4) 
       
Sleeping...
If no image appears re-execute the cell. 3-D viewer has been updated.
var('x, y, z') implicit_plot3d(y == 5, (x, -2, 2), (y, 2, 6), (z, -2, 2), opacity=0.4) 
       
Sleeping...
If no image appears re-execute the cell. 3-D viewer has been updated.
implicit_plot3d(x^2 + y^2 == 1, (x, -3, 3), (y, -3, 3), (z, -2, 4), color='red', opacity=0.3) + implicit_plot3d(z == 3, (x, -3, 3), (y, -3, 3), (z, -2, 4), color='green', opacity=0.5) 
       
Sleeping...
If no image appears re-execute the cell. 3-D viewer has been updated.
var('x, y, z') s1 = implicit_plot3d(x^2 + y^2 == 1, (x, -3, 3), (y, -3, 3), (z, -2, 4), color='red', opacity=0.3) s2 = implicit_plot3d(z == 3, (x, -3, 3), (y, -3, 3), (z, -2, 4), color='green', opacity=0.5) s3 = implicit_plot3d(x^2 + y^2 == 1, (x, -3, 3), (y, -3, 3), (z, 2.99, 3.01), color='blue') s1 + s2 + s3 
       
Sleeping...
If no image appears re-execute the cell. 3-D viewer has been updated.
implicit_plot3d(y==x, (x, -3, 3), (y, -3, 3), (z, -3, 3)) 
       
Sleeping...
If no image appears re-execute the cell. 3-D viewer has been updated.
P = (2, -1, 7) Q = (1, -3, 5) PQ = sqrt((P[0]-Q[0])^2 + (P[1]-Q[1])^2 + (P[2]-Q[2])^2) print "|PQ| =", PQ 
       
|PQ| = 3
|PQ| = 3
p = vector([2, -1, 7]) q = vector([1, -3, 5]) print "|PQ| =", (p-q).norm() 
       
|PQ| = 3
|PQ| = 3
var('x, y, z') implicit_plot3d(x^2 + y^2 + z^2 + 4*x - 6*y + 2*z + 6, (x, -6, 6), (y, -6, 6), (z, -6, 6)) 
       
Sleeping...
If no image appears re-execute the cell. 3-D viewer has been updated.
var('x, y, z') p1=implicit_plot3d(x^2 + y^2 + z^2 == 1, (x,-3, 3), (y,-3, 3), (z,-3, 0), opacity=0.2, color='red') p2=implicit_plot3d(x^2 + y^2 + z^2 == 4, (x,-3, 3), (y,-3, 3), (z,-3, 0), opacity=0.4) show(p1+p2, aspect_ratio = [1, 1, 1]) 
       
Sleeping...
If no image appears re-execute the cell. 3-D viewer has been updated.
implicit_plot3d(y^2 + z^2 == 16, (x,-5, 5), (y,-5, 5), (z,-5, 5), opacity=0.2, color='red') 
       
Sleeping...
If no image appears re-execute the cell. 3-D viewer has been updated.
implicit_plot3d(y^2 -4, (x,-5, 5), (y,-5, 5), (z,-5, 5), opacity=0.2, color='red') 
       
Sleeping...
If no image appears re-execute the cell. 3-D viewer has been updated.
p = vector([0, 0, 0]) q = vector([2, 2, 2]) print "distance =", (p-q).norm()-1-2 
       
distance = 2*sqrt(3) - 3
distance = 2*sqrt(3) - 3
A = vector([2, -3, 4]) B = vector([-2, 1, 1]) print "vector a=", B - A 
       
vector a= (-4, 4, -3)
vector a= (-4, 4, -3)
a = vector([4, 0, 3, 5, 10]) b = vector([-2, 1, 5, 7, -1]) print (a+b).norm() print "a+b=", a+b # adds vectors print "a-b=", a-b # subtracts vectors print "3*b=", 3*b print "2*a+ 5*b=", 2*a + 5*b 
       
7*sqrt(6)
a+b= (2, 1, 8, 12, 9)
a-b= (6, -1, -2, -2, 11)
3*b= (-6, 3, 15, 21, -3)
2*a+ 5*b= (-2, 5, 31, 45, 15)
7*sqrt(6)
a+b= (2, 1, 8, 12, 9)
a-b= (6, -1, -2, -2, 11)
3*b= (-6, 3, 15, 21, -3)
2*a+ 5*b= (-2, 5, 31, 45, 15)
a = vector([1, 2, -3]) b = vector([4, 0, 7]) print "2*a+ 3*b=", 2*a + 3*b 
       
2*a+ 3*b= (14, 4, 15)
2*a+ 3*b= (14, 4, 15)
a = vector([2, -1, -2]) print a.norm() print "vector u=", a / a.norm() 
       
3
vector u= (2/3, -1/3, -2/3)
3
vector u= (2/3, -1/3, -2/3)
a = vector([1, 4, -3]) b = vector([0, 5, -7]) print a + b print 4*a + 2*b print a.norm() print (5*a-3*b).norm() 
       
(1, 9, -10)
(4, 26, -26)
sqrt(26)
sqrt(86)
(1, 9, -10)
(4, 26, -26)
sqrt(26)
sqrt(86)
show((5*a-3*b).norm()) 
       
a = vector([-1, 7, 4]) b = vector([6, 2, - 1/2]) print b.inner_product(a) 
       
6
6
print b.inner_product(b) print b.norm()^2 
       
161/4
161/4
161/4
161/4
f(x) = 3*cos(x) df(x) = diff(f(x), x) m = df(pi/3) print m 
       
-3/2*sqrt(3)
-3/2*sqrt(3)
v = vector([1, m]) vn = v.norm() print v/vn print -v/vn 
       
(2/31*sqrt(31), -3/31*sqrt(31)*sqrt(3))
(-2/31*sqrt(31), 3/31*sqrt(31)*sqrt(3))
(2/31*sqrt(31), -3/31*sqrt(31)*sqrt(3))
(-2/31*sqrt(31), 3/31*sqrt(31)*sqrt(3))
(v/vn).norm() 
       
1
1
a = vector([2, 2, -1, 5, 10]) b = vector([5, -3, 2, 4, 20]) ab = a.inner_product(b) an = a.norm() bn = b.norm() ang_rad = arccos(ab/(an*bn)).n(digits=5) ang_deg = (180*ang_rad/pi).n(digits=5) print "ang(rad) =", ang_rad print "ang(deg) =", ang_deg 
       
ang(rad) = 0.45088
ang(deg) = 25.834
ang(rad) = 0.45088
ang(deg) = 25.834
a= vector([2, 2, -1]) b = vector([5, -4, 2]) print a.inner_product(b) 
       
0
0
[sin(i) for i in range(0,3)] 
       
[0, sin(1), sin(2)]
[0, sin(1), sin(2)]
a = vector([1, 2, 3]) an = a.norm() b = a/an print "dir_ang_rad = ", [arccos(b[i]).n(digits=5) for i in range(0,3)] print "dir_ang_deg = ", [(180*arccos(b[i])/pi).n(digits=5) for i in range(0,3)] 
       
dir_ang_rad =  [1.3002, 1.0069, 0.64052]
dir_ang_deg =  [74.499, 57.689, 36.699]
dir_ang_rad =  [1.3002, 1.0069, 0.64052]
dir_ang_deg =  [74.499, 57.689, 36.699]
a = vector([-2, 3, 1]);b = vector([1, 1, 2]) ab = a.inner_product(b);an = a.norm() print "comp_a b =", ab/an print "proj_a b =", ab/an^2 * a 
       
comp_a b = 3/14*sqrt(14)
proj_a b = (-3/7, 9/14, 3/14)
comp_a b = 3/14*sqrt(14)
proj_a b = (-3/7, 9/14, 3/14)
P = vector([2, 1, 0]) Q = vector([4, 6, 2]) F = vector([3, 4, 5]) D = Q - P print "vector D =", D print F.inner_product(D) 
       
vector D = (2, 5, 2)
36
vector D = (2, 5, 2)
36
A = vector([1, 0, -1]) B = vector([3, -2, 0]) C = vector([1, 3, 3]) AB = B-A AC = C-A ABn = AB.norm() ACn = AC.norm() ip_ABAC = AB.inner_product(AC) print (arccos(ip_ABAC / (ABn*ACn))).n(digits=5) 
       
1.7045
1.7045
BA = A-B BC = C-B BAn = BA.norm() BCn = BC.norm() ip_BABC = BA.inner_product(BC) print (arccos(ip_BABC / (BAn*BCn))).n(digits=5) 
       
0.93377
0.93377
CA = A-C CB = B-C CAn = CA.norm() CBn = CB.norm() ip_CACB = CA.inner_product(CB) print (arccos(ip_CACB / (CAn*CBn))).n(digits=5) 
       
0.50330
0.50330
1.7045+0.93377+0.50330 
       
3.14157000000000
3.14157000000000