0

So I am trying to symbolically solve a polynomial equation in mathematica that is described with vectors:

A = {Subscript[a, 0], Subscript[a, 1], Subscript[a, 2]}
B = {Subscript[b, 0], Subscript[b, 1], Subscript[b, 2]}
L = {Subscript[P, 0] + Subscript[tD, 0], Subscript[P, 1] + Subscript[tD, 1], Subscript[P, 2] + Subscript[tD, 2]}
K = Cross[(L - A), (L - B)]
Q = B - A
SolveAlways[((K[0]*K[0] + K[1]*K[1] + K[2]*K[2])^2/(Q[0]*Q[0] + Q[1]*Q[1] + Q[2]*Q[2])^2) - r^2, t]

but it cannot symbolically put together the last equation to solve for t. Is there another way for this to be specified for it to solve?

(I am learning mathematica for the first time and my mini project for learning is getting equations for raytracing surfaces, this specifies a cylinder)

asked Aug 25, 2024 at 0:09

1 Answer 1

0

So after learning the syntax deeper this was how I solved fixed the above

cylindA = {ax, ay, az}
cylindB = {bx, by, bz}
rayR = {px + t*dx, py + t*dy, pz + t*dz}
distInt = Cross[(rayR - cylindA), (rayR - cylindB)]
Q = cylindB - cylindA
Solve[((distInt . distInt)/(Q . Q)) - r^2 == 0, t]

(for things like cylindA you would access it like cylindA[[1]] where indexing starts at 1)

answered Aug 25, 2024 at 1:41
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.