# DensityMatrix

DensityMatrix(psi, OrbitalTable) creates the density matrix of psi $a^{\dagger}_{\tau}a^{\phantom{\dagger}}_{\tau'}$ for the orbitals included in orbitaltable. It returns a table.

## Input

• psi : Wavefunction
• OrbitalTable : Vector (table) of unsigned integers. Orbitals start at 0.

## Output

• rho : Matrix (Table of Tables) of reals of dimension #OrbitalTable

## Example

description text

### Input

DensityMatrix.Quanty
dofile("../definitions.Quanty")

print("For the wave-function")
print(psi1)
print("the density matrix is")
rho = DensityMatrix(psi1)
print(rho)
print("the density matrix of orbital 1 and 4 is (counting starts at 0)")
rho = DensityMatrix(psi1,{1,4})
print(rho)

### Result

DensityMatrix.out
For the wave-function

WaveFunction: Wave Function
QComplex         =          0 (Real==0 or Complex==1)
N                =          2 (Number of basis functions used to discribe psi)
NFermionic modes =          6 (Number of fermions in the one particle basis)
NBosonic modes   =          0 (Number of bosons in the one particle basis)

#      pre-factor         Determinant
1   9.486832980505E-01       100010
2   3.162277660168E-01       110000

the density matrix is
{ { 1 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0.1 , 0 , 0 , 0.3 , 0 } ,
{ 0 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0.3 , 0 , 0 , 0.9 , 0 } ,
{ 0 , 0 , 0 , 0 , 0 , 0 } }
the density matrix of orbital 1 and 4 is (counting starts at 0)
{ { 0.1 , 0.3 } ,
{ 0.3 , 0.9 } }