i would like to be able to tell qapply
from sympy.physics.quantum
that i have a set (2 in my example) of orthonormal vectors:
from sympy.physics.quantum import Bra, Ket, qapply, Dagger
e0 = Ket('e0')
e1 = Ket('e1')
X = e1*Dagger(e0) + e0*Dagger(e1)
qapply(X * e1)
# -> <e0|e1>*|e1> + <e1|e1>*|e0>
is there a way to tell sage (or sympy in that case) that $\langle e_i|e_j \rangle = \delta_{ij}$?
the best i could come up with is a substituion rule:
e_rules = [(Dagger(e0)*e0, 1), (Dagger(e1)*e1, 1), (Dagger(e0)*e1, 0), (Dagger(e1)*e0, 0)]
qapply(X * e1).subs(e_rules)
# -> |e0>
isn't there something more elegant?