Re: smart change of variables?

*To*: mathgroup at smc.vnet.net*Subject*: [mg87716] Re: smart change of variables?*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>*Date*: Wed, 16 Apr 2008 05:01:41 -0400 (EDT)*Organization*: The Open University, Milton Keynes, UK*References*: <fu21bk$rb6$1@smc.vnet.net>

Barrow wrote: > Dear all, > > I have a arithmetic problem. > I have an expression expr = (p1 + 2*p2)*(k1 + 2*k2) > where p1 + p2 = k1 + k2 > I wanna make the following change of variables, > s = (p1 + p2)^2 > t = (p1 - k1)^2 > u = (p1 - k2)^2 > > Is it possible to tell Mathematica to express expr > in terms of s, t, and u automatically? > > Thanks so much. > any ideas would be appreciated. > Sincerely Barrow > Barrow, You could use Eliminate[] and Reduce[] as in the following (note that you have two answers for the final expression since quadratics are involved) In[40]:= Eliminate[ f == (p1 + 2*p2)*(k1 + 2*k2) && p1 + p2 == k1 + k2 && s == (p1 + p2)^2 && t == (p1 - k1)^2 && u == (p1 - k2)^2, {p1, p2, k1, k2}] Out[40]= -81 s^2 + 18 s t - t^2 + 18 s u + 2 t u - u^2 == 16 f^2 + f (-72 s + 8 t - 8 u) In[41]:= Reduce[%, f] Out[41]= f == 1/4 (9 s - t - 6 Sqrt[s] Sqrt[u] + u) || f == 1/4 (9 s - t + 6 Sqrt[s] Sqrt[u] + u) Regards, -- Jean-Marc