In [1]:
from cutiepy import *
import qutip
import numpy as np
cutiepy.interactive.INTERACTIVE = False
In [2]:
#setup
ω0 = 1
Δ = 0.002
Ω = 0.005
ts = 2*np.pi/Ω*np.linspace(0,1,40)
In [3]:
#cutiepy
initial_state = basis(2, 0)
H = ω0/2 * sigmaz() + Ω * sigmax() * sin((ω0+Δ)*t)
%time res = sesolve(H, initial_state, ts)
%time res = sesolve(H, initial_state, ts)
res[-1]
Out[3]:
In [4]:
#qutip
initial_state = qutip.basis(2, 0)
H = [ω0/2 * qutip.sigmaz(), [Ω * qutip.sigmax(), 'sin(%f*t)'%(ω0+Δ)]]
opts = qutip.Options(rhs_reuse=True)
%time res = qutip.sesolve(H, initial_state, ts, [], options=opts)
%time res = qutip.sesolve(H, initial_state, ts, [], options=opts)
res.states[-1]
Out[4]:
In [5]:
#setup
ω = 1
g = 0.1
N_cutoff = 40
alpha = 4
ts = 50/g*np.linspace(0,1,8000)
In [6]:
#cutiepy
H0 = ω*(tensor(num(N_cutoff), identity(2)) + 0.5 * tensor(identity(N_cutoff), sigmaz()))
Hp = g*(tensor(destroy(N_cutoff),sigmap()) + tensor(create(N_cutoff), sigmam()))
coh = tensor(coherent(N_cutoff, alpha), basis(2,0))
%time res = sesolve(H0 + Hp, coh, ts)
%time res = sesolve(H0 + Hp, coh, ts)
In [7]:
#qutip
H0 = ω*(qutip.tensor(
qutip.num(N_cutoff),
qutip.identity(2))
+0.5*qutip.tensor(
qutip.identity(N_cutoff),
qutip.sigmaz()))
Hp = g*(qutip.tensor(
qutip.destroy(N_cutoff),
qutip.sigmap())
+qutip.tensor(
qutip.create(N_cutoff),
qutip.sigmam()))
coh = qutip.tensor(qutip.coherent(N_cutoff, alpha), qutip.basis(2,0))
opts = qutip.Options(rhs_reuse=True)
%time res = qutip.sesolve(H0 + Hp, coh, ts, [], options=opts)
%time res = qutip.sesolve(H0 + Hp, coh, ts, [], options=opts)