Commutator algebra
An often asked question is how to handle commutator algebra with Cadabra. This requires a few steps which are perhaps not entirely transparent to a new user, hence the following simple example. In this notebook, we will verify the invariance of the two quadratic Casimirs of the Poincaré algebra. That is, we will verify that \begin{equation} [ J_{\mu\nu}, P^2 ] = 0\,,\quad{\rm and}\quad [ J_{\mu\nu}, W^2 ] = 0\,, \end{equation} where $P^2 = P_\mu P_\mu$ is the momentum squared and $W^2 = W_\mu W_\mu$ is the square of \begin{equation} W_\mu = \epsilon_{\mu\nu\rho\sigma} P_{\nu} J_{\rho\sigma}\,. \end{equation} We first make some straightforward property assignments: declaration of indices, declaration of the operators $P_\mu$ and $J_{\mu\nu}$ and the fact that they do not commute, and so on.{\mu,\nu,\rho,\sigma,\lambda,\kappa,\alpha,\beta,\gamma,\xi}::Indices.
{\mu,\nu,\rho,\sigma,\lambda,\kappa,\alpha,\beta,\gamma,\xi}::Integer(0..3).
\eta_{\mu\nu}::KroneckerDelta.
\delta{#}::KroneckerDelta.
e_{\mu\nu\lambda\rho}::EpsilonTensor(delta=\delta).
J_{\mu\nu}::AntiSymmetric.
J_{\mu\nu}::SelfNonCommuting.
{ J_{\mu\nu}, P_{\mu}, W_{\mu} }::NonCommuting.
{J_{\mu\nu}, P_{\mu}, W_{\mu} }::Depends(\commutator{#}).
For computations involving algebras like the one in this notebook, the following set of post processing
rules is useful. They move all objects out of commutators and anti-commutators which commute with
everything else, and then reorder and relabel indices to obtain a simple form.
def post_process(ex):
unwrap(ex)
eliminate_kronecker(ex)
canonicalise(ex)
rename_dummies(ex)
collect_terms(ex)
The Poincaré algebra
We now input the rules which define the Poincaré algebra. These are simply substitution rules, to be used later in explicit substition commands.poincare:= { \commutator{J_{\mu\nu}}{P_{\rho}} -> \eta_{\mu\rho} P_{\nu} - \eta_{\nu\rho} P_{\mu},
\commutator{J_{\mu\nu}}{J_{\rho\sigma}} -> \eta_{\mu\rho} J_{\nu\sigma}
- \eta_{\mu\sigma} J_{\nu\rho}
- \eta_{\nu\rho} J_{\mu\sigma}
+ \eta_{\nu\sigma} J_{\mu\rho} };
\(\displaystyle{}\left\{{}\left[J_{\mu \nu}, P_{\rho}\right]{} \rightarrow \eta_{\mu \rho} P_{\nu}-\eta_{\nu \rho} P_{\mu}, \mmlToken{mo}[linebreak="goodbreak"]{} {}\left[J_{\mu \nu}, J_{\rho \sigma}\right]{} \rightarrow \eta_{\mu \rho} J_{\nu \sigma}-\eta_{\mu \sigma} J_{\nu \rho}-\eta_{\nu \rho} J_{\mu \sigma}+\eta_{\nu \sigma} J_{\mu \rho}\right\}\)
The $P^2$ Casimir
We know that $P^2$ is a Casimir, so the following should vanish:Psq:= \commutator{J_{\mu\nu}}{ P_{\rho}P_{\rho} };
\(\displaystyle{}{}\left[J_{\mu \nu}, P_{\rho} P_{\rho}\right]{}\)
product_rule(_);
\(\displaystyle{}{}\left[J_{\mu \nu}, P_{\rho}\right]{} P_{\rho}+P_{\rho} {}\left[J_{\mu \nu}, P_{\rho}\right]{}\)
substitute(_, poincare);
\(\displaystyle{}\left(\eta_{\mu \rho} P_{\nu}-\eta_{\nu \rho} P_{\mu}\right) P_{\rho}+P_{\rho} \left(\eta_{\mu \rho} P_{\nu}-\eta_{\nu \rho} P_{\mu}\right)\)
distribute(_);
\(\displaystyle{}0\)
The $W^2$ Casimir
Next we do the same thing with $W^2$, the other Poincaré Casimir...Wsq:=\commutator{J_{\mu\nu}}{W_\mu W_\mu};
\(\displaystyle{}{}\left[J_{\mu \nu}, W_{\rho} W_{\rho}\right]{}\)
substitute(_, $W_\mu -> e_{\mu\nu\lambda\rho} P_\nu J_{\lambda\rho}$);
\(\displaystyle{}e_{\gamma \alpha \lambda \kappa} e_{\gamma \rho \sigma \beta} {}\left[J_{\mu \nu}, P_{\alpha} J_{\rho \sigma} P_{\beta} J_{\lambda \kappa}\right]{}\)
epsilon_to_delta(_);
\(\displaystyle{}6\delta_{\alpha \rho \lambda \sigma \kappa \beta} {}\left[J_{\mu \nu}, P_{\alpha} J_{\rho \sigma} P_{\beta} J_{\lambda \kappa}\right]{}\)
expand_delta(_);
\(\displaystyle{}-6\left(\frac{1}{6}\delta_{\alpha \rho} \delta_{\beta \lambda} \delta_{\kappa \sigma} - \frac{1}{6}\delta_{\alpha \rho} \delta_{\beta \kappa} \delta_{\lambda \sigma} - \frac{1}{6}\delta_{\alpha \sigma} \delta_{\beta \lambda} \delta_{\kappa \rho}+\frac{1}{6}\delta_{\alpha \beta} \delta_{\lambda \sigma} \delta_{\kappa \rho}+\frac{1}{6}\delta_{\alpha \sigma} \delta_{\beta \kappa} \delta_{\lambda \rho} - \frac{1}{6}\delta_{\alpha \beta} \delta_{\lambda \rho} \delta_{\kappa \sigma}\right) {}\left[J_{\mu \nu}, P_{\alpha} J_{\rho \sigma} P_{\beta} J_{\lambda \kappa}\right]{}\)
product_rule(_);
\(\displaystyle{}-6\left(\frac{1}{6}\delta_{\alpha \rho} \delta_{\beta \kappa} \delta_{\lambda \sigma} - \frac{1}{6}\delta_{\alpha \rho} \delta_{\beta \lambda} \delta_{\kappa \sigma} - \frac{1}{6}\delta_{\alpha \sigma} \delta_{\beta \kappa} \delta_{\lambda \rho}+\frac{1}{6}\delta_{\alpha \beta} \delta_{\lambda \rho} \delta_{\kappa \sigma}+\frac{1}{6}\delta_{\alpha \sigma} \delta_{\beta \lambda} \delta_{\kappa \rho} - \frac{1}{6}\delta_{\alpha \beta} \delta_{\lambda \sigma} \delta_{\kappa \rho}\right) \left(-{}\left[J_{\mu \nu}, P_{\alpha}\right]{} J_{\rho \sigma} P_{\beta} J_{\lambda \kappa}-P_{\alpha} {}\left[J_{\mu \nu}, J_{\rho \sigma}\right]{} P_{\beta} J_{\lambda \kappa}-P_{\alpha} J_{\rho \sigma} {}\left[J_{\mu \nu}, P_{\beta}\right]{} J_{\lambda \kappa}+P_{\alpha} J_{\rho \sigma} P_{\beta} {}\left[J_{\mu \nu}, J_{\kappa \lambda}\right]{}\right)\)
substitute(_, poincare);
\(\displaystyle{}-6\left(\frac{1}{6}\delta_{\beta \rho} \delta_{\alpha \kappa} \delta_{\lambda \sigma} - \frac{1}{6}\delta_{\beta \rho} \delta_{\alpha \lambda} \delta_{\kappa \sigma} - \frac{1}{6}\delta_{\beta \sigma} \delta_{\alpha \kappa} \delta_{\lambda \rho}+\frac{1}{6}\delta_{\beta \alpha} \delta_{\kappa \sigma} \delta_{\lambda \rho}+\frac{1}{6}\delta_{\beta \sigma} \delta_{\alpha \lambda} \delta_{\kappa \rho} - \frac{1}{6}\delta_{\beta \alpha} \delta_{\kappa \rho} \delta_{\lambda \sigma}\right) \left(-\left(\eta_{\beta \mu} P_{\nu}-\eta_{\beta \nu} P_{\mu}\right) J_{\rho \sigma} P_{\alpha} J_{\lambda \kappa}-P_{\beta} \left(\eta_{\mu \rho} J_{\nu \sigma}-\eta_{\mu \sigma} J_{\nu \rho}-\eta_{\nu \rho} J_{\mu \sigma}+\eta_{\nu \sigma} J_{\mu \rho}\right) P_{\alpha} J_{\lambda \kappa}-P_{\beta} J_{\rho \sigma} \left(\eta_{\alpha \mu} P_{\nu}-\eta_{\alpha \nu} P_{\mu}\right) J_{\lambda \kappa}+P_{\beta} J_{\rho \sigma} P_{\alpha} \left(-\eta_{\kappa \mu} J_{\lambda \nu}+\eta_{\lambda \mu} J_{\kappa \nu}+\eta_{\kappa \nu} J_{\lambda \mu}-\eta_{\lambda \nu} J_{\kappa \mu}\right)\right)\)
distribute(_);
\(\displaystyle{}0\)