4
$\begingroup$

I'm solving a system defined by two rays. The rays originate from two points {x,y,z} and {x,y,z-h}. They go in directions (unit vectors) {u1,v1,w1} and {u2,v2,w2}. The rays are connected by a line segment of length l. The endpoints of the line segment are t units down the length of each ray. The variable to solve for is t.

enter image description here

This solution is all well and good, but I notice in the output I have collections of terms like u1^2 ... + v1^2 ... + w1^2. I know that {u1,v1,w1} and {u2,v2,w2} are unit vectors, so these could be substituted with a 1, and maybe even other simplifications could occur. I modified the solve like so:

enter image description here

This looks like a step in the right direction. (I tried Norm[{u1,v1,w1}]==1 but it had no effect.) So, I tried constraining {u2,v2,w2} to a unit vector.

enter image description here

Sadly, it blows up to a size even larger than the first output. Doing this last step manually could be "an exercise left up to me," but I'm curious if there's some way I could approach this that yields better results. I thought maybe there was some way to declare a vector as a unit vector, and came across How can I use a unit vector notation found in physic texts? but I wasn't able to glean anything useful from it. How can I let Mathematica know that a vector is a unit vector so that it can use it as a hint in simplifying output?

$\endgroup$
3
  • 1
    $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, [by clicking the checkmark sign](tinyurl.com/4srwe26 $\endgroup$
    – Dunlop
    Mar 22, 2020 at 5:16
  • 1
    $\begingroup$ Solve by itself does not do everything it can to Simplify a result. That makes Solve faster and you can use Simplify only if need be. This FullSimplify[(-h(2w1-2w2)-Sqrt[h^2(2w1-2w2)^2-4(h^2-l^2)(u1^2-2u1*u2+u2^2+v1^2-2v1*v2+v2^2+w1^2-2w1*w2+w2^2)])/(2(u1^2-2u1*u2+u2^2+v1^2-2v1*v2+v2^2+w1^2-2w1*w2+w2^2)), Norm[{u1,v1,w1}]==1&& Norm[{u2,v2,w2}]==1] gives a substantially smaller result, but only because I have included the second argument to FullSimplify telling it about two of your assumptions, otherwise Mathematica would never know. With more assumptions an even smaller result? $\endgroup$
    – Bill
    Mar 22, 2020 at 5:33
  • $\begingroup$ Try doing this Replace[Solve[{EuclideanDistance[r1, r2] == l}, t], {u1^2 -> 1 - v1^2 - w1^2, u2^2 -> 1 - v2^2 - w2^2}, {6, 10}] // Simplify . The idea is that you replace the solution at different "levels" inside the equation. To understand this more check out the help for Replace[] $\endgroup$
    – Dunlop
    Mar 22, 2020 at 5:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.