qnet.algebra.toolbox.commutator_manipulation module

Summary

Functions:

expand_commutators_leibniz Recursively expand commutators in expr according to the Leibniz rule.

__all__: expand_commutators_leibniz

Reference

qnet.algebra.toolbox.commutator_manipulation.expand_commutators_leibniz(expr, expand_expr=True)[source]

Recursively expand commutators in expr according to the Leibniz rule.

\[[A B, C] = A [B, C] + [A, C] B\]
\[[A, B C] = [A, B] C + B [A, C]\]

If expand_expr is True, expand products of sums in expr, as well as in the result.