MathGroup Archive 2002

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

Search the Archive

Re: Expanding expressions with Dot, Times and Plus

  • To: mathgroup at
  • Subject: [mg35540] Re: [mg35501] Expanding expressions with Dot, Times and Plus
  • From: Rolf Mertig <rolf at>
  • Date: Thu, 18 Jul 2002 03:06:38 -0400 (EDT)
  • Organization: Mertig Consulting
  • Sender: owner-wri-mathgroup at

it is not hard to program such a function. Several packages exist.
One possibility is to use my old DotSimplify function from the OpenSource
FeynCalc Mathematica Application package.

I always wondered why such and other rather trivial to implement functionality 
has never been added to the Mathematica kernel. Maybe WRI is too busy 
with other important projects.

In[1]:= <<HighEnergyPhysics`fc`

In[2]:= FI;   DeclareNonCommutative[ex];

In[3]:= DotSimplify[ -ex[0,1].(ex[0,1].ex[1,2]-ex[1,2].ex[0,1]) ]

Out[3]= -ex[0, 1]^2 . ex[1, 2] + ex[0, 1] . ex[1, 2] . ex[0, 1]

In[4]:= ?DotSimplify
DotSimplify[expr] expands and reorders noncommutative terms in expr.
   Simplifying relations may be specified by the option DotSimplifyRelations
   or by Commutator and AntiCommutator definitions. Whether expr is expanded
   noncommutatively depends on the option Expanding.

In[5]:= Options@DotSimplify

Out[5]= {Expanding -> True, DotSimplifyRelations -> {}, DotPower -> True}


Rolf Mertig
Mertig Consulting,
Efficient Software, Training, Programming, Consulting

>I am trying to expand a large expression that has terms that look as
>where ex[i,j] are unevaluated expressions. I would like Mathematica to
>simplify this and analogous expressions so that they read:
>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
>Jeremy Levy
>jlevy at

  • Prev by Date: Re: Re: Factoring problem
  • Next by Date: RE: Output of left-hand side of expression
  • Previous by thread: RE: Expanding expressions with Dot, Times and Plus
  • Next by thread: simplifying operator experessions with Dot, Times and Plus