# Unitary transformations of pauli operators¶

In :
from sympy import *
init_printing()

from sympy.physics.quantum import *
from sympy.physics.quantum.pauli import *

In :
from sympy_quantum_utils import *

In :
eps, delta, theta, Hsym, t = symbols("epsilon, delta, theta, H, t")
Omega = symbols("Omega", positive=True)
n = 6

In :
sx, sy, sz = SigmaX(), SigmaY(), SigmaZ()


## Two-level system in its eigenbasis¶

Consider the Hamiltonian for a two-level quantum system on the form:

$$H = \frac{1}{2}\Delta\sigma_x + \frac{1}{2}\epsilon\sigma_z$$
In :
H = eps/2 * sz + delta/2 * sx

Eq(Hsym, H)

Out:
$$H = \frac{\delta {\sigma_x}}{2} + \frac{\epsilon {\sigma_z}}{2}$$

### Instantaneous eigenbasis¶

We can transform the Hamiltonian to the eigenbasis (where the Hamiltonian is diagonal, only containing a $\sigma_z$ term) by applying the unitary tranformation:

In :
U = exp(I * theta/2 * sy)

In :
hamiltonian_transformation_auto(U, sx)

Out:
$$\sin{\left (\theta \right )} {\sigma_z} + \cos{\left (\theta \right )} {\sigma_x}$$
In :
hamiltonian_transformation_auto(U, sz)

Out:
$$- \sin{\left (\theta \right )} {\sigma_x} + \cos{\left (\theta \right )} {\sigma_z}$$
In :
H1 = hamiltonian_transformation_auto(U, H)

H1

Out:
$$\frac{\delta}{2} \left(\sin{\left (\theta \right )} {\sigma_z} + \cos{\left (\theta \right )} {\sigma_x}\right) + \frac{\epsilon}{2} \left(- \sin{\left (\theta \right )} {\sigma_x} + \cos{\left (\theta \right )} {\sigma_z}\right)$$
In :
H4 = collect(H1, (sx, sz))

H4

Out:
$$\frac{\delta}{2} \left(\sin{\left (\theta \right )} {\sigma_z} + \cos{\left (\theta \right )} {\sigma_x}\right) + \frac{\epsilon}{2} \left(- \sin{\left (\theta \right )} {\sigma_x} + \cos{\left (\theta \right )} {\sigma_z}\right)$$

In the eigenbasis we require the coefficient of $\sigma_x$ to be zero, so we have the condition:

In :
c, o = split_coeff_operator(H4.args)

Eq(c, 0)

Out:
$$\frac{\delta}{2} \sin{\left (\theta \right )} + \frac{\epsilon}{2} \cos{\left (\theta \right )} = 0$$
In :
Eq(tan(theta), delta/eps)

Out:
$$\tan{\left (\theta \right )} = \frac{\delta}{\epsilon}$$
In :
eq = Eq(theta, atan(delta/eps))

eq

Out:
$$\theta = \operatorname{atan}{\left (\frac{\delta}{\epsilon} \right )}$$
In :
H5 = simplify(H4.subs(theta, atan(delta/eps)))

H5

Out:
$$\frac{\epsilon {\sigma_z}}{2} \sqrt{\frac{\delta^{2}}{\epsilon^{2}} + 1}$$

Now introduce $\Omega = \sqrt{\Delta^2 + \epsilon^2}$:

In :
powsimp(simplify(H5.subs(eps, sqrt(Omega ** 2-delta ** 2))), force=True)

Out:
$$\frac{\Omega {\sigma_z}}{2}$$

So we have reached the eigenbasis by applying the unitary transformation

In :
U

Out:
$$e^{\frac{i \theta}{2} {\sigma_y}}$$

with

In :
eq

Out:
$$\theta = \operatorname{atan}{\left (\frac{\delta}{\epsilon} \right )}$$

## Versions¶

In :
%reload_ext version_information

%version_information sympy

Out:
SoftwareVersion
Python3.4.0 (default, Apr 11 2014, 13:05:11) [GCC 4.8.2]
IPython3.0.0-dev
OSposix [linux]
sympy0.7.4.1-git
Sat Jun 07 16:27:37 2014 JST