Factor - Maple Help

Physics[Factor] - factor expressions involving noncommutative variables

 Calling Sequence Factor(expr)

Parameters

 expr - any algebraic expression, possibly involving noncommutative variables

Description

 • The Factor command generalizes the standard factor command in that it can factorize expressions involving noncommutative variables. Factor complements the set of Physics commands for handling expressions with noncommutative operands, *, ., ^, diff, Expand, Normal, Simplify, Gtaylor, and Coefficients.
 • The approach used is similar to the one used in the other commands of this kind, (see for instance the experimental Physics command, PerformOnAnticommutativeSystem), that is, to transform the problem into one that can be treated with the commands that work only with commutative variables, and from there extract the result for expressions involving noncommutative variables. This approach has limitations (see the Examples) but the class of problems that can be handled is well defined and the cases covered are relevant.
 Note: For the conventions adopted to represent noncommutative and anticommutative objects, see Setup and the types anticommutative and noncommutative.

Examples

 > $\mathrm{with}\left(\mathrm{Physics}\right):$

Set some quantum operators for developing examples

 > $\mathrm{Setup}\left(\mathrm{quantumoperators}=\left\{a,b,c,d,e\right\},\mathrm{mathematicalnotation}=\mathrm{true}\right)$
 $\left[{\mathrm{mathematicalnotation}}{=}{\mathrm{true}}{,}{\mathrm{quantumoperators}}{=}\left\{{a}{,}{b}{,}{c}{,}{d}{,}{e}\right\}\right]$ (1)

First example, because of using mathematical notation, noncommutative variables are displayed in different color (olive)

 > ${\mathrm{\alpha }}^{2}{a}^{2}+\mathrm{\alpha }\mathrm{sqrt}\left(2\right)ab+4\mathrm{sqrt}\left(2\right)\mathrm{\lambda }{b}^{2}c+4\mathrm{\lambda }\mathrm{\alpha }bca+4\mathrm{\lambda }\mathrm{sqrt}\left(2\right)bcb+16{\mathrm{\lambda }}^{2}{\left(bc\right)}^{2}+4\mathrm{\alpha }\mathrm{\lambda }abc+\mathrm{sqrt}\left(2\right)\mathrm{\alpha }ba+2{b}^{2}$
 ${{\mathrm{\alpha }}}^{{2}}{}{{a}}^{{2}}{+}\sqrt{{2}}{}{\mathrm{\alpha }}{}{a}{}{b}{+}{4}{}\sqrt{{2}}{}{\mathrm{\lambda }}{}{{b}}^{{2}}{}{c}{+}{4}{}{\mathrm{\lambda }}{}{\mathrm{\alpha }}{}{b}{}{c}{}{a}{+}{4}{}\sqrt{{2}}{}{\mathrm{\lambda }}{}{b}{}{c}{}{b}{+}{16}{}{{\mathrm{\lambda }}}^{{2}}{}{\left({b}{}{c}\right)}^{{2}}{+}{4}{}{\mathrm{\alpha }}{}{\mathrm{\lambda }}{}{a}{}{b}{}{c}{+}\sqrt{{2}}{}{\mathrm{\alpha }}{}{b}{}{a}{+}{2}{}{{b}}^{{2}}$ (2)
 > $\mathrm{Factor}\left(\right)$
 ${\left({4}{}{\mathrm{\lambda }}{}{b}{}{c}{+}{\mathrm{\alpha }}{}{a}{+}\sqrt{{2}}{}{b}\right)}^{{2}}$ (3)

A more involved example from a physics problem, illustrating that the factorization is also happening within function's arguments, as well as that we can also correctly expand mathematical expressions involving noncommutative variables

 > $\mathrm{PDEtools}:-\mathrm{declare}\left(\left(a,b,c,g\right)\left(x,y\right)\right)$
 ${a}{}\left({x}{,}{y}\right){}{\mathrm{will now be displayed as}}{}{a}$
 ${b}{}\left({x}{,}{y}\right){}{\mathrm{will now be displayed as}}{}{b}$
 ${c}{}\left({x}{,}{y}\right){}{\mathrm{will now be displayed as}}{}{c}$
 ${g}{}\left({x}{,}{y}\right){}{\mathrm{will now be displayed as}}{}{g}$ (4)
 > $\mathrm{Intc}\left({\left(4\mathrm{Dagger}\left(b\left(x,y\right)\right)c\left(x,y\right)\mathrm{\lambda }+\mathrm{\alpha }f\left(t\right)a\left(x,y\right)\mathrm{Dagger}\left(a\left(x,y\right)\right)+\mathrm{sqrt}\left(2\right)g\left(x,y\right)b\left(x,y\right)\right)}^{2},x,y\right)$
 ${\mathrm{Int}}{}\left({\mathrm{Int}}{}\left({\mathrm{^}}{}\left({4}{}{\mathrm{λ}}{}{\mathrm{*}}{}\left({\mathrm{Dagger}}{}\left({b}{}\left({x}{,}{y}\right)\right){,}{c}{}\left({x}{,}{y}\right)\right){+}{\mathrm{α}}{}{f}{}\left({t}\right){}{\mathrm{*}}{}\left({a}{}\left({x}{,}{y}\right){,}{\mathrm{Dagger}}{}\left({a}{}\left({x}{,}{y}\right)\right)\right){+}\sqrt{{2}}{}{g}{}\left({x}{,}{y}\right){}{b}{}\left({x}{,}{y}\right){,}{2}\right){,}{x}{=}{-}{\mathrm{∞}}{..}{\mathrm{∞}}\right){,}{y}{=}{-}{\mathrm{∞}}{..}{\mathrm{∞}}\right)$ (5)

