Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: simplifying operator experessions with Dot, Times and Plus

  • To: mathgroup at
  • Subject: [mg35519] Re: [mg35481] simplifying operator experessions with Dot, Times and Plus
  • From: Andrzej Kozlowski <andrzej at>
  • Date: Wed, 17 Jul 2002 02:09:14 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

The reason why Dot won't work is that it is meant operate on explicit 
vectors, which in Mathematica means lists, like


a x+b y+c z

and not on symbols that stand for vectors, as in your case. It would not 
be a good idea to try to modify Dot to behave differently in case you 
then tried using it on list and started getting strange results. A 
better approach is to define your own dot product:

SetAttributes[dot, {Flat, OneIdentity}]

dot[x_ + y_, w_] := dot[x, w] + dot[y, w];
dot[w_, x_ + y_] := dot[w, x] + dot[w, y];
dot[x_, 0] = 0;
dot[0, x_] = 0;
dot[(a_)?NumericQ*x_, y_] := a*dot[x, y];
dot[x_, (b_)?NumericQ*y_] = b*dot[x, y];

Next you can temporarily replace Dot by dot, for example:

Block[{Dot = dot}, -ex[0, 1] . (ex[0, 1] . ex[1, 2] -
       ex[1, 2] . ex[0, 1])] /. dot -> Dot

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

Andrzej Kozlowski
Toyama International University

On Tuesday, July 16, 2002, at 04:49  AM, JL wrote:

> 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

  • Prev by Date: RE: help in generating a gaussian random variable
  • Next by Date: RE: simplifying operator experessions with Dot, Times a nd Plus
  • Previous by thread: simplifying operator experessions with Dot, Times and Plus
  • Next by thread: MathLink and Serial Ports