Question: QM perturbation theory: too many levels of recursion

Hello everyone,

I've been trying to do some perturbation theory and ran into some problems I don't quite understand. I implemented the Hamiltonian of the Bose-Hubbard model and treated the hopping as a perturbation. Calculating the second order energy shift is easily accomplished, but when I'm only interested in one of the two occuring terms, I run into problems. The calculation takes minutes to finally fail, giving me an "too many levels of recursion"-error. I need to be able to just pick a few terms for some calculations, I'm doing, and can't figure out what I might be doing wrong. Here is the source code (download is below):

restart; with(Physics); Setup(mathematicalnotation = true)

a__1 := Annihilation(N, 1):

assume(`and`(`in`(m, nonnegint), m > 0)):

Physics:-Ket(N, m, m)

(1)

H := Physics:-`*`(Physics:-`*`(1/2, n__1), n__1-1)+Physics:-`*`(Physics:-`*`(1/2, n__2), n__2-1):

`ΔE__2` := Physics:-`*`(Physics:-`*`(2, d), simplify(value(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Typesetting:-delayDotProduct(Dagger(psi), V), 1/(E(m, m)-H)), V), psi))))

-4*d*J^2*m*(m+1)

(2)

simplify(value(((Dagger(psi).c__2)*a__1.(1/(E(m, m)-H)).c__1)*a__2.psi))

Error, (in PatternMatching:-AlgStruct:-Match) too many levels of recursion

 

``

Download too_many_levels_of_recursion.mw

It would be great, if someone could point out the mistake, I'm making. I copy/pasted the last line, so there shouldn't be any typos.

Thanks in advance,

Sören

Please Wait...