First expand to construct the problem

 > $\mathrm{expand}\left(\right)$
 ${\mathrm{Int}}{}\left({\mathrm{Int}}{}\left({16}{}{{\mathrm{λ}}}^{{2}}{}{\mathrm{*}}{}\left({\mathrm{Dagger}}{}\left({b}{}\left({x}{,}{y}\right)\right){,}{c}{}\left({x}{,}{y}\right){,}{\mathrm{Dagger}}{}\left({b}{}\left({x}{,}{y}\right)\right){,}{c}{}\left({x}{,}{y}\right)\right){+}{4}{}{\mathrm{λ}}{}{\mathrm{α}}{}{f}{}\left({t}\right){}{\mathrm{*}}{}\left({\mathrm{Dagger}}{}\left({b}{}\left({x}{,}{y}\right)\right){,}{c}{}\left({x}{,}{y}\right){,}{a}{}\left({x}{,}{y}\right){,}{\mathrm{Dagger}}{}\left({a}{}\left({x}{,}{y}\right)\right)\right){+}{4}{}\sqrt{{2}}{}{\mathrm{λ}}{}{g}{}\left({x}{,}{y}\right){}{\mathrm{*}}{}\left({\mathrm{Dagger}}{}\left({b}{}\left({x}{,}{y}\right)\right){,}{c}{}\left({x}{,}{y}\right){,}{b}{}\left({x}{,}{y}\right)\right){+}{4}{}{\mathrm{α}}{}{f}{}\left({t}\right){}{\mathrm{λ}}{}{\mathrm{*}}{}\left({a}{}\left({x}{,}{y}\right){,}{\mathrm{Dagger}}{}\left({a}{}\left({x}{,}{y}\right)\right){,}{\mathrm{Dagger}}{}\left({b}{}\left({x}{,}{y}\right)\right){,}{c}{}\left({x}{,}{y}\right)\right){+}{{\mathrm{α}}}^{{2}}{}{{f}{}\left({t}\right)}^{{2}}{}{\mathrm{*}}{}\left({a}{}\left({x}{,}{y}\right){,}{\mathrm{Dagger}}{}\left({a}{}\left({x}{,}{y}\right)\right){,}{a}{}\left({x}{,}{y}\right){,}{\mathrm{Dagger}}{}\left({a}{}\left({x}{,}{y}\right)\right)\right){+}\sqrt{{2}}{}{\mathrm{α}}{}{f}{}\left({t}\right){}{g}{}\left({x}{,}{y}\right){}{\mathrm{*}}{}\left({a}{}\left({x}{,}{y}\right){,}{\mathrm{Dagger}}{}\left({a}{}\left({x}{,}{y}\right)\right){,}{b}{}\left({x}{,}{y}\right)\right){+}{4}{}\sqrt{{2}}{}{g}{}\left({x}{,}{y}\right){}{\mathrm{λ}}{}{\mathrm{*}}{}\left({b}{}\left({x}{,}{y}\right){,}{\mathrm{Dagger}}{}\left({b}{}\left({x}{,}{y}\right)\right){,}{c}{}\left({x}{,}{y}\right)\right){+}\sqrt{{2}}{}{g}{}\left({x}{,}{y}\right){}{\mathrm{α}}{}{f}{}\left({t}\right){}{\mathrm{*}}{}\left({b}{}\left({x}{,}{y}\right){,}{a}{}\left({x}{,}{y}\right){,}{\mathrm{Dagger}}{}\left({a}{}\left({x}{,}{y}\right)\right)\right){+}{2}{}{{g}{}\left({x}{,}{y}\right)}^{{2}}{}{\mathrm{^}}{}\left({b}{}\left({x}{,}{y}\right){,}{2}\right){,}{x}{=}{-}{\mathrm{∞}}{..}{\mathrm{∞}}\right){,}{y}{=}{-}{\mathrm{∞}}{..}{\mathrm{∞}}\right)$ (6)

