Copyright (C) 2011 and later, Paul D. Nation & Robert J. Johansson
In [1]:
%matplotlib inline
In [2]:
from scipy import *
In [3]:
from qutip import *
In [4]:
H = 0.5 * 2 * pi * sigmax()
In [5]:
psi0 = basis(2, 0)
In [6]:
tlist = linspace(0, 10, 1000)
In [7]:
e_ops = [sigmax(), sigmay(), sigmaz()]
In [8]:
e_ops_dict = {r'$\sigma_x$': sigmax(), r'$\sigma_y$': sigmay(), r'$\sigma_z$': sigmaz()}
In [9]:
c_ops = [sqrt(0.1) * sigmaz()]
In [10]:
result = mesolve(H, psi0, tlist, c_ops, e_ops)
In [11]:
fig, ax = plt.subplots(1,1)
for n, e in enumerate(result.expect):
ax.plot(tlist, e, label=["sx", "sy", "sz"][n])
ax.legend();
In [12]:
result = mesolve(H, psi0, tlist, c_ops, e_ops_dict)
In [13]:
fig, ax = plt.subplots(1,1)
for key, e in result.expect.items():
ax.plot(tlist, e, label=key)
ax.legend();
In [14]:
result = sesolve(H, psi0, tlist, e_ops)
In [15]:
fig, ax = plt.subplots(1,1)
for n, e in enumerate(result.expect):
ax.plot(tlist, e, label=["sx", "sy", "sz"][n])
ax.legend();
In [16]:
result = sesolve(H, psi0, tlist, e_ops_dict)
In [17]:
fig, ax = plt.subplots(1,1)
for key, e in result.expect.items():
ax.plot(tlist, e, label=key)
ax.legend();
In [18]:
result = mcsolve(H, psi0, tlist, c_ops, e_ops, ntraj=15, options=Odeoptions(gui=False))
In [19]:
fig, ax = plt.subplots(1,1)
for n, e in enumerate(result.expect):
ax.plot(tlist, e, label=["sx", "sy", "sz"][n])
ax.legend();
In [20]:
result = mcsolve(H, psi0, tlist, c_ops, e_ops_dict, ntraj=5, options=Odeoptions(gui=False))
In [21]:
fig, ax = plt.subplots(1,1)
for key, e in result.expect.items():
ax.plot(tlist, e, label=key)
ax.legend();
In [ ]: