CoCalc Shared FilesOhlone / 2016-02-23-222344.htmlOpen in CoCalc with one click!
Author: Emmanuel Garcia
Views : 9
Description: Jupyter html version of Ohlone/2016-02-23-222344.ipynb
2016-02-23-222344
In [116]:
#x + y + 2z = 5

v1 = [ 3,0,-4 ]; # first spanning vector
v2 = [ 0,3,-4 ]; # second spanning vector
b = [-1, -1, 10]; # The vector to project
v3 = cross(v1,v2)/3 # # The normal vector

# projectin of b onto v3
p1 = dot(b,v3)/dot(v3,v3)*v3
[ 88/41 88/41 66/41 ] # To verify that it worked

p2 = b - p1
[ -129/41 -129/41 344/41] # To verify that it worked

# to verify that it worked by showing that the projections add to the original vector
p1 + p2
Out[116]:
v3 =

   4   4   3

p1 =

   2.14634146341463   2.14634146341463   1.60975609756098

ans =

   2.14634146341463   2.14634146341463   1.60975609756098

p2 =

  -3.14634146341463  -3.14634146341463   8.39024390243902

ans =

  -3.14634146341463  -3.14634146341463   8.39024390243902

ans =

   -1   -1   10

In [ ]: