PhilippAumann / circuitq

Toolbox for the simulation and analysis of superconducting circuits.
MIT License
39 stars 9 forks source link

Implemented Hamiltonian expression has $$q^q$$ instead of $$q^2$$ #8

Closed abhishekchak52 closed 2 years ago

abhishekchak52 commented 2 years ago

Hi,

On line 637 of core.py, the following expression is used when creating the implemented Hamiltonian:

q_q = sp.symbols('q^{q}_{' + str(node_l) + '}')

I'm wondering if it should be the expression below instead?

q_q = sp.symbols('q^{2}_{' + str(node_l) + '}')

PhilippAumann commented 2 years ago

Hi,

thank you for opening this issue and sending a pull request to resolve the issue - a perfect combination ;) In the text above, the code lines are exact duplicates, but from the title and your pull request I assume that you suggest to change the exponent q to 2.

This looks like a typo, but was actually intentionally designed when writing the code. The reason for this is a little bit hidden in the details but I will try to explain: Within the flux basis, the charge operator $\hat{q}$ corresponds to a derivative and is implemented by the finite difference method. As outlined in our preprint paper, $\hat{q}$ and $\hat{q}^2$ it is implemented in the charge matrix by the following matrices: image

As we want our Hamiltonian to be hermitian, we had to choose a different discretisation for $\hat{q}$ and $\hat{q}^2$, such that the matrix implementing $\hat{q}^2$ is not simply the square of the matrix implementing $\hat{q}$. To make this distinction, the squared matrix is labeled by q^{q} instead of q^{2}. The reason I have chosen the letter q as an exponent was simply that in German, "square" is translated to "quadrat".

If you have the feeling, that the letter q is misleading here, we could think about alternatives, however I wouldn't change it simply to 2 because of the above reasons. However, if we change it at this point of the code, we also have to modify it consistently throughout the whole code where the symbol is used.

Best, Philipp

abhishekchak52 commented 2 years ago

Ah, thank you for the clarification! It was very helpful.