MathGroup Archive 2010

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

Search the Archive

Stop mathematica reordering expression during matrix multiply

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109382] Stop mathematica reordering expression during matrix multiply
  • From: Robert Wright <mathematicauser1 at yahoo.com>
  • Date: Sat, 24 Apr 2010 04:02:12 -0400 (EDT)

I am using a Graph Theory algorithm which requires that I multiply an edge-weighted adjacency matrix with symbolic parts. In my problem, the order of the symbols corresponds to the edges that make up a path - for example, x2 x1 x7 would indicate that the path progresses from x2 to x1 then x7. The snag comes when Mathematica reorders the symbols in each expression appearing in the matrix result from multiplying Ci x Cj - is there a way of stopping this from happening? 

Here is some code that illustrates the problem:

C1 = {{0, x1, 0, 0}, {x2, 0, x3, 0}, {x4, 0, 0, x5}, {x6, 0, x7, 0}}; 
C2 = C1.C1;
MatrixForm@C2

The MatrixForm output shows how Mathematica has sequenced the symbols in 'ascending' order. In my case, I want to preserve the order of the symbols in the calculated expression: so, for example, row 4 of C1 times column 2 of C1 should give x4 x1 and not x1 x4. How do I stop Mathematicafrom reordering the resulting expression? 


  • Prev by Date: EquationTrekker for system of two 1st order ODEs
  • Next by Date: Re: Speed Up Routines
  • Previous by thread: EquationTrekker for system of two 1st order ODEs
  • Next by thread: Re: Stop mathematica reordering expression during matrix multiply