1

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.

blybb
  • 25

3 Answers3

1

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(%);

quasi
  • 58,772
  • Thanks for your reply. Are you sure you've read the equations correctly? $\varepsilon$ is just a constant, and not the same as $\xi$. It seems that you have used $e$ for both. Other than that, could you explain what you are doing? – blybb Jun 17 '17 at 19:54
  • No, I didn't see that. I'll try to fix it. – quasi Jun 17 '17 at 20:03
  • Fixed now, I think: Note: I'm using $w$ instead of $\xi$, and $e$ instead of $\varepsilon$. – quasi Jun 17 '17 at 20:21
  • Thank you, that's something along the lines of what I'm trying to do. Could you paste the code as text? I've tried to write it down, but solve throws an error. And what does % mean? – blybb Jun 17 '17 at 20:32
  • % is the previous result – quasi Jun 17 '17 at 20:33
  • Your approach seems to be the best solution, however solve still complains, even though I'm pasting your code line by line. I was under the delusion that Maple could make my life a little easier, but every time I try do do even the simplest thing it's an absolute nightmare. – blybb Jun 17 '17 at 20:47
  • Can you paste an image of your maple session? – quasi Jun 17 '17 at 20:53
  • I'm using the classic window version of maple. – quasi Jun 17 '17 at 20:54
  • The command-line version should also work. – quasi Jun 17 '17 at 20:55
  • Maple is worth learning -- it really will make your life easier, once you learn how to work around the places where Maple doesn't automatically do what you want. – quasi Jun 17 '17 at 20:57
  • The site is encouraging me to move this discussion to chat, but I am not allowed. Are you able to do it? I really need to get to bed now, so cannot try anything until tomorrow. I did accept your answer though. Thank you very much! – blybb Jun 17 '17 at 21:05
  • I'll be busy this time tomorrow. – quasi Jun 17 '17 at 21:07
  • Did you see my comment about the missing * symbol? – quasi Jun 17 '17 at 21:08
  • My pasted text is missing some * symbols also. I'll try to fix it. – quasi Jun 17 '17 at 21:10
  • Try it now. Just make sure all multiplications are explicit (i.e., using the * symbol). Maple doesn't have implied multiplication. – quasi Jun 17 '17 at 21:15
  • Now it works like charm! – blybb Jun 17 '17 at 21:18
  • @quasi Please join us here http://area51.stackexchange.com/proposals/107315/maple – zhk Jun 23 '17 at 12:48
1

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.

acer
  • 5,293
0

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(%);

blybb
  • 25