Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Projection of vector

I'm working to reproduce an example made in GeoGebra* using Sage. What I got in GeoGebra looks like this,

  • 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,

code,

var('t')
A = (9, 5); B = (2, 4); C = (16, -2);
P = plot(x,(x,2,5), rgbcolor=(1,1,0)) 
P += (vector(B)-vector(A)).plot(color='green', start=A)
P += (vector(C)-vector(B)).plot(color='green', start=B)
show(P, figsize=5)

Projection of vector

I'm working to reproduce an example made in GeoGebra* using Sage. What I got in GeoGebra looks like this,

  • 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,

code,code (thanks to @tmonteil I've been able to update my code with some calculations, I am still struggling to produce the plot),

var('t')
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), rgbcolor=(1,1,0)) 
color='red')
P += (vector(B)-vector(A)).plot(color='green', AB.plot(color='green', start=A)
P += (vector(C)-vector(B)).plot(color='green', BC.plot(color='green', start=B)
print "Length of AB proj. onto BC"
show(P, figsize=5)
figsize=5, aspect_ratio=1)

# show(v1.inner_product(v2)/v2.norm()^2*v2)
show(v1.inner_product(v2)/v2.norm()) # længden af AB proj. på BC

Projection of vector

I'm working to reproduce an example made in GeoGebra* using Sage. What I got in GeoGebra looks like this,this, image description

  • 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,this, image description

code (thanks to @tmonteil I've been able to update my code with some calculations, I am still struggling to produce the plot),

# var('t')
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(v1.inner_product(v2)/v2.norm()^2*v2)
show(v1.inner_product(v2)/v2.norm()) # længden af AB proj. på BC
show(v1.inner_product(v2)/v2.norm())

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

  • 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 descriptionimage description

code (thanks to @tmonteil I've been able to update my code with some calculations, I am still struggling to produce the plot),

# var('t')
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(v1.inner_product(v2)/v2.norm()^2*v2)
show(v1.inner_product(v2)/v2.norm())
show(AB.inner_product(BC)/BC.norm()^2*v2)
show(AB.inner_product(BC)/BC.norm()) 
RDF(AB.inner_product(BC)/BC.norm())