开发者

How to define some variables as non-commutative in Maxima

For example, I'd like to define x and y 开发者_运维百科as non-commutative, and a and b as commutative (as usual). In other words,

x y ≠ y x,  a x = x a,  a b = b a .

Further,

(x + a y) (x - a y) = x^2 + a (y x - x y) - a^2 y^2 .

What is a code for defining x and y, and a symbol for multiplication (such as * and . ) ?


You can work with Maxima's commutative * and non-commutative . products in the way that you want by following the next two steps:

  1. Declare the symbols a and b as scalars:

    declare([a, b], scalar)$

  2. Enable dotscrules:

    dotscrules: true$

    This simplifies non-commutative products involving scalars to commutative products (i.e., a.x becomes a*x).

Now you are ready. For example,

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

returns

a*b*y.x - b^2*y^^2 - a*b*x.y + a^2*x^^2

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