Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

QuantumFramework

Tutorials

  • Bell's Theorem: CHSH inequality
  • Bosonic Operator Algebra
  • Circuit Diagram
  • Exploring Fundamentals of Quantum Theory
  • Getting Started
  • An IBM Quantum Error Map
  • Connecting to QPU Services
  • Quantum Machine Learning in Phase Space
  • Quantum object abstraction
  • Quantum Object Composition
  • Sending Queries to IBM QPUs
  • Tensor Network
  • Time Evolution
  • Fast Gates on a Transmon
  • Quantum Computation

Guides

  • Wolfram Quantum Computation Framework

Tech Notes

  • Quantum Optimization
  • Second Quantization Functions

Symbols

  • CliffordChannel
  • EinsteinSummation
  • GraphState
  • IBMJob
  • IBMJobSubmit
  • LocalComplement
  • PauliStabilizer
  • QiskitCircuit
  • QiskitTarget
  • QuantumBasis
  • QuantumChannel
  • QuantumCircuitMultiwayGraph [EXPERIMENTAL]
  • QuantumCircuitOperator
  • QuantumDistance
  • QuantumEntangledQ
  • QuantumEntanglementMonotone
  • QuantumEvolve
  • QuantumMeasurement
  • QuantumMeasurementOperator
  • QuantumMeasurementSimulation
  • QuantumMPS [EXPERIMENTAL]
  • QuantumOperator
  • QuantumPartialTrace
  • QuantumPhaseSpaceTransform
  • QuantumQASM
  • QuantumShortcut [EXPERIMENTAL]
  • QuantumSimilarity
  • QuantumStateEstimate [EXPERIMENTAL]
  • QuantumState
  • QuantumTensorProduct
  • QuantumWignerMICTransform [EXPERIMENTAL]
  • QuantumWignerTransform [EXPERIMENTAL]
  • QuditBasis
  • QuditName
  • StabilizerFrame
  • StabilizerStateQ

Bosonic Operator Algebra

Bosonic algebra functions
Ordered products
Details and options
Merging and braiding
Basic usage
Matrix elements
Ordering exponentials
From symbols to matrices
This tech note introduces the symbolic bosonic algebra of the QuantumFramework. The ladder operators
a
and
†
a
are treated as symbols obeying
[a,
†
a
]=1
, so ordering identities, exponentials of quadratic generators and their matrix elements come out exact, with no Fock-space truncation. A truncation can enter only at the end, when a symbolic result is required as a matrix.
Install and load the QuantumFramework paclet and the second-quantization sub-package (skip the install step if it is already available):
In[1]:=
PacletInstall["https://www.wolfr.am/DevWQCF",ForceVersionInstallTrue]
Out[1]=
PacletObject
Name: Wolfram/QuantumFramework
Version: 2.1.3

