박근석 HW1

1923 days ago by matrix

1+7777655+766 
       
7778422
7778422
 
       
x=vector([-1,-2,3]) y=vector([3,-2,-1]) print "cos(theta)= ", x.inner_product(y)/(x.norm()*y.norm()) 
       
cos(theta)=  -1/7
cos(theta)=  -1/7
 
       

5차원 백터

 

x = vector([-1,-2,3, 7, 43])
y = vector([3,-2,-1, 54, -77])

            의 사이각을 구해보겠습니다.

그리고 이것을 과제로 제출하려고 합니다.

x=vector([-1,-2,3, 7, 43]) y=vector([3,-2,-1, 54, -77]) print "cos(theta)= ", x.inner_product(y)/(x.norm()*y.norm()) 
       
cos(theta)=  -2935/8469204*sqrt(478)*sqrt(8859)
cos(theta)=  -2935/8469204*sqrt(478)*sqrt(8859)
A= matrix(QQ, 3, [1,1,2, 2,4,-3, 3,6,-5]); A # 3x3 matrix B= matrix(QQ, 3, 1, [9,1,0]) # 3x1 vector print A.augment(B) # augmented matrix 
       
[ 1  1  2  9]
[ 2  4 -3  1]
[ 3  6 -5  0]
[ 1  1  2  9]
[ 2  4 -3  1]
[ 3  6 -5  0]
A = matrix(QQ, 3, [1,1,2, 2,4,-3, 3,6,-5]) b = vector(QQ, 3,[9,1,0]) A.augment(b) 
       
[ 1  1  2  9]
[ 2  4 -3  1]
[ 3  6 -5  0]
[ 1  1  2  9]
[ 2  4 -3  1]
[ 3  6 -5  0]
o=vector([0, 0, 0]) #creates a vector p1=vector([0, -4, 2]) p2=vector([-3, 1, 0]) q=vector([2, 3, 4]) q1=vector([2, -1, 6]) q2=vector([-1, 4, 4]) print "vector OQ=", q-o # subtract print "vector P1Q1=", q1-p1 # subtract print "vector P2Q2=", q2-p2 # subtract print "vector OQ = vector P1Q1= vector P2Q2" 
       
vector OQ= (2, 3, 4)
vector P1Q1= (2, 3, 4)
vector P2Q2= (2, 3, 4)
vector OQ = vector P1Q1= vector P2Q2
vector OQ= (2, 3, 4)
vector P1Q1= (2, 3, 4)
vector P2Q2= (2, 3, 4)
vector OQ = vector P1Q1= vector P2Q2