Inconsistency for harmonic oscillator

107 views
Skip to first unread message

Subimal Deb

unread,
Jun 24, 2021, 1:15:31 AM6/24/21
to QuTiP: Quantum Toolbox in Python

Hello everybody,
I am using QuTiP 4.6.2. I created the Hamiltonian for a harmonic oscillator in terms of
1) the momentum and position operator
2) the number operators

The first case runs into trouble always whereas the second does not.

The issue: When I use the momentum and position operator to create the Hamiltonian, the eigenvalues of two states in the middle of the series of states come out to be equal. this happens no matter how many Hilbert space levels I use. This issue is not there when I use the creation and annihilation operators. I should be getting identical results in both cases. Can someone point out where have I gone wrong? The code below is copied from my interpreter to show the results.

>>> import qutip as qt
>>> N = 10 # no. of states
>>> om = 1
>>> p = qt.momentum(N)
>>> x = qt.position(N)
>>> H = 0.5*(p*p+ om*om*x*x)
>>> evals, evecs = H.eigenstates()
>>> print("evals: ",evals)
evals:  [0.5 1.5 2.5 3.5 4.5 4.5 5.5 6.5 7.5 8.5]
>>> # evals[4] and evals[5] are equal (Why?)  <<< The error
>>> evecs[4]==evecs[5]
False
>>> # now let us use the creation and annihilation operators to create the Hamiltonian
>>> ad = qt.create(N)
>>> a = ad.dag()
>>> H1 = (ad*a + 0.5)*om
>>> evals1, evecs1 = H1.eigenstates()
>>> print("evals1: ",evals1)  # <<< No trouble here
evals1:  [0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5]
>>>

I would appreciate all inputs.
With my best regards
Subimal Deb

Simon Cross

unread,
Jun 28, 2021, 6:17:31 AM6/28/21
to qu...@googlegroups.com
Just noting that this was answered in https://github.com/qutip/qutip/issues/1587 for anyone following along on the mailing list.

Note: The mailing list is probably preferable for these kinds of "what is happening here" questions than the issue tracker, but no harm done (and we definitely prefer collaborators to ask somewhere rather than nowhere! :).
Reply all
Reply to author
Forward
0 new messages