Can matlab (or mupad) evaluate symbolic expressions containing non-commuting operators?

362 views Asked by At

Say I give something like AB+AB+BA to matlab (or mupad), and ask it to simplify it. the answer should be: 2AB+BA. Can this be done in matlab or mupad?

Edit:

Ok, this is feeling rediculous. I'm trying to do this in either matlab or mulab, and.. it's frustrating not knowing how to do what should be the simplest things, and not being able to find the answers right away via google.

I want to expand the following, multiplied together, as a taylor series:

eq1 := exp(g*l*B):
eq2 := exp(l*A):
eq3 := exp((1-g)*l*B):

g is gamma, l is lambda (don't know how to represent either of these in matlab or mulab). A and B don't commute. I want to multiply the three exponentials together, expand, select all terms of a given power in lambda, and simplify the result. Is there a simple way to do this? or should I give up and go to another system, like maple?

1

There are 1 answers

1
Daniel On

This is mupad, not matlab:

operator("x", _vector_product, Binary, 1999):
A x B + A x B + B x A

returns

2 A x B + B x A

The vetor product is used, simply because it matches the described requirements.