Ch-7-Prob-14-Final-김강섭

1864 days ago by matrix

x=vector([1,2,3,4]) a=vector([2,3,1,0]) x1=(x.inner_product(a))/(a.inner_product(a))*a x2=x-x1 print x1 print print x2 print print x2.inner_product(x1) print print x==x1+x2 # Checking if x=x1+x2 
       
(11/7, 33/14, 11/14, 0)

(-4/7, -5/14, 31/14, 4)

0

True
(11/7, 33/14, 11/14, 0)

(-4/7, -5/14, 31/14, 4)

0

True