correlation_2op_1t() and spectrum() giving the physically incorrect result unless solver='es'
See original GitHub issueDescribe the bug See discussion here:
https://groups.google.com/g/qutip/c/2lod1DuFZiE/m/y8Bj6dKHDAAJ?pli=1
To my surprise, my PhD student had this problem again today, I am a bit surprised nothing has been done about this.
At least making es
the default solver for correlation and spectrum, updating the docs to give a warning to only use the es solver (for now?), and maybe longer term figuring out why the other solvers are not handling it properly
To Reproduce
https://github.com/gsteele13/gary-exploring-qutip/blob/master/Correlations.ipynb
import numpy as np
import pylab as plt
from qutip import *
N = 5
w = 1 * 2 * np.pi # 1 Hz oscillator frequency
Q = 40
kappa = w / Q
# Set up some operators
a = destroy(N)
n = num(N)
x = (a + a.dag())/np.sqrt(2)
p = -1j * (a - a.dag())/np.sqrt(2)
H = w * a.dag() * a
c_ops = []
psi0 = fock(N,0)
tlist = np.linspace(0, 10, 500)
corr = correlation_2op_1t(H, psi0, tlist, c_ops, x, x, solver='me')
wlist1, spec1 = spectrum_correlation_fft(tlist, corr)
plt.figure(figsize=(14,8))
plt.plot(tlist, np.real(corr))
plt.plot(tlist, np.imag(corr))
plt.show()
plt.figure(figsize=(14,8))
plt.plot(wlist1, np.abs(spec1))
plt.show()
Expected behavior Correlation should have an imaginary component and quantum PSD should not be symmetric about f = 0
Your Environment Software Version QuTiP 4.4.1 Numpy 1.17.4 SciPy 1.4.1 matplotlib 3.3.4 Cython 0.29.14 Number of CPUs 4 BLAS Info INTEL MKL IPython 7.9.0 Python 3.7.5 (default, Oct 25 2019, 10:52:18) [Clang 4.0.1 (tags/RELEASE_401/final)] OS posix [darwin] Wed Mar 10 08:51:15 2021 CET
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top GitHub Comments
Hi everyone, I would like to solve this issue. Is anyone working on it already or should I just go for it?
No-one that I know of is working on it - we’ve left it open for somebody to come and have a starting issue to work with. Thanks for taking it!