BosonStrings
Normal ordered strings of bosonic operators in Julia.
Installation
] add https://github.com/nicolasloizeau/BosonStrings.jl
Getting started
Algebra
Compute $a_{1}^{\dagger 1} a_{1}^1 \cdot a_{1}^{\dagger 2} a_{1}^2$
using BosonStrings
o1 = Operator(1)
o1 += 1, (1, 1, 1)
o2 = Operator(1)
o2 += 1, (1, 2, 2)
o = o1 * o2
println(o)
julia> o
(1.0 + 0.0im) (†3)(3)
(2.0 + 0.0im) (†2)(2)
we get $a_{1}^{\dagger 1} a_{1}^1 \cdot a_{1}^{\dagger 2} a_{1}^2 = a_{1}^{\dagger 3} a_{1}^3 + 2a_{1}^{\dagger 2} a_{1}^2$
Expectation values with Fock States
Compute $\langle 2 |o| 2 \rangle$:
julia> inner(2, o, 2)
4.0 + 0.0im