Some linear algebra for QIPC

Questions 1

Density Matrix for thermal state

A harmonic oscillator is desribed by the Hamiltonian H=(Subscript[ω, r])(SuperDagger[a]).a = (Subscript[ω, r]) n, where (a^((†)))denotes the operator annihilating (creating)  an energy quantum, and n denotes the operator for the number of energy quanta, that is n|0⟩=0, n|1⟩=1,n|2⟩=2,... 
Find the density operator that describes the state of the harmonic oscillator, which  is  in thermal equilibrium with a heat bath at temperature T.

<<PhysicalConstants`

hbar=PlanckConstant/Joule/Second;
kb=BoltzmannConstant/Joule Kelvin;

P[n_,T_,ω_]:=(1-Exp[- ((ℏ ω)/(kB T))])Exp[-((n ℏ ω)/(kB T))]

P[0,0.1,(10^9)2π]/.{ℏ->hbar,kB->kb}

Sum[P[n,T,ω]n,{n,0,∞}]//Simplify

probs=Table[Tooltip[P[n,temp,(10^9)2π]/.{ℏ->hbar,kB->kb},ToString[temp]],{temp,100,500,100}];

Plot[probs,{n,0,1000},PlotRange->{0,0.003},Frame->True,FrameLabel->{"n","(Subscript[p, ω])(n)"},BaseStyle->{FontSize->14}]

ρthermal[T_,nmax_,ω_]:=DiagonalMatrix[Table[P[n,T,ω],{n,1,nmax}]]

ρthermal[300,100,(10^9)2π]/.{ℏ->hbar,kB->kb}//Tr

Wrong Normalization!

ρthermal2[T_,nmax_,ω_]:=DiagonalMatrix[Table[Exp[ ((-n ℏω)/(kB T))],{n,0,nmax}]/Sum[Exp[ ((-n ℏω)/(kB T))],{n,0,nmax}]]

ρthermal2[300,100,(10^9)2π]/.{ℏ->hbar,kB->kb}//Tr

<<BarCharts`

BarChart3D[ρthermal2[1,20,(10^9)2π]/.{ℏ->hbar,kB->kb},BarStyle->{Opacity[0.7],Red},PlotRange->All]

Typical temperatures and frequencies in experiments with superconducting quantum circuits coupled to a harmonic oscillator (microwave resonator) are about 20mK and the typical frequencies are ν=6GHz:

BarChart3D[ρthermal2[0.02,20,6 (10^9)2π]/.{ℏ->hbar,kB->kb},BarStyle->{Opacity[0.7],Red},PlotRange->All]

Decomposition of a density matrix

An experimental setup produces  spin-1/2 particles polarized either in the state | ↑⟩  or in the state |↓⟩ with equal probability. A different experimental setup produces also spin-1/2 particles but this time polarized either in the state |+⟩  =(| ↑⟩  +| ↑⟩)/(Sqrt[2]) or in the state |-⟩  = (| ↑⟩ - | ↑⟩)/(Sqrt[2]). Can you find a measurement which can distinguish between these two setups?

Unitary Evolution of States

Some Functions  and Definitions:

(* general pure state in polar coordinates *)
State[θ_,ϕ_]:={Cos[θ/2],Sin[θ/2]Exp[I ϕ]}
(*normalized state with real first argument *)
StateNorm[x_List]:=Module[{arg1=Arg[x[[1]]],arg2=Arg[x[[2]]],normx=x/Norm[x],θ,ϕ},
θ=2Chop@ArcCos[normx[[1]]Exp[-I arg1]];
ϕ=Mod[arg2-arg1,2π];
{Cos[θ/2],Sin[θ/2]Exp[I ϕ]}]
(* outputs the polar coordinate from a state vector *)
blochcoord[state_]:=Module[{arg1=Arg[state[[1]]],arg2=Arg[state[[2]]],normx=state/Norm[state],θ,ϕ},
θ=Abs[2Chop@ArcCos[normx[[1]]Exp[-I arg1]]];
ϕ=Abs@Mod[arg2-arg1,2π];
{θ,ϕ}]

