Eliminate variable in Maple

674 Views Asked by At

I tried to search, and found some answers that were sort of relevant. However I could not get it to work.

So, I have two equations $x=f(\xi)$ and $z = g(\xi)$, both being affine, thus invertible.

More precisely the equations are $$ x=\frac{1+\varepsilon}{4(2+\varepsilon)}\left(\xi - 1 - \frac{\varepsilon}{2}\right)t^2 + \frac{1}{2+\varepsilon}\xi (t+1) $$ and $$ z=\frac{1+\varepsilon}{2(2+\varepsilon)}\left(\xi - 1 - \frac{\varepsilon}{2}\right)t + \frac{1}{2+\varepsilon}\xi. $$

Maple:

x = (1+varepsilon)*(xi-1-(1/2)*varepsilon)*t^2/(4*(2+varepsilon))+xi*(t+1)/(2+varepsilon)

z = (1+varepsilon)*(xi-1-(1/2)*varepsilon)*t/(2*(2+varepsilon))+xi/(2+varepsilon).

I would like to eliminate $\xi$ and write $z = h(x)$, where $h$ should be as simplified as possible. This should be possible to do in Maple.

3

There are 3 best solutions below

17
On BEST ANSWER

Using straightforward elimination of variables . . . enter image description here

Here's the code in text format . . . restart; eq1:=x=(1+e)/(4*(2+e))*(w-1-e/2)*t^2+(1/(2+e))*(w*(t+1)); eq2:=z=(1+e)/(2*(2+e))*(w-1-e/2)*t+(1/(2+e))*w; solve(eq1,w); subs(w=%,eq2); factor(%);

1
On

I can might as well post the code I ended up using, which add constraints to the variables and stays true to the notation in the first post.

assume(varepsilon > 0, t > 0, xi, 'real', x, 'real', z, 'real'); eqn1 := x = (1+varepsilon)*(xi-1-(1/2)*varepsilon)*t^2/(4*(2+varepsilon))+xi*(t+1)/(2+varepsilon); eqn2 := z = (1+varepsilon)*(xi-1-(1/2)*varepsilon)*t/(2*(2+varepsilon))+xi/(2+varepsilon); solve(eqn1, xi); subs(xi = %, eqn2); factor(%);

0
On

There is a Maple command for this kind of thing, called eliminate.

[edited: I did not initially understand which variables were to be eliminated. So below it now eliminates both z and w.]

I'll follow quasi's Answer by using w for xi, etc.

Using eliminate here does not require coming up (on your own) with a set of solving steps (such as solving cleverly for w, subsituting, etc).

restart;
eq1:=x=(1+e)/(4*(2+e))*(w-1-e/2)*t^2+(1/(2+e))*(w*(t+1)):
eq2:=z=(1+e)/(2*(2+e))*(w-1-e/2)*t+(1/(2+e))*w:

raw:=eliminate({eq1,eq2},{z,w}):

sol:=eval(z,raw[1]);

                2                      2                    
             e t  - 4 e t x + 2 e t + t  - 4 t x + 2 t - 8 x
    sol := - -----------------------------------------------
                           /   2    2          \            
                         2 \e t  + t  + 4 t + 4/     

That result can be simplified, though you have not been precise about what you mean by it being as simplified as "possible".

z=simplify(sol,size);

                     2                                  
           (-e - 1) t  + ((4 x - 2) e + 4 x - 2) t + 8 x
       z = ---------------------------------------------
                                     2                  
                      8 + (2 e + 2) t  + 8 t            

z=collect(numer(sol),e,factor)
  /collect(denom(sol),e,factor);

           -t (t - 4 x + 2) e - (t + 2) (t - 4 x)
       z = --------------------------------------
                         2            2          
                    2 e t  + 2 (t + 2)           

The result from the eliminate command also returns restrictions remaining (implied) on the other variables (parameters). In the code above that would be raw[2], and for this example that is the empty set, which means that solve({eq1,eq1},{z,w}) would produce the same answer since the remaining variables are free.