2
$\begingroup$

I tried setting up the two parametric line equations

$Assumptions = Element[(AB0|AB1|A0|A1),Vectors[n,Reals]] 
                      && Element[(t0|t1),Reals]
P0 = AB0 t0 + A0
P1 = AB1 t1 + A

1

And then I assume closest joining line to line 0 and line 1 is perpendicular to both line 1 and line 2. Thus the dot product of each line vector with the joining vector should be 0. I set up this pair of equations and try to solve.

Solve[(P0 - P1) . AB0 == 0 && (P0 - P1 ) . AB1 == 0, {t0,t1}]

The output of wolfram cloud ( mathematica notebook form ) is

enter image description here

which suggests either I have done something wrong or the language can't do what I'm trying. Note I know how to solve for a fixed number of dimensions by declaring that each symbolic variable is a vector. However I'd like to solve it generally.

I can do the general form on pen and paper because when you expand the two equations you get two equations where all the terms have reduced to scalars.

AB0.AB0 t0 - AB1 AB0 t1 = (A1 - A0)AB0
AB0.AB1 t0 - AB1 AB1 t1 = (A1 - A0)AB1
$\endgroup$
2
$\begingroup$

It seems if I expand the dot product using tensorexpand then the solution becomes available.

$Assumptions = Element[(AB0|AB1|A0|A1),Vectors[2,Reals]] && Element[(t0|t1),Reals]
P0 = AB0 t0 + A0;
P1 = AB1 t1 + A1;
eq1 = (P0 - P1 ).AB0 == 0;
eq1 = TensorExpand[eq1]
eq2 = (P0 - P1).AB1 == 0;
eq2 = TensorExpand[eq2]
Simplify[Solve[eq1 && eq2, {t0,t1}]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.