MathGroup Archive 2002

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

Search the Archive

RE: Expanding expressions with Dot, Times and Plus

  • To: mathgroup at smc.vnet.net
  • Subject: [mg35524] RE: [mg35501] Expanding expressions with Dot, Times and Plus
  • From: "DrBob" <majort at cox-internet.com>
  • Date: Wed, 17 Jul 2002 02:09:26 -0400 (EDT)
  • Reply-to: <drbob at bigfoot.com>
  • Sender: owner-wri-mathgroup at wolfram.com

See if this does (part of) what you want:

expr = -ex[0, 1].(ex[0, 1].ex[1, 2] - ex[1, 2].ex[0, 1]);
ClearAll[h]
Attributes[h] = {Flat};
rules = {Dot -> h, h[a_, b_ - c_] -> h[a, b] - 
h[a, c], h[a_, b_ + c_] -> h[a, b] + h[a, c]};
expr //. rules /. h -> Dot

-ex[0, 1].ex[0, 1].ex[1, 2] + ex[0, 1].ex[1, 2].ex[0, 1]

Bobby Treat

-----Original Message-----
From: JL [mailto:jl at aol.com] 
To: mathgroup at smc.vnet.net
Subject: [mg35524] [mg35501] Expanding expressions with Dot, Times and Plus

I am trying to expand a large expression that has terms that look as

follows:

-ex[0,1].(ex[0,1].ex[1,2]-ex[1,2].ex[0,1])

where ex[i,j] are unevaluated expressions. I would like Mathematica to
simplify this and analogous expressions so that they read:

ex[0,1].ex[1,2].ex[0,1]-ex[0,1].ex[0,1].ex[1,2]

However, I cannot seem to find anything that will work. The problem is
that
I need to keep track of the order of the expressions ex[i,j]. If Dot
were
replaced by Times, there would be no problem whatsoever.

If anyone knows how to help me with this problem, I would greatly
appreciate
it.

Thanks,

Jeremy Levy

jlevy at pitt.edu








  • Prev by Date: Re: help in generating a gaussian random variable
  • Next by Date: Re: Factoring problem
  • Previous by thread: Expanding expressions with Dot, Times and Plus
  • Next by thread: RE: Expanding expressions with Dot, Times and Plus