1
$\begingroup$

I get different results from mesolve when I change the number points in tlist. The Hamiltonian and initial vector are the same. The results from mesolve are also incorrect (however, essolve gives me the correct answer from any number of points in tlist)... Am I missing something? In the QuTip tutorial demoing this, they use tlist = np.linspace(0.0, 10.0, 100), but when I use this I get ODE integration error.

H = 2 * np.pi * 0.1 * sigmax()
tlist = np.linspace(0.0, 10.0, 1000)
psi0 = basis(2, 0)

result = mesolve(H, psi0, tlist, [], [sigmax(), sigmay(), sigmaz()])
fig, axes = plt.subplots(1,1)
axes.plot(tlist, result.expect[2], label=r'$\left<\sigma_z\right>$')
axes.plot(tlist, result.expect[1], label=r'$\left<\sigma_y\right>$')
axes.plot(tlist, result.expect[0], label=r'$\left<\sigma_x\right>$')
axes.set_xlabel(r'$t$', fontsize=20)
axes.legend(loc=2);
plt.show()

mesolve output, 1000 points

tlist = np.linspace(0, 10, 150)

result = mesolve(H, psi0, tlist, [], [sigmax(), sigmay(), sigmaz()])
fig, axes = plt.subplots(1,1)
axes.plot(tlist, result.expect[2], label=r'$\left<\sigma_z\right>$')
axes.plot(tlist, result.expect[1], label=r'$\left<\sigma_y\right>$')
axes.plot(tlist, result.expect[0], label=r'$\left<\sigma_x\right>$')
axes.set_xlabel(r'$t$', fontsize=20)
axes.legend(loc=2);

plt.show()

mesolve output, 150 points

The output from essolve for any time list

essolve output

$\endgroup$

1 Answer 1

0
$\begingroup$

This is what I get when I run the same exact code as your first bloc.

enter image description here

Note that even only using 100 data points in tlist it gives the correct answer. So my naive intuition is that either something is horribly wrong with your installation, or there is some issue with your code. Perhaps are you using a jupyter notebook with stored kernel variables that are messing up your simulation? Your top plot kinda looks like there is some Lindblad operators causing the decay behavior of your expectation values.

I would suggest trying a completely new kernel, and just running that section of code.

$\endgroup$
3
  • $\begingroup$ I use a fresh kernel, and I am in a new conda environment with qutip 4.7 now. Same plots are appearing. I didn't have any trouble installing qutip from conda and running the code, but clearly something is wrong since the plots are not correct. Very confident I didn't use any Lindblad operators anywhere. $\endgroup$ May 11, 2022 at 16:38
  • $\begingroup$ Not sure where to start checking my installation since no warnings or errors ever popped up... $\endgroup$ May 11, 2022 at 16:50
  • $\begingroup$ Not really sure :( Maybe try import qutip.testing; qutip.testing.run()? If that gives you nothing helpful I would try posting this same question on the qutip github - you might get more help there. since if you're running the code like I did from a new environment, it should work just fine. No clue what's happening with yours - sorry. $\endgroup$
    – Bebotron
    May 12, 2022 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.