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

Rabi Oscillations

$\hat{H} = \hat{H}_0 + \Omega \sin((\omega_0+\Delta)t) \hat{\sigma}_x$

$\hat{H}_0 = \frac{\omega_0}{2}\hat{\sigma}_z$


In [2]:
initial_state = basis(2, 0)
initial_state


Out[2]:
$$\text{Ket }{| {{0}}_{{\tiny N\normalsize 2}} \rangle} \text{ on the space }\mathbb{C}^{2}\text{ with numerical content: }$$ $$\begin{equation*}\left(\begin{array}{*{11}c}1.0\\0.0\\\end{array}\right)\end{equation*}$$

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]:
$${\left( {{0.5}\tiny\times\normalsize{\hat{σ}_{z}}}+{{0.005}\tiny\times\normalsize{\operatorname{sin}\left( {{{1.002}\tiny\times\normalsize{t}}} \right)}\tiny\times\normalsize{\hat{σ}_{x}}} \right)}$$

In [4]:
res = mesolve(H, [], initial_state, ts)


Generating cython code...
Compiling cython code...
Running cython code...
Starting at 10/25 15:52:02.
Finishing at 10/25 15:52:03.
Total time: 0 seconds.
Formatting the output...

In [5]:
σz_expect = expect(sigmaz(), res)

In [6]:
res[20]


Out[6]:
$$\text{Anonymous }\text{Operator }{\hat{\tiny\boxed{{O}_{30e67746...}}\normalsize}_{}} \text{ on the space }\mathbb{C}^{2}\text{ with numerical content: }$$ $$\begin{equation*}\left(\begin{array}{*{11}c}0.151 & (0.031-0.356j)\\(0.031+0.356j) & 0.849\\\end{array}\right)\end{equation*}$$

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);


With Rotating Wave Approximation

$\hat{H}^\prime = e^{i\hat{H}_0 t}\hat{H} e^{-i\hat{H}_0 t} \approx \frac{\Delta}{2} \hat{\sigma}_z + \frac{\Omega}{2} \hat{\sigma}_x$


In [8]:
Hp = Δ/2 * sigmaz() + Ω/2 * sigmax()
Hp


Out[8]:
$${\left( {{0.0025}\tiny\times\normalsize{\hat{σ}_{x}}}+{{0.001}\tiny\times\normalsize{\hat{σ}_{z}}} \right)}$$

In [9]:
res = mesolve(Hp, [], initial_state, ts)


Generating cython code...
Compiling cython code...
Running cython code...
Starting at 10/25 15:52:10.
Finishing at 10/25 15:52:10.
Total time: 0 seconds.
Formatting the output...

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);


With $\gamma_1$ collapse


In [12]:
γ1 = 0.2*Ω
c1 = γ1**0.5 * sigmam()
c1


Out[12]:
$${{0.03162277660168379}\tiny\times\normalsize{\hat{σ}_{-}}}$$

In [13]:
res = mesolve(Hp, [c1], initial_state, ts)


Generating cython code...
Compiling cython code...
Running cython code...
Starting at 10/25 15:52:17.
Finishing at 10/25 15:52:17.
Total time: 0 seconds.
Formatting the output...

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);


With $\gamma_2$ collapse


In [16]:
γ2 = 0.2*Ω
c2 = γ2**0.5 * sigmaz()
c2


Out[16]:
$${{0.03162277660168379}\tiny\times\normalsize{\hat{σ}_{z}}}$$

In [17]:
res = mesolve(Hp, [c2], initial_state, ts)


Generating cython code...
Compiling cython code...
Running cython code...
Starting at 10/25 15:52:24.
Finishing at 10/25 15:52:24.
Total time: 0 seconds.
Formatting the output...

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);


Coherent State in a Harmonic Oscillator

$|\alpha\rangle$ evolving under $\hat{H} = \hat{n}$ coupled to a zero temperature heat bath $\kappa = 0.5$


In [20]:
N_cutoff = 40
α = 2.5
initial_state = coherent(N_cutoff, α)
initial_state


Out[20]:
$$\text{Ket }{| {{\tiny\alpha\normalsize 2.50}}_{{\tiny N\normalsize 40}} \rangle} \text{ on the space }\mathbb{C}^{40}\text{ with numerical content: }$$ $$\begin{equation*}\left(\begin{array}{*{11}c}0.044\\0.110\\0.194\\0.280\\0.350\\\vdots\\3.661\times10^{-08}\\1.525\times10^{-08}\\6.270\times10^{-09}\\2.543\times10^{-09}\\1.018\times10^{-09}\\\end{array}\right)\end{equation*}$$

In [21]:
H = num(N_cutoff)
H


Out[21]:
$$\text{Operator }{\hat{{n}}_{{40}}} \text{ on the space }\mathbb{C}^{40}\text{ with numerical content: }$$ $$\begin{equation*}\left(\begin{array}{*{11}c}0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 1.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 2.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 3.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 4.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots & \vdots\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 35.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 36.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 37.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 38.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 39.0\\\end{array}\right)\end{equation*}$$

In [22]:
κ = 0.5
n_th = 0

c_down = (κ * (1 + n_th))**2 * destroy(N_cutoff)
c_down


Out[22]:
$${{0.25}\tiny\times\normalsize{\hat{{a}}_{{40}}}}$$

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)


Generating cython code...
Compiling cython code...
Running cython code...
Starting at 10/25 15:52:31.
Finishing at 10/25 15:52:32.
Total time: 0 seconds.
Formatting the output...

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);