ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 22 Jul 2016 07:45:26 -0500Projection of vectorhttp://ask.sagemath.org/question/34190/projection-of-vector/ I'm working to reproduce an example made in GeoGebra* using Sage. What I got in GeoGebra looks like this,
![image description](http://i.stack.imgur.com/gLkEJ.png)
* would add link if I could …
The goal is to find the length of _j_ only knowing _A_, _B_, and _C_.
Here's where I'm at in Sage, it seems really smart, but all help files and templates I find online feels way too advanced for where I'm currently at. I've written the code below and it's currently look like this,
![image description](http://i.stack.imgur.com/8TOHN.png)
code (thanks to [@tmonteil](http://ask.sagemath.org/users/1305/tmonteil/) I've been able to update my code with some calculations, I am still struggling to produce the plot),
A = (9, 5); B = (2, 4); C = (16, -2);
AB = vector(B)-vector(A)
BC = vector(C)-vector(B)
P = plot(x,(x,2,5), color='red')
P += AB.plot(color='green', start=A)
P += BC.plot(color='green', start=B)
print "Length of AB proj. onto BC"
show(P, figsize=5, aspect_ratio=1)
# show(AB.inner_product(BC)/BC.norm()^2*v2)
show(AB.inner_product(BC)/BC.norm())
RDF(AB.inner_product(BC)/BC.norm())
etbFri, 22 Jul 2016 07:45:26 -0500http://ask.sagemath.org/question/34190/