(* define a bloch sphere graph *)
With[{r=1},xy=ParametricPlot3D[{r Cos[θ],r Sin[θ],0},{θ,0,2 π},PlotStyle->Dashed,Boxed->False,Axes->False];
yz=ParametricPlot3D[{0,r Cos[θ],r Sin[θ]},{θ,0,2 π},PlotStyle->Dashed,Boxed->False,Axes->False];
xz=ParametricPlot3D[{r Cos[θ],0,r Sin[θ]},{θ,0,2 π},PlotStyle->Dashed,Boxed->False,Axes->False];
bloch=Show[Graphics3D[{Green,Opacity[.25],Sphere[{0,0,0},r],Opacity[1],Black,Thick,Line[{{0,r,0},{0,-r,0}}],Line[{{0,0,r},{0,0,-r}}],Line[{{r,0,0},{-r,0,0}}],Text[Style["z+",FontSize->16,FontWeight->Bold,FontColor->GrayLevel[.3]],{0,0,1.3 r}],Text[Style["z-",FontSize->16,FontWeight->Bold,FontColor->GrayLevel[.3]],{0,0,-1.3 r}],Text[Style["x+",FontSize->16,FontWeight->Bold,FontColor->GrayLevel[.3]],{1.3 r,0,0}],Text[Style["x-",FontSize->16,FontWeight->Bold,FontColor->GrayLevel[.3]],{-1.3 r,0,0}],Text[Style["y+",FontSize->16,FontWeight->Bold,FontColor->GrayLevel[.3]],{0,1.3 r,0}],Text[Style["y-",FontSize->16,FontWeight->Bold,FontColor->GrayLevel[.3]],{0,-1.3 r,0}]}],xy,xz,yz,Boxed->False]];
(* generate vector for bloch sphere representation *)
Options[blochvec]={color->Blue};
blochvec[{θ_,ϕ_},OptionsPattern[]]:=Graphics3D[{OptionValue[color],Thickness[0.02],Line[{{0,0,0},{Sin[θ]Cos[ϕ],Sin[θ]Sin[ϕ],Cos[θ]}}]}]

(* draw vector for bloch sphere taking an arbitrary pure input state *)
blochvecstate[state_]:=blochvec@blochcoord[state]
(*bloch vector for mixed states *)
blochvecmsphere[r_,θ_,ϕ_]:=Graphics3D[{Blue,Thickness[0.02],Line[{{0,0,0},r{Sin[θ]Cos[ϕ],Sin[θ]Sin[ϕ],Cos[θ]}}]}]
blochvecmsphere[{r_,θ_,ϕ_}]:=blochvec[r,θ,ϕ]
(* cartesian coordinates *)
blochvecmcart[x_,y_,z_]:=Graphics3D[{Blue,Thickness[0.02],Line[{{0,0,0},{x,y,z}}]}]
blochvecmcart[{x_,y_,z_}]:=blochvecmcart[x,y,z]
(* show vector with sphere *)
vectoronsphere[vec_]:=Show[bloch,vec,SphericalRegion->True]
(* Bloch-sphere coordinates from arbitrary state *)
MatrixToBloch[x_]:={Tr[σx.x],Tr[σy.x],Tr[σz.x]}

id=(({{1, 0}, {0, 1}}));σx=(({{0, 1}, {1, 0}}));σy=(({{0, -I}, {I, 0}}));σz=(({{1, 0}, {0, -1}}));
tps[x_]:=Outer[Times,Conjugate[x],x]
tps[x_,y_]:=Outer[Times,Conjugate[x],y]
(* groundstate *) 
gs={1,0};
(* excited state *)
es={0,1};
(* superpositions state *)
xps={1,1}/(Sqrt[2]);
xms={1,-1}/(Sqrt[2]);
yps={1,I}/(Sqrt[2]);
yms={1,-I}/(Sqrt[2]);

Arbitrary unitary evolution can be written as

U=(e^(-iHt))with H any Hermitian matrix.
Any Hermitian matrix can be parametrized by H=id+a(Subscript[σ, x])+b(Subscript[σ, y])+c(Subscript[σ, z]).
Since[id,(Subscript[σ, i])]=0wecanfactorizetheexponentialandneglectthephasefactor(e^(-iidt)).
U=(e^(-in.σ((αt)/2)))withn={a,b,c}/(Sqrt[(a^2)+(b^2)+(c^2)])andα=2(Sqrt[(a^2)+(b^2)+(c^2)]).
n can be written in polar coordinates as n={sinθ cosϕ,sinθ sinϕ,cosθ}.

The unitary matrix can be calculated either by using MatrixExp:

H[θ_,ϕ_,α_]:= (α/2)(Sin[θ]Cos[ϕ] σx+Sin[θ]Sin[ϕ]σy+Cos[θ]σz)

MatrixExp[-I H[0,0,1]t]

Or by the following considerations :

MatrixExp[-I α (t/2)(Cos[θ]σz +Sin[θ]Cos[ϕ]σx+Sin[θ]Sin[ϕ]σy)]//FullSimplify

