How to define some variables as noncommutative in Maxima

For example, I would like to define x and y as non-commutative, and a and b as commutative (as usual). In other words,

xy ≠ yx, ax = xa, ab = ba . 

Further

(x + ay) (x - ay) = x^2 + a (yx - xy) - a^2 y^2 .

What is the code for determining x and y and the symbol for multiplication (for example, * and . )?

+4
source share
1 answer

You can work with commutative * and non-commutative . Maxima products the way you want by completing the following two steps:

  • Declare characters a and b as scalars:

    declare([a, b], scalar)$

  • Enable dotscrules :

    dotscrules: true$

    This simplifies non-commutative products that include scalars in commutative products (i.e. ax becomes a*x ).

Now you are ready. For instance,

 expand((a*x + b*y) . (a*x - b*y)) 

returns

 a*b*yx - b^2*y^^2 - a*b*xy + a^2*x^^2 

(note that ^^ is a non-commutative exponentiation operator).

+2
source

All Articles