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):
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