In[2]:=
<<Wolfram`QuantumFramework`​​<<Wolfram`QuantumFramework`SecondQuantization`

Bosonic algebra functions

Ladder variables and polynomials

FieldVariables
[ ]
Ladder variables
{{
†
a
},{a}}
of one mode;
FieldVariables
[{label₁, …}] gives one mode per label
BosonicNormalOrder
[expr, vars]
expr rewritten with every creator to the left of every annihilator
BosonicAntinormalOrder
[expr, vars]
expr rewritten with every annihilator to the left of every creator
BosonicVEV
[expr, vars]
Vacuum expectation value ⟨0|expr|0⟩
BosonicBCHTerms
[{A, B}, n, vars]
n-th order term of
log(
A
e
B
e
)
BosonicZassenhausTerms
[{A, B}, n, vars]
n-th term of the Zassenhaus factorization of
A+B
e

Exponentials

BosonicExpOrder
[expr, vars]
Product of exponentials of ladder operators brought into normal order
NormalOrdered
[expr, vars]
Normal-ordered product :expr:
AntinormalOrdered
[expr, vars]
Anti-normal-ordered product of expr
BosonicExpSimplify
[expr, vars]
Merges products of exponentials and functions of number operators
BosonicExpBraid
[expr, vars]
Moves the left exponential of a pair past the right one,
A
e
B
e
=
A
e
B
-A
e
e
A
e

Matrix elements and matrices

BosonicMatrixElement
[{m, n}, expr, vars]
Fock element ⟨m|expr|n⟩, several modes with {{m₁, …}, {n₁, …}}
BosonicMatrixElement
[{α, β}, expr, vars, "Basis" -> "Coherent"]
Coherent element ⟨α|expr|β⟩
ToBosonicOperator
[expr, vars, size]
expr realized as a QuantumOperator with each mode truncated to dimension size

Details and options

Declaring the ladder operators

{{
c
1
, …}, {
a
1
, …}}
Creators first, then annihilators, one entry per mode
{
a
1
, …}
Annihilators alone, the creators are their daggers
WeylAlgebra[…]
A Weyl algebra built elsewhere

Options

"Ordering" -> st
For
BosonicExpOrder
, st can be "Normal" (default), "Antinormal" or "Disentangled"
Assumptions -> assum
Assumptions on the coefficients, used to pick branches and simplify
TimeConstraint -> t
Seconds allowed for ordering (default 30); past it the input is returned unordered with a message
"Basis" -> "Coherent"
Matrix elements between coherent states instead of Fock states
Method -> "Blasiak"
BosonicNormalOrder
through the Blasiak closed-form formula instead of the default reduction

Ordering identities

Displacement
α
†
a
-
*
α
a
e
=
-
2
|α|
2
e
α
†
a
e
-
*
α
a
e
Number exponential
λ
†
a
a
e
=:
(
λ
e
-1)
†
a
a
e
:
Passive mode mixing
†
a
Wa
e
=:
†
a
(
W
e
-1)a
e
:
Gauss form ("Disentangled")
:
†
a
(M-1)a
e
:=
†
a
(logU)a
e
N
Λ
†
a
(logL)a
e
for
M=UΛL
,
U
upper and
L
lower unitriangular

Basic usage

Ladder variables

Ladder variables of one mode:
In[109]:=
FieldVariables[]
Out[109]=

†
a.
,{a.}
Two modes labeled 1 and 2:
In[110]:=
FieldVariables[{1,2}]
Out[110]=

†
a.1
,
†
a.2
,a.1,a.2
Name the one-mode variables used below:
In[111]:=
FieldVariablesd.,b.,c.
Out[111]=

†
d.
,
†
b.
,
†
c.
,d.,b.,c.
Name the one-mode variables used below:
In[112]:=
v={{ad},{a}}=FieldVariables[]
Out[112]=

†
a.
,{a.}

Normal and anti-normal order

The commutator leaves a c-number when
a
†
a
is brought into normal order:
In[113]:=
BosonicNormalOrder[a**ad,v]
Out[113]=
†
a.
**a.+1
Higher powers collect the combinatorial factors:
In[114]:=
BosonicNormalOrder
2
**
a
**
2
**
ad
,v
Out[114]=
2
**

†
a.

**
2
**
a.
+4
†
a.
**a.+2
Anti-normal order picks up the opposite sign:
In[115]:=
BosonicAntinormalOrder[ad**a,v]
Out[115]=
a.**
†
a.
-1
The Blasiak formula and the default reduction agree:
In[116]:=
Withw=
3
**
a
**
3
**
ad
,BosonicNormalOrder[w,v,Method"Blasiak"]===BosonicNormalOrder[w,v]
Out[116]=
True
Blasiak method can be specially useful for single long products with high exponents:
In[132]:=
BosonicNormalOrder
15
**

5
**
b.
**
5
**

†
b.


,
†
b.
,b.,Method"Blasiak"//Short[#,3]&
Out[132]//Short=
15407021574586368000000000000000+524781008815041011355687426038169600000000000000000
2
**

†
b.

**
2
**
b.
+72+
75
**

†
b.

**
75
**
b.
+7244150201393583650085273600000000000000000
†
b.
**b.

Vacuum expectation values

Vacuum expectation value of
a
†
a
:
In[133]:=
BosonicVEV[a**ad,v]
Out[133]=
1
The moments
〈0|
m
a
†m
a
|0〉=m!
check the algebra at every degree:
In[134]:=
FindSequenceFunctionTableBosonicVEV
m
**
a
**
m
**
ad
,v,{m,5},m
Out[134]=
m!

Baker-Campbell-Hausdorff and Zassenhaus

Second-order term of
log(
α
†
a
e
βa
e
)
:
In[135]:=
BosonicBCHTerms[{αad,βa},2,v]
Out[135]=
-
αβ
2
Second Zassenhaus term, with the opposite sign:

Ordering exponentials

One mode

Displacement operator in normal order:
An exponential of the number operator has no finite factorization, and comes back as a normal-ordered product:

Several modes

Two modes for the examples below:
Two-mode squeezer, with wings creating and annihilating pairs and a number middle:
Coupled evolution with unequal frequencies, a beam splitter and two-mode squeezing:

Anti-normal order

Displacement operator in anti-normal order, the Gaussian factor changes sign:

Disentangled form

Ordered products

Merging and braiding

A conjugation by a displacement shifts the mode:

Matrix elements

Fock basis

The displacement elements are Laguerre polynomials, also for a symbolic index:
Check against a truncated evolution with 22 levels per mode:

Coherent basis

Coherent amplitude of the two-mode squeezed vacuum:

Normal symbol

Traces

From symbols to matrices

Fully symbolic input is accepted:

© 2026 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com