Urot[α_,t_,θ_,ϕ_]:=(({{Cos[α t/2] - I Cos[θ]Sin[α t /2], -I Exp[-I ϕ] Sin[θ] Sin[α t/2]}, {(-I Exp[I ϕ]) Sin[θ] Sin[α t/2], Cos[α t/2] + I Cos[θ]Sin[α t /2]}}))

Urot[α,t,θ,ϕ].Urot[α,t,θ,ϕ]\[ConjugateTranspose]//FullSimplify[#,Assumptions->{α∈Reals,t∈Reals,ϕ ∈ Reals,θ∈Reals}]&

RX[α_,t_]:=Urot[α,t,π/2,0]
RY[α_,t_]:=Urot[α,t,π/2,π/2]
RZ[α_,t_]:=Urot[α,t,0,0]

Animate[vectoronsphere@blochvecstate[(RX[π/2,t].{1,0})],{t,0,4-.1,0.1}]

Animate[vectoronsphere@blochvecstate[(RY[π/2,t].{1,0})],{t,0,4-.1,0.1}]

Free Evolution

H =  -((ℏΩ)/2) σz

Animate[vectoronsphere@blochvecstate[(RZ[1,t].{1,0})],{t,0,4-0.1,0.1}]

Nothing happens because the system is in an eigenstate of the Hamiltonian.

Animate[vectoronsphere@blochvecstate@(RZ[2π,t].{1/(Sqrt[2]),1/(Sqrt[2])}),{t,0,1-0.03,0.03}]

RZ[Ω,t]//TrigToExp//MatrixForm

System precesses with Larmorfrequency about the z - axis.

Time - dependent Hamiltonian :

Things get more complicated since the exponentiation does not work anymore.

Degree of Mixedness does not change by a unitary transformation

ρ=1/8tps[gs]+7/8tps[es]

Animate[vectoronsphere@blochvecmcart@MatrixToBloch[RX[2π,t].ρ.RX[2π,t]\[ConjugateTranspose]],{t,0,1}]

Tr[Urot[α,t,θ,ϕ].ρ.Urot[α,t,θ,ϕ]\[ConjugateTranspose]]//FullSimplify[#,Assumptions->{t∈Reals,ϕ∈Reals,θ∈Reals,α∈Reals}]&

Non - Unitary evoution is needed in order to change the degree of mixedness (Outlook : Master - Equations, multi - qubit systems)

Measurement along an arbitrary axis :

A test whether the system is in the ground state yields either yes (0) or no (1). The measurement corresponding to this test is represented by the operator | 0⟩ ⟨0 | . The complementary operator is  | 1⟩ ⟨1 | . But we can also test whether the system is in the state a | 0⟩+ b | 1⟩ by choosing another set of operators (choosing another basis).

(Subscript[P, ±n])=(1/2)(1±(OverVector[n]).(OverVector[σ]))

Pp[θ_,ϕ_]:=(1/2)((({{1, 0}, {0, 1}}))+{Sin[θ]Cos[ϕ],Sin[θ]Sin[ϕ],Cos[θ]}.{σx,σy,σz})
Pm[θ_,ϕ_]:=(1/2)((({{1, 0}, {0, 1}}))-{Sin[θ]Cos[ϕ],Sin[θ]Sin[ϕ],Cos[θ]}.{σx,σy,σz})

Pp[θ,ϕ]//MatrixForm
Pm[θ,ϕ]//MatrixForm

Pp[θ,ϕ].Pp[θ,ϕ]==Pp[θ,ϕ]//Simplify
Pm[θ,ϕ].Pm[θ,ϕ]==Pm[θ,ϕ]//Simplify

Probability to get outcome + 1 when measuring the state | 0⟩ along the axis θ:

gs.Pp[θ,0].gs//FullSimplify

In optics this is called  Malus' law.

Plot[gs.Pp[θ,0].gs,{θ,0,2π},Frame->True,FrameLabel->{θ,"<P>"},BaseStyle->{FontSize->14}]

Pp[θ,0].gs/(Cos[θ/2])//FullSimplify

Sin[θ]/Cos[θ/2]//FullSimplify

State tomography

What measurements do we need to determine all coefficients of the state?

We need some operator which determines the off - diagonal terms, e.g.  the operator (Subscript[P, x+])=1/2(| 0 + 1⟩ ⟨0 + 1 |)!

If we know that the state is normalized (which we have eventually have to check experimentally) we need just another measurement to determine the pure state completely!

Questions 2

Show that the order of unitary operation matters, i.e. that Rx.Ry| ψ⟩ ≠Ry.Rx | ψ⟩! When does the equality hold?

How many measurements are needed get full information about a mixed qubit state? Can you think of a set of proper measurements?