When I add a zero matrix with time dependence (even if the time dependence is constant) my Hamiltonian, it changes the way mesolve behaves.
Am I misunderstanding the way H is constructed?
from qutip import * N = 4 a = destroy(N) psi0 = fock(N, 0) omega = 1 kappa = 1 def coeff_1(t, args): return 1 def coeff_2(t, args): return 1 H0 = omega * a.dag() * a H1 = a.dag() + a H2 = 0 * (a.dag() + a) coeff_test1 = coefficient(coeff_1) coeff_test2 = coefficient(coeff_2) H = QobjEvo([H0, [H1, coeff_test1], H2]) H_prime = QobjEvo([H0, [H1, coeff_test1], [H2, coeff_test2]]) times = np.linspace(0, 1, 1000) result1 = mesolve(H, psi0, times, [kappa * a], [], args={}) result2 = mesolve(H_prime, psi0, times, [kappa * a], [], args={}) n1 = expect(a.dag() * a, result1.states[-1]) n2 = expect(a.dag() * a, result2.states[-1]) print('diff: ' + str(n1 - n2)) assert n1 == n2Code Output
diff: -1.2532650784482082 Traceback (most recent call last): File "/test.py", line 50, in <module> assert n1 == n2 ^^^^^^^^ AssertionErrorExpected Behaviour
Adding time-dependence to a zero component of H shouldn't change anything.
Your EnvironmentQuTiP Version: 5.0.2 Numpy Version: 1.26.4 Scipy Version: 1.13.1 Cython Version: None Matplotlib Version: 3.9.0 Python Version: 3.12.4 Number of CPUs: 12 BLAS Info: Generic INTEL MKL Ext: False Platform Info: Darwin (arm64) Installation path: /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/qutipAdditional Context
No response
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4