In [18]:
from qutip import *
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
In [6]:
coherent_dm(5,2)
Out[6]:
Simulate a spin-1/2 system in an external magnetic field.
In [52]:
omega = 2*np.pi
H = 0.707*sigmaz() + 0.707*sigmax()
a=1/np.sqrt(2)
b=a
psi0 = a*basis(2,1) + b*basis(2,0)
t = np.linspace(0,10)
Sz = 1/2*sigmaz()
In [55]:
result1 = sesolve(H,psi0,t,[Sz])
In [56]:
for ex in result1.expect:
plt.plot(omega*t/np.pi,ex)
In [ ]:
In [ ]: