MathGroup Archive 2006

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

Search the Archive

Re: Vector algebra

  • To: mathgroup at
  • Subject: [mg65517] Re: Vector algebra
  • From: dh <dh at>
  • Date: Thu, 6 Apr 2006 06:51:59 -0400 (EDT)
  • References: <e0r0nm$pn$>
  • Sender: owner-wri-mathgroup at

You could make a rule for your specific case:
x.a+x.b /. x_ . x1_ + x_ . x2_  -> (x1 + x2).x
note that there must be a space between _ and .
A general rule must account for all possible cases, like:

ru = {x1_ . x_ + x2_ . x_ -> (x1 + x2).x,
       x_ . x1_ + x2_ . x_ -> (x1 + x2).x,
       x_ . x1_ + x_ . x2_  -> (x1 + x2).x,
       x1_ .x_ + x_ . x2_ -> (x1 + x2).x

You could also, instead of using Dot, define an operator with the 
desired property and the attribut "Orderless". This takes care of the 
posible permutations. At the end you would replace this operator by 
"Dot". E.g.:
myDot/: myDot[x1_,x_]+myDot[x2_,x_]:=myDot[x1+x2,x]


Van Gogh wrote:
> Hi,
> I'm trying to factorise this vectorial expression x.a+x.b to give x.(a+b) using mathematica.  I expected the "collect or factor" command to work but it doesn't.Could you please suggest a possible way of carrying out this factorisation.
> many thanks 

  • Prev by Date: Re: Count Function
  • Next by Date: Complex number after NIntegrate
  • Previous by thread: Re: Vector algebra
  • Next by thread: Solving the differential equation