Mathematica Asked by Bekaso on June 24, 2021
I am trying to get the Matrix form of the following Hamiltonian for a finite dimension of $hat a$
$$H = wc{hat a^dagger}hat a + wa{{{{hat sigma }_z}} over 2} + g({hat sigma _ – }{hat a^dagger} + hat a{hat sigma _ + }),$$
where ${hat a^dagger}, hat a$ are the creation and annihilation operators, ${hat sigma +}, {hat sigma _ – }$ are rising and lowring operators.
I used the following Mathematica code but I am not sure:
σx = PauliMatrix[1]; σy = PauliMatrix[2]; σz =
PauliMatrix[3]; σI = IdentityMatrix[2];
σp = 1/2 (σx + I*σy);
dim = 2;
Idim[dim_] := IdentityMatrix[dim, SparseArray];
a[dim_] :=
KroneckerProduct[Idim[2],
SparseArray[{Band[{1, 2}] -> Sqrt[Range[dim - 1]]}, {dim, dim}]]
adag[dim_] := ConjugateTranspose[a[dim]]
nhat[dim_] := ConjugateTranspose[a[dim]].a[dim];
sigmap[dim_] := KroneckerProduct[σp, Idim[dim]]
sigman[dim_] := ConjugateTranspose[sigmap[dim]]
HHc = ωc nhat[dim];
HHa = 1/2 ωa sigmap[dim].sigman[dim];
HHac = g (adag[dim].sigman[dim] + a[dim].sigmap[dim]);
HJC = HHa + HHc + HHac;
MatrixForm[HJC]
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP