Could I get some help defining the angular momentum commutators symbolicaly in Julia?
I’ve tried using SymbolicUtils @acrules to define Nx*Ny - Ny*Nx => im*Nz but then when I run Nx*Ny - Ny*Nx it returns zero. I also tried defining the syms as Matrices but that returns errors about lack of methods or unknown dimensions.
Does anyone know how to get this to work? Thanks in advance!
The ac in @acrules stands for “associative, commutative”. You’re trying to handle a non-commutative operation, so you can’t use @acrules for this. Last I checked, it’s a bit hard to handle non-commutative operators still in Symbolics.jl (but maybe it’s better now, I’m not sure)