%matplotlib inline from scipy import * from qutip import * H = 0.5 * 2 * pi * sigmax() psi0 = basis(2, 0) tlist = linspace(0, 10, 1000) e_ops = [sigmax(), sigmay(), sigmaz()] e_ops_dict = {r'$\sigma_x$': sigmax(), r'$\sigma_y$': sigmay(), r'$\sigma_z$': sigmaz()} c_ops = [sqrt(0.1) * sigmaz()] result = mesolve(H, psi0, tlist, c_ops, e_ops) fig, ax = plt.subplots(1,1) for n, e in enumerate(result.expect): ax.plot(tlist, e, label=["sx", "sy", "sz"][n]) ax.legend(); result = mesolve(H, psi0, tlist, c_ops, e_ops_dict) fig, ax = plt.subplots(1,1) for key, e in result.expect.items(): ax.plot(tlist, e, label=key) ax.legend(); result = sesolve(H, psi0, tlist, e_ops) fig, ax = plt.subplots(1,1) for n, e in enumerate(result.expect): ax.plot(tlist, e, label=["sx", "sy", "sz"][n]) ax.legend(); result = sesolve(H, psi0, tlist, e_ops_dict) fig, ax = plt.subplots(1,1) for key, e in result.expect.items(): ax.plot(tlist, e, label=key) ax.legend(); result = mcsolve(H, psi0, tlist, c_ops, e_ops, ntraj=15, options=Odeoptions(gui=False)) fig, ax = plt.subplots(1,1) for n, e in enumerate(result.expect): ax.plot(tlist, e, label=["sx", "sy", "sz"][n]) ax.legend(); result = mcsolve(H, psi0, tlist, c_ops, e_ops_dict, ntraj=5, options=Odeoptions(gui=False)) fig, ax = plt.subplots(1,1) for key, e in result.expect.items(): ax.plot(tlist, e, label=key) ax.legend();