Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Vector algebra

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65517] Re: Vector algebra
  • From: dh <dh at metrohm.ch>
  • Date: Thu, 6 Apr 2006 06:51:59 -0400 (EDT)
  • References: <e0r0nm$pn$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,
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]
SetAttributes[myDot,Orderless]

Daniel

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