ch1_10_noh

372 days ago by kyunganoh

a=vector([2, 1, 4]) b=vector([2, 2, 2]) ab=a.inner_product(b) aa=a.inner_product(a) p=ab/aa*a;w=b-p print "p=", p print "w=", w 
       
p= (4/3, 2/3, 8/3)
w= (2/3, 4/3, -2/3)
p= (4/3, 2/3, 8/3)
w= (2/3, 4/3, -2/3)