Hello,

I have a system of linear equation, where each variable is a vector
itself. I can not figure out how to use sage to solve it. Here is a
simplified example. I would like to find an intersection between a
plane and and a segment.
H - is the point of interest (unknown).
n - is the normal to the plane.
T1 - start of the segment.
T2 - end of the segment.
a - one known constant.
b - second known constant.

I know that H belongs to the plane: H.dot(n) = a.
I know that H belongs to the line: H = T1 + (T2 -T1)*b

How can I make sage find H?

I tried using VectorSpace:

H = var('H')
V = VectorSpace(FractionField(PolynomialRing(ZZ,'x')),3)
a = 5;
b = 0.5;
T1=V([1000.96,-0.0352826,0.00822599])
T2=V([1877.95,48.9193,-162.054])
n = V([-1,0, 0])
eq1 = H.dot_product(n) == a
eq2 = (T2 - T1) * b == H
solve([eq1,eq2], H)

I tried using numpy arrays:

import numpy
H = var('H')
a = 5;
b = 0.5;
T1=numpy.array([1000.96,-0.0352826,0.00822599])
T2=numpy.array([1877.95,48.9193,-162.054])
n = numpy.array([-1,0, 0])
eq1 = numpy.dot(H,n) == a
eq2 = (T2 - T1) * b == H
solve([eq1,eq2], H)

I do not get any result. I am new to sage. What am I doing wrong?

Thank you.
Alexander

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to