# how define a system of equations

GROUPS:
 Hello,I am a begin mathematica user.I will try to find the intersection formula between a 3d sphere against 3d line.I know the center of the sphere a 3d point (Cx,Cy,Cz) and the ray R.The 3d line is defined how: P+D*t where the P is the line start point, D is the line direction and t is the time where intersection happen.if intersection exist I should try the scalar value t.I am trying to solve the equation system in mathematica but I get empty solution. Someone can help me to fix the system?Thanks in advance. Solve[(((x - Subscript[c, x])^2 + (y - Subscript[c, y])^2 + (z -           Subscript[c, z])^2) - r^2 == 0) && (x == Subscript[t, x]*Subscript[d, x] + Subscript[p, x]) &&  y == Subscript[t, y]*Subscript[d, y] + Subscript[p, y] && z == Subscript[t, z] + Subscript[d, z] + Subscript[p,z], {Subscript[t, x], Subscript[t, y], Subscript[t, z]}]
4 years ago
4 Replies
 Here you go:sphere = (x - xc)^2 + (y - yc)^2 + (z - zc)^2 ==  radiusSquaredline = y == y0 + t (y1 - y0) && x == x0 + t (x1 - x0) &&   z == z0 + t (z1 - z0)solutions = Simplify[Solve[sphere && line, {x, y, z, t}]]; (* long expression, perhaps could be simpler with assumption of real parameters*)Length[solutions] (* two solutions---makes sense*)HTH, Craig