In [1]:
from cutiepy import *
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
# TODO: implement sparse Lindblad operator
cutiepy.operators.SPARSITY_N_CUTOFF = 60
In [2]:
initial_state = basis(2, 0)
initial_state
Out[2]:
In [3]:
ω0 = 1
Δ = 0.002
Ω = 0.005
ts = 6*np.pi/Ω*np.linspace(0,1,120)
H = ω0/2 * sigmaz() + Ω * sigmax() * sin((ω0+Δ)*t)
H
Out[3]:
In [4]:
res = mesolve(H, [], initial_state, ts)
In [5]:
σz_expect = expect(sigmaz(), res)
In [6]:
res[20]
Out[6]:
In [7]:
plt.plot(ts*Ω/np.pi, σz_expect, 'r.', label='numerical result')
Ωp = (Ω**2+Δ**2)**0.5
plt.plot(ts*Ω/np.pi, 1-(Ω/Ωp)**2*2*np.sin(Ωp*ts/2)**2, 'b-',
label=r'$1-2(\Omega^\prime/\Omega)^2\sin^2(\Omega^\prime t/2)$')
plt.title(r'$\langle\sigma_z\rangle$-vs-$t\Omega/\pi$ at '
r'$\Delta/\Omega=%.2f$, $\omega_0/\Omega=%.2f$'%(Δ/Ω, ω0/Ω))
plt.ylim(-1,1)
plt.legend(loc=3);
In [8]:
Hp = Δ/2 * sigmaz() + Ω/2 * sigmax()
Hp
Out[8]:
In [9]:
res = mesolve(Hp, [], initial_state, ts)
In [10]:
σz_expect = expect(sigmaz(), res)
In [11]:
plt.plot(ts*Ω/np.pi, σz_expect, 'r.', label='numerical result')
Ωp = (Ω**2+Δ**2)**0.5
plt.plot(ts*Ω/np.pi, 1-(Ω/Ωp)**2*2*np.sin(Ωp*ts/2)**2, 'b-',
label=r'$1-2(\Omega^\prime/\Omega)^2\sin^2(\Omega^\prime t/2)$')
plt.title(r'$\langle\sigma_z\rangle$-vs-$t\Omega/\pi$ at '
r'$\Delta/\Omega=%.2f$ in RWA'%(Δ/Ω))
plt.ylim(-1,1)
plt.legend(loc=3);
In [12]:
γ1 = 0.2*Ω
c1 = γ1**0.5 * sigmam()
c1
Out[12]:
In [13]:
res = mesolve(Hp, [c1], initial_state, ts)
In [14]:
σz_expect = expect(sigmaz(), res)
In [15]:
plt.plot(ts*Ω/np.pi, σz_expect, 'r.', label='numerical result')
plt.ylim(-1,1)
plt.title(r'$\langle\sigma_z\rangle$-vs-$t\Omega/\pi$ at '
r'$\Delta/\Omega=%.2f$ in RWA'%(Δ/Ω) + '\n' +
r'with $\gamma_1 \hat{\sigma}_-$ at $\gamma_1=0.2\Omega$')
plt.hlines(0,0,ts[-1]*Ω/np.pi)
plt.legend(loc=3);
In [16]:
γ2 = 0.2*Ω
c2 = γ2**0.5 * sigmaz()
c2
Out[16]:
In [17]:
res = mesolve(Hp, [c2], initial_state, ts)
In [18]:
σz_expect = expect(sigmaz(), res)
In [19]:
plt.plot(ts*Ω/np.pi, σz_expect, 'r.', label='numerical result')
plt.ylim(-1,1)
plt.title(r'$\langle\sigma_z\rangle$-vs-$t\Omega/\pi$ at '
r'$\Delta/\Omega=%.2f$ in RWA'%(Δ/Ω) + '\n' +
r'with $\gamma_2 \hat{\sigma}_z$ at $\gamma_2=0.2\Omega$')
plt.hlines(0,0,ts[-1]*Ω/np.pi)
plt.legend(loc=3);
In [20]:
N_cutoff = 40
α = 2.5
initial_state = coherent(N_cutoff, α)
initial_state
Out[20]:
In [21]:
H = num(N_cutoff)
H
Out[21]:
In [22]:
κ = 0.5
n_th = 0
c_down = (κ * (1 + n_th))**2 * destroy(N_cutoff)
c_down
Out[22]:
In [23]:
ts = 2*np.pi*np.linspace(0,1,41)
res = mesolve(H, [c_down], initial_state, ts)
a = destroy(N_cutoff)
a_expect = expect(a, res, keep_complex=True)
In [24]:
plt.figure(figsize=(4,4))
plt.plot(np.real(a_expect), np.imag(a_expect), 'b-')
for t, alpha in list(zip(ts,a_expect))[:40:4]:
plt.plot(np.real(alpha), np.imag(alpha), 'r.')
plt.text(np.real(alpha), np.imag(alpha), r'$t=%.1f\pi$'%(t/np.pi), fontsize=14)
plt.title(r'$\langle\hat{a}\rangle$-vs-$t$')
plt.ylabel(r'$\mathcal{I}(\alpha)$')
plt.xlabel(r'$\mathcal{R}(\alpha)$')
l = abs(a_expect[0])
plt.xlim(-l,l)
plt.ylim(-l,l);