This package is in active development and is not production ready. Feel free to reach out with suggestions/issues.
Documentation is under construction. See test.ipynb for LaTeX printing and more example usage.
using QFT
using Symbolics
@operator ScalarField a
@syms p qwhere a is the name of the operator and p and q are the momenta.
We can use these objects with
comm(a(p),a(q)')
normalorder(a(p) * a(q)')
a(p)'^2 * a(q)' * vacuum()
ℋ = E(q) * a(q)' * a(q)
integrate(ℋ * a(p)', q)which returns 2π*E(p)a_p^†|0⟩ otherwise.
We can define a custom commutation relation between operators in a field using a natural syntax with the @comm macro.
Note. To do this we need to
import QFT.commas the comm function will be overloaded with your custom relation.
Then,
@field YourField
@operators YourField b c
@comm [b(p), c(q)'] = f(p,q)for any f(p,q).
This defines the commutation relation such that the commutator is now given by
@syms k l
comm(b(k), c(l)') # returns f(k,l)where Julia has replaced p and q with k and l appropriately. Multiple indices are also supported with @comm [b(p,q), c(r,s)'] = f(p,q,r,s).