The ladder operators RaisingOp() and LoweringOp(), the number
operator NumberOp(), the Hamiltonian Hamiltonian() and the states
SHOKet(n) and SHOBra(n) of sympy.physics.quantum.sho1d. Each
operator takes one label. represent() gives matrices of size ndim
(4 by default) in the number basis, and rewrite() writes the
operators in terms of "a", "xp", "N" or "H".
Examples
ad <- RaisingOp("a"); a <- LoweringOp("a")
qapply(ad * SHOKet(1))
#> sqrt(2)*|2>
represent(NumberOp("N"), ndim = 3)
#> Matrix(3, 3)
#> [0, 0, 0]
#> [0, 1, 0]
#> [0, 0, 2]
doit(Commutator(a, ad))
#> 1