-
-
Save Observatorio-de-Matematica/4d17aeecf34f0aeea8d171f1e95e0e3b to your computer and use it in GitHub Desktop.
Maxima - Proper use of Dirac bra-ket notation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare(bra, nonscalar); | |
declare(ket, nonscalar); | |
dotscrules:true; | |
matchdeclare(m,lambda([t],featurep(t,integer))); | |
matchdeclare(n,lambda([t],featurep(t,integer))); | |
tellsimp(bra(m).ket(n), kron_delta(m,n)); | |
simp:false; | |
matchdeclare(aa, true); | |
matchdeclare(bb, true); | |
matchdeclare(cc, true); | |
tellsimp (aa.(bb.cc),(aa.bb).cc); | |
simp:true; | |
/* Tests */ | |
bra(0) . ket(0); | |
ket(1) . bra(0) . ket(0); | |
bra(1) . ket(1) . bra(0) . ket(0); | |
bra(1) . ket(1) . bra(0); | |
ket(1) . bra(1) . ket(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment