Feeding parameters into a multivar function in Mathematica

58 Views Asked by At

I am trying to find an intersection point between a plane and a line. I defined my line as a function of $x,y$ and $z$.

g[x_, y_, z_] := 5 x - 8 y + 2 z - 13

I named it g because I have the same function defined above (with x and y), and I am unsure whether Mathematica supports polymorphism.

I am trying to feed my parametric equations in for $x, y$ and $z$ in order to get the intersection point using this command.

g[x, y, z] /. {x -> 7 - 5 t, y -> 2 - 9 t, z -> -6 - 5 t}

I get this: -13 - 8 (2 - 9 t) + 2 (-6 - 5 t) + 5 (7 - 5 t) which is fine I believe, but when trying to solve for $t$ with

tSol = Solve[g[x, y, z], t]

I get an error saying: $-13+5 x-8 y+2 z$ is not a quantified system of equations and
inequalities

Is there a different way to approach this. I know I can do "math by hand" and just plug that into my Show function but I belive my professor want's us to get to that solution and not hardcode.

Thank you

1

There are 1 best solutions below

0
On

I actually disagree that this question should belong on the Mathematica Stack Exchange, because while it is ostensibly about using Mathematica, the actual error is, conceptually, a mathematical one; hence it should be answered here.

To this end, observe that your expression for the plane, $$g(x,y,z) = 5x - 8y + 2z - 13, \tag{1}$$ does not actually define a plane. It is just an equation that takes a point $(x,y,z)$, and outputs a number. Mathematically, it is a mapping $g : \mathbb R^3 \to \mathbb R$. I could, for instance, write $$g(1,1,1) = 5 - 8 + 2 - 13 = -14.$$ It is only until you specify a level set of $g$ that you will get a plane. That is to say, if $g(x,y,z) = c$ for some constant $c$, then the locus of such points $(x,y,z) \in \mathbb R^3$ will describe a plane. One can infer from the expression $(1)$ that such a choice of $c$ is typically $c = 0$; i.e., your plane is actually defined by the condition $$g(x,y,z) = 5x - 8y + 2z - 13 \color{red}{=} 0. \tag{2}$$ With this in mind, the solution becomes straightforward: the intersection of $g$ with the parametric line $$h : \mathbb R \to \mathbb R^3, \\ h(t) = (7-5t, 2-9t, -6-5t), \tag{3}$$ must satisfy $g(h(t)) = 0$: i.e., $$g(7-5t,2-9t,-6-5t) = -6 + 37t = 0, \tag{4}$$ and the solution readily follows.

The details of implementation in Mathematica would be appropriate for the other Stack Exchange site, but suffice it to say, the correct syntax to use would be

g[{x_, y_, z_}] := 5x - 8y + 2z - 13
h[t_] := {7 - 5t, 2 - 9t, -6 - 5t}
Solve[g[h[t]] == 0, t]