Now retrieve the original expression

 > $\mathrm{Factor}\left(\right)$
 ${\mathrm{Int}}{}\left({\mathrm{Int}}{}\left({\mathrm{^}}{}\left({4}{}{\mathrm{λ}}{}{\mathrm{*}}{}\left({\mathrm{Dagger}}{}\left({b}{}\left({x}{,}{y}\right)\right){,}{c}{}\left({x}{,}{y}\right)\right){+}{\mathrm{α}}{}{f}{}\left({t}\right){}{\mathrm{*}}{}\left({a}{}\left({x}{,}{y}\right){,}{\mathrm{Dagger}}{}\left({a}{}\left({x}{,}{y}\right)\right)\right){+}\sqrt{{2}}{}{g}{}\left({x}{,}{y}\right){}{b}{}\left({x}{,}{y}\right){,}{2}\right){,}{x}{=}{-}{\mathrm{∞}}{..}{\mathrm{∞}}\right){,}{y}{=}{-}{\mathrm{∞}}{..}{\mathrm{∞}}\right)$ (7)

This following one looks simpler but it is actually more complicated:

 > $\mathrm{Commutator}\left(a,b\right)c$
 ${\mathrm{*}}{}\left({\mathrm{Commutator}}{}\left({a}{,}{b}\right){,}{c}\right)$ (8)

First expand

 > $\mathrm{expand}\left(\right)$
 ${a}{}{b}{}{c}{-}{b}{}{a}{}{c}$ (9)

The complication consists of the fact that the standard factor command, which assumes products are commutative, can never deal with an expression like $\mathrm{Commutator}\left(a,b\right)=\mathrm{a b}-\mathrm{b a}$ because if products were commutative the sum of these terms is equal to 0. Through algebraic manipulations, however, the expression is also factorable

 > $\mathrm{Factor}\left(\right)$
 $\left({a}{}{b}{-}{b}{}{a}\right){}{c}$ (10)

This other one is yet more complicated:

 > $\left(ab-ba\right)\left(a+\mathrm{\beta }b+{c}^{2}\right)$
 $\left({a}{}{b}{-}{b}{}{a}\right){}\left({\mathrm{\beta }}{}{b}{+}{{c}}^{{2}}{+}{a}\right)$ (11)

When you expand,

 > $\mathrm{expand}\left(\right)$
 ${a}{}{b}{}{a}{+}{\mathrm{\beta }}{}{a}{}{{b}}^{{2}}{+}{a}{}{b}{}{{c}}^{{2}}{-}{b}{}{{a}}^{{2}}{-}{\mathrm{\beta }}{}{b}{}{a}{}{b}{-}{b}{}{a}{}{{c}}^{{2}}$ (12)

there are various terms involving the same noncommutative operands, just multiplied in different order. Generally speaking the limitation of this approach (in Maple 2016) consists of: there cannot be more than 2 terms in the expanded form containing the same operands. For instance in the expression above the 1st and 4th terms have the same operands, that are actually also present in the 5th term but there you also have $\mathrm{beta}$ and for that reason (involving some additional manipulations) it can still be factorized:

 > $\mathrm{Factor}\left(\right)$
 $\left({a}{}{b}{-}{b}{}{a}\right){}\left({\mathrm{\beta }}{}{b}{+}{{c}}^{{2}}{+}{a}\right)$ (13)

Here is an example where the approach implemented does not work (in Maple 2016) because of the limitation mentioned in the previous paragraph:

 > ${\left(\mathrm{Commutator}\left(a,b\right)+c\right)}^{2}$
 ${\mathrm{^}}{}\left({\mathrm{Commutator}}{}\left({a}{,}{b}\right){+}{c}{,}{2}\right)$ (14)
 > $\mathrm{expand}\left(\right)$
 ${a}{}{b}{}{a}{}{b}{-}{a}{}{{b}}^{{2}}{}{a}{+}{a}{}{b}{}{c}{-}{b}{}{{a}}^{{2}}{}{b}{+}{b}{}{a}{}{b}{}{a}{-}{b}{}{a}{}{c}{+}{c}{}{a}{}{b}{-}{c}{}{b}{}{a}{+}{{c}}^{{2}}$ (15)
 > 

In this expression, the 1st, 2nd, 4th and 5th terms have the same operands $a,b,a,b$ and then there are four terms containing the operands $a,b,c$. This type of expression is actually also factorable - work in progress.

Compatibility

 • The Physics[Factor] command was introduced in Maple 2016.