Maxima CAS simplification for idempotent objects

39 Views Asked by At

I'm trying to use the Maxima CAS system to study expressions involving idempotent objects (density operators in quantum mechanics). I would like to simplify expressions using the idempotent property, which in my case takes the form $\rho S \rho = \rho$. Note that in Maxima I use the "." operator for multiplication, not "*", because these objects do not commute with each other. I have succeeded in writing a "defrule" that works for an expression like $\rho S \rho + d \rightarrow \rho + d$, but I cannot figure out how to simplify something like the following: $\rho S d \rho S \rho d \rho S \rightarrow \rho S d \rho d \rho S$ (note that $\rho S \rho$ appears in the interior of the expression and should be replaced by $\rho$). I guess I'm not understanding the pattern matching process well enough. Any suggestions would be most welcome.