MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: how to express one expression in terms of other expressions symbolically?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45774] Re: [mg45747] how to express one expression in terms of other expressions symbolically?
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Sat, 24 Jan 2004 03:29:00 -0500 (EST)
  • References: <200401230815.DAA27680@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

walala wrote:
> 
> Dear all,
> 
> I want to ask how to express the following terms into the form of (x1+x8),
> (x1-x8), (x2+x7), (x2-x7), etc. This is variable substitution. How can do
> this manipulation in mathematica symbolically?
> 
> [ a01*x1+a02*x2+a03*x3+a04*x4+a04*x5+a03*x6+a02*x7+a01*x8]
> [ a05*x1+a06*x2+a07*x3+a08*x4-a08*x5-a07*x6-a06*x7-a05*x8]
> [ a09*x1+a10*x2-a11*x3-a12*x4-a12*x5-a11*x6+a10*x7+a09*x8]
> [ a13*x1-a14*x2-a15*x3-a16*x4+a16*x5+a15*x6+a14*x7-a13*x8]
> [ a17*x1-a18*x2-a19*x3+a20*x4+a20*x5-a19*x6-a18*x7+a17*x8]
> [ a21*x1-a22*x2+a23*x3+a24*x4-a24*x5-a23*x6+a22*x7-a21*x8]
> [ a25*x1-a26*x2+a27*x3-a28*x4-a28*x5+a27*x6-a26*x7+a25*x8]
> [ a29*x1-a30*x2+a31*x3-a32*x4+a32*x5-a31*x6+a30*x7-a29*x8]
> 
> Thank you!
> 
> -Walala

If you put this into the langauge of algebraic replacement it is not
hard (of course it also helps to use correct Mathematica notation...).

Start with:

terms = {
  a01*x1+a02*x2+a03*x3+a04*x4+a04*x5+a03*x6+a02*x7+a01*x8,
  a05*x1+a06*x2+a07*x3+a08*x4-a08*x5-a07*x6-a06*x7-a05*x8,
  a09*x1+a10*x2-a11*x3-a12*x4-a12*x5-a11*x6+a10*x7+a09*x8,
  a13*x1-a14*x2-a15*x3-a16*x4+a16*x5+a15*x6+a14*x7-a13*x8,
  a17*x1-a18*x2-a19*x3+a20*x4+a20*x5-a19*x6-a18*x7+a17*x8,
  a21*x1-a22*x2+a23*x3+a24*x4-a24*x5-a23*x6+a22*x7-a21*x8,
  a25*x1-a26*x2+a27*x3-a28*x4-a28*x5+a27*x6-a26*x7+a25*x8,
  a29*x1-a30*x2+a31*x3-a32*x4+a32*x5-a31*x6+a30*x7-a29*x8};
vars = {x1,x2,x3,x4,x5,x6,x7,x8};

Now set up the subexpressions you wish to "isolate", and define a new
variable for each.

exprs = {(x1+x8), (x1-x8), (x2+x7), (x2-x7), (x3+x6),
  (x3-x6), (x4+x5), (x4-x5)};
newvars = Array[t, Length[exprs]];

Here is where computational algebra is used. We set up a Groebner basis
for the differences between new variables and substitution expressions,
with the new variables ordered last (there are other ways, but this
suffices for our purposes.

basis = GroebnerBasis[Thread[newvars-exprs], Join[vars,newvars]];

Now reduce the polynomials with respect to this basis, keeping only the
reduced expressions and not the vectors of polynomial multipliers. This
will give polynomials in terms of the new variables. Then reverse the
substitutions to get these in terms of the expressions of interest.

InputForm[Map[Last,PolynomialReduce[terms, basis, Join[vars,newvars]]]
/.
  Thread[newvars->exprs]]

Out[20]//InputForm= 
{a04*(x4 + x5) + a03*(x3 + x6) + a02*(x2 + x7) + a01*(x1 + x8), 
 a08*(x4 - x5) + a07*(x3 - x6) + a06*(x2 - x7) + a05*(x1 - x8), 
 -(a12*(x4 + x5)) - a11*(x3 + x6) + a10*(x2 + x7) + a09*(x1 + x8), 
 -(a16*(x4 - x5)) - a15*(x3 - x6) - a14*(x2 - x7) + a13*(x1 - x8), 
 a20*(x4 + x5) - a19*(x3 + x6) - a18*(x2 + x7) + a17*(x1 + x8), 
 a24*(x4 - x5) + a23*(x3 - x6) - a22*(x2 - x7) + a21*(x1 - x8), 
 -(a28*(x4 + x5)) + a27*(x3 + x6) - a26*(x2 + x7) + a25*(x1 + x8), 
 -(a32*(x4 - x5)) + a31*(x3 - x6) - a30*(x2 - x7) + a29*(x1 - x8)}

Given that the original expressions are linear in the variables of
interest, it is also not too hard to do this entirely with pattern
matching and replacement rules.


Daniel Lichtblau
Wolfram Research


  • Prev by Date: Re: printing all notebooks
  • Next by Date: RE: Re: copying
  • Previous by thread: Re: how to express one expression in terms of other expressions symbolically?
  • Next by thread: Re: how to express one expression in terms of other expressions symbolically?