How to use Maple to eliminate parameters in surface vector equation to obtain equation in Cartesian coordinates?

88 Views Asked by At

Consider the surface given by the vector equation

$$\vec{r}(u,v)=(x_0+a_1 u+b_1v)\hat{i}+(x_0+a_2u+b_2v)\hat{j}+(z_0+a_3u+b_3v)\hat{k}\tag{1}$$

and the task of eliminating parameters $u$ and $v$ to obtain a Cartesian equation.

I think one way is to simply try to make substitutions.

This is what I tried in Maple

x := (u, v) -> x__0 + a__1*u + b__1*v
y := (u, v) -> y__0 + a__2*u + b__2*v
z := (u, v) -> z__0 + a__3*u + b__3*v
r := (u, v) -> <x(u, v), y(u, v), z(u, v)>

# Solve for u
solve(x(u, v) = x, u)

# Copy previous output and sub into equation for y(u,v), solve for v
solve(eval(y(u, v) = y, u = -(b__1*v - x + x__0)/a__1), v)

# Copy previous output and sub into previously found u
simplify(eval(-(b__1*v - x + x__0)/a__1, v = (a__1*y - a__1*y__0 - a__2*x + a__2*x__0)/(a__1*b__2 - a__2*b__1)))

# Sub in previous results for u and v into z(u,v)
simplify(eval(z(u, v) = z, {u = ((-y + y__0)*b__1 + b__2*(x - x__0))/(a__1*b__2 - a__2*b__1), v = (a__1*y - a__1*y__0 - a__2*x + a__2*x__0)/(a__1*b__2 - a__2*b__1)}))

The result of this isn't a pretty looking expression.

enter image description here

What I would like to do is have Maple simplify this expression by collecting terms that multiple $x-x_0$, $y-y_0$, and $z-z_0$. How do I do this?

Doing this with pen and paper gives the correct result, which is

$$(a_2b_3-a_3b_2)(x-x_0)+(a_3b_1-a_1b_3)(y-y_0)+(a_1b_2-a_2b_1)(z-z_0)=0$$

Is there a better way to solve this problem in Maple?

Is there a better way to solve the problem in general?

2

There are 2 best solutions below

1
On

Since we are talking about polynomials:

polys = {x0 + a1 u + b1 v - x, y0 + a2 u + b2 v - y, z0 + a3 u + b3 v - z};

the general idea is to determine a Gröbner basis of the type:

gb = GroebnerBasis[polys, {v, u, z, y, x}]

{-a3 b2 x + a2 b3 x + a3 b2 x0 - a2 b3 x0 + a3 b1 y - a1 b3 y - a3 b1 y0 + a1 b3 y0 - a2 b1 z + a1 b2 z + a2 b1 z0 - a1 b2 z0, -a3 b2 u + a2 b3 u - b3 y + b3 y0 + b2 z - b2 z0, -a3 b1 u + a1 b3 u - b3 x + b3 x0 + b1 z - b1 z0, -a2 b1 u + a1 b2 u - b2 x + b2 x0 + b1 y - b1 y0, a3 u + b3 v - z + z0, a2 u + b2 v - y + y0, a1 u + b1 v - x + x0}

where the first polynomial of this basis is the desired one:

FullSimplify[First[gb]]

a3 b2 (x - x0) + a2 b3 (-x + x0) + a1 b3 (y - y0) + a3 b1 (-y + y0) + a2 b1 (z - z0) + a1 b2 (-z + z0)

If then, as happens in Mathematica, there's a dedicated command, even better:

Eliminate[polys == {0, 0, 0}, {u, v}]

a3 b2 x0 - a2 b3 x0 + a3 b1 y - a1 b3 y - a3 b1 y0 + a1 b3 y0 -
a2 b1 z + a1 b2 z + a2 b1 z0 - a1 b2 z0 == (a3 b2 - a2 b3) x

It's up to you to consult the Maple documentation for similar functions.

0
On

Here are your equations,

x := (u, v) -> x__0 + a__1*u + b__1*v:
y := (u, v) -> y__0 + a__2*u + b__2*v:
z := (u, v) -> z__0 + a__3*u + b__3*v:

eqs := [x(u,v)-x, y(u,v)-y, z(u,v)-z];

     eqs := [a__1 u + b__1 v - x + x__0,
             a__2 u + b__2 v - y + y__0, 
             a__3 u + b__3 v - z + z__0]

The steps you showed above can be done together as,

H := eliminate(eqs, [u,v])[2];

    H := {a__1 b__2 z - a__1 b__2 z__0 - a__1 b__3 y + a__1 b__3 y__0
          - a__2 b__1 z + a__2 b__1 z__0 + a__2 b__3 x - a__2 b__3 x__0
          + a__3 b__1 y - a__3 b__1 y__0 - a__3 b__2 x + a__3 b__2 x__0}

And now you asked about collecting w.r.t. x-x__0, y-y__0, and z-z__0.

We can use the following equations for temporary substitutions. The second list is just the reverse of the first. I assign them to names just for convenience (and so that you can see them here).

S := Equate([x-x__0,y-y__0,z-z__0], [X,Y,Z]);

    S := [x - x__0 = X, y - y__0 = Y, z - z__0 = Z]

rS := (rhs=lhs)~(S); # reversed

    rS := [X = x - x__0, Y = y - y__0, Z = z - z__0]

And now we can collect w.r.t. to those new names X,Y,Z, simplifying the coefficients (though not necesary here), and then resubstitute back to the original names (terms).

sol := eval(collect(simplify(H, S), [X,Y,Z], simplify), rS);

    sol := {(a__2 b__3 - a__3 b__2) (x - x__0)
          + (-a__1 b__3 + a__3 b__1) (y - y__0)
          + (a__1 b__2 - a__2 b__1) (z - z__0)}

If it helps your understanding, that could be done in steps,

temp := simplify(H, S);

    temp := {(a__1 b__2 - a__2 b__1) Z + X a__2 b__3
       + (-X b__2 + Y b__1) a__3 - Y a__1 b__3}

temp2 := collect(temp, [X,Y,Z], simplify);

    temp2 := {(a__2 b__3 - a__3 b__2) X
              + (-a__1 b__3 + a__3 b__1) Y
              + (a__1 b__2 - a__2 b__1) Z}

eval(temp2, rS);

        {(a__2 b__3 - a__3 b__2) (x - x__0)
          + (-a__1 b__3 + a__3 b__1) (y - y__0)
          + (a__1 b__2 - a__2 b__1) (z - z__0)}

There is a possibility that some of your terms might be ordered different from your target, eg, -z__0+z instead of desired z-z__0. In such a case you could force them to appear in your desired form by,

sort(sol, order=plex(x,y,z));