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

  • Getting Started

Guides

  • Wolfram Quantum Computation Framework

Tech Notes

  • Bell's Theorem
  • Circuit Diagram
  • Exploring Fundamentals of Quantum Theory
  • Quantum object abstraction
  • Quantum Optimization
  • Second Quantization Functions
  • Tensor Network
  • Quantum Computation

Symbols

  • QuantumBasis
  • QuantumChannel
  • QuantumCircuitMultiwayGraph [EXPERIMENTAL]
  • QuantumCircuitOperator
  • QuantumDistance
  • QuantumEntangledQ
  • QuantumEntanglementMonotone
  • QuantumEvolve
  • QuantumMeasurement
  • QuantumMeasurementOperator
  • QuantumMeasurementSimulation
  • QuantumMPS [EXPERIMENTAL]
  • QuantumOperator
  • QuantumPartialTrace
  • QuantumPhaseSpaceTransform
  • QuantumShortcut [EXPERIMENTAL]
  • QuantumStateEstimate [EXPERIMENTAL]
  • QuantumState
  • QuantumTensorProduct
  • QuantumWignerMICTransform [EXPERIMENTAL]
  • QuantumWignerTransform [EXPERIMENTAL]
  • QuditBasis
  • QuditName
Second Quantization Functions
Core Functions
Quasi-probability Representations
In this Tech Note, we present the implementation of second quantization for bosons within the QuantumFramework, utilizing a truncated Fock space. This approach enables simple manipulation and representation of quantum states, which are essential for a wide range of calculations. By leveraging the core features of the QuantumFramework, we simplify the process of working with common quantum states and operators, facilitating diverse computational tasks in fundamental quantum mechanics and quantum optics.
In[4]:=
<<Wolfram`QuantumFramework`​​<<Wolfram`QuantumFramework`SecondQuantization`

Core Functions

Fock space size and utilities

SetFockSpaceSize
[size]
sets size as the default truncation dimension , after called all the other definitions can use this default size
Commutator
[op1,op2]
Commutator of two operators
OperatorVariance
[ψ,op]
Variance of the operator op for a state ψ

States

FockState
[
n
,size]
n-th Fock state with truncation dimension size
CoherentState
[size]​​
CoherentState
[size][α]
parametric state representing a non-normalized coherent state in a truncated basis of dimension size
ThermalState
[nbar,size]
thermal mixed state with average number of photons nbar in a truncated basis of dimension size
CatState
[size]​​
CatState
[size][α,ϕ]
parametric general cat state representing a superposition of coherent states in a basis of dimension size, the complex amplitude and the phase can be supplied

Operators

AnnihilationOperator
[size]
bosonic annihilation operator in a truncated Fock space with specified size
DisplacementOperator
[α,size]
phase space displacement operator of dimension size with complex displacement amplitude alpha
SqueezeOperator
[ξ,size]
squeeze operator with complex parameter xi of dimension size
QuadratureOperators
[size]
returns
X
1
and
X
2
position and momentum quadrature operators with dimension size
We will briefly demonstrate how to apply all these functions in Wolfram quantum framework.

Ordering Option

Displacement and squeeze operators can have different definitions based on operator ordering. We include the "Ordering" option to specify the order (weak , normal or anti normal ). Theoretically in a infinite dimensional space they are all equivalent , but in a truncated space these operators have numerical error, and depending on the calculation some choice of ordering can be more accurate.

Examples

Setting the space size

Set the default size to 20:
In[4]:=
SetFockSpaceSize[20];
In[4]:=
AnnihilationOperator[]
Out[4]=
QuantumOperator
Pure map
​
Dimension: 20→20
Order: {1}→{1}

Creation operator and Fock states
Define creation operator just taking the adjoint of the annihilation operator with "Dagger" property or SuperDagger:
In[5]:=
a=AnnihilationOperator[];​​
†
a
@FockState[1]//TraditionalForm
Out[6]//TraditionalForm=
2
|2〉
Coherent state
Create a symbolic coherent state of default size:
In[7]:=
CoherentState[][β]//TraditionalForm
Out[7]//TraditionalForm=
|0〉+β|1〉+
2
β
2
|2〉+
3
β
6
|3〉+
4
β
2
6
|4〉+
5
β
2
30
|5〉+
6
β
12
5
|6〉+
7
β
12
35
|7〉+
8
β
24
70
|8〉+
9
β
72
70
|9〉+
10
β
720
7
|10〉+
11
β
720
77
|11〉+
12
β
1440
231
|12〉
+
13
β
1440
3003
|13〉+
14
β
10080
858
|14〉+
15
β
30240
1430
|15〉+
16
β
120960
1430
|16〉+
17
β
120960
24310
|17〉+
18
β
725760
12155
|18〉+
19
β
725760
230945
|19
〉
Visualize photon distribution of a coherent state with
α=1.3+2
:
In[120]:=
CoherentState[25][1.3+2]["Normalize"]["ProbabilityPlot",LabelStyle6,AspectRatio1/4]
Out[120]=

Cat State

Create a cat state
|α〉+
ϕ

|-α〉
of amplitude
α=2+
and
ϕ=3π/4
:
In[115]:=
CatState[25][2+,3π/4]
Out[115]=
QuantumState
Pure state
Qudits: 1
Type: Vector
Dimension: 25

In[122]:=
CatState[25][2+,3π/4]["ProbabilityPlot",LabelStyle6,AspectRatio1/4]
Out[122]=
Displacement operator
Create displacement operator of size 40 with amplitude 3+ :
In[134]:=
α=3+;
In[132]:=
DisplacementOperator[α,40]
Out[132]=
QuantumOperator

Pure map
​
Dimension: 40→40
Order: {1}→{1}
Data not saved. Save now

In[133]:=
DisplacementOperator[α,40][]CoherentState[40][α]
Out[133]=
True
Options
By default when "Ordering" is not specified normal ordering is used, the formulas of the three orders are shown below:
DisplacementOperator
[..,"Ordering"st]
st can be "Normal", "Weak" or "Antinormal".​​​​For "Normal", one gets:​​
Exp[-|α
2
|
/2]Exp[α
†
a
]Exp[-αa]
​​​​For "Weak", one gets:​​
Exp[α
†
a
-αa]
​​​​For "Antinormal", one gets:​​
Exp[|α
2
|
/2]Exp[-αa]Exp[α
†
a
]
Verify displacement operator is unitary using "UnitaryQ" for
α=
, for this task testing with weak ordering is more accurate
In[3]:=
DisplacementOperator[1.]["UnitaryQ"]
Out[3]=
False
In[4]:=
DisplacementOperator[1.,"Ordering""Weak"]["UnitaryQ"]
Out[4]=
True
Squeeze operator
Create squeeze operator of default size with complex parameter 1+:
In[12]:=
SqueezeOperator[1.+]
Out[12]=
QuantumOperator
Pure map
​
Dimension: 20→20
Order: {1}→{1}

Options
By default when "Ordering" is not specified normal ordering is used, the formulas of the three orders are shown below:
SqueezeOperator
[…,"Ordering"st]
st
can be "Normal", "Antinormal" or "Weak". Given
ξ=
θ
r
​for "Normal", one gets:​
Exp[-
1
2
θ

Tanh[r]
†2
a
]Exp[-Log[Cosh[r]](
†
a
a+
1
2
)]Exp[
1
2
-θ

Tanh[r]
2
a
]
​​For "Weak", one gets:​
Exp[
1
2
(ξ
2
a
-ξ
†2
a
)]
​​For "Antinormal", one gets:​
Exp[
1
2
-θ

Tanh[r]
2
a
]Exp[Log[Cosh[r]](
†
a
a+
1
2
)]Exp[-
1
2
θ

Tanh[r]
†2
a
]
OperatorVariance
Calculate the variance of the quadrature operators for the ground state:
Commutator

Quasi-probability Representations

Two phase space quasi-probability representations are included Wigner and HusimiQ , which are used extensively in quantum mechanics and quantum optics. These are calculated numerically in a grid of phase space points. Glauber representation is not included because for a general state is not feasible to implement a numerical algorithm , due to the singularities of this representation.
We will briefly demonstrate how to apply all these functions in Wolfram quantum framework.

Examples

WignerRepresentation
Calculate the Wigner representation for the ground state:
Options
HusimiQRepresentation

© 2025 Wolfram. All rights reserved.

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