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
  • 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
  • Quantum Optimization
  • Second Quantization Functions
  • Sending Queries to IBM QPUs
  • Tensor Network
  • Time Evolution
  • Fast Gates on a Transmon
  • Quantum Computation

Guides

  • Wolfram Quantum Computation Framework

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

Quantum Computation

Basic quantum objects
Advanced quantum objects
Quantum computation is the use of quantum mechanical systems to perform computations. Wolfram quantum framework aims to simulate a wide range of quantum computations in the Wolfram Mathematica.

Basic quantum objects

QuantumBasis
basis vectors encoding quantum states and operators
QuantumState
quantum discrete state, defined by an association, a complex vector, or a density matrix
QuantumOperator
quantum discrete operator, defined by an association or a matrix representation
QuantumMeasurementOperator
quantum measurement operator, defined by a matrix, a collection of positive matrices (POVM) or an eigenbasis (projective)
QuantumMeasurement
description of possible measurement results, containing a probability distribution as well as possible quantum states after the measurement
Basic objects of discrete quantum mechanics.
A fundamental object in our framework is
QuantumBasis
. Quantum states and operators are defined with respect to a basis.
QuantumBasis
can be constructed for any number of qudits, with any dimensionality. There are also a set of named basis (e.g., PauliX or Bell) built-in into the quantum framework.
Define a quantum basis given dimensions (3x5):
In[1]:=
QuantumBasis
[{3,5}]
Define a quantum basis by an association:
In[2]:=
QuantumBasis
[0{1,1},1{1,-I}]
There are many named-basis built into the framework:
In[3]:=

QuantumBasis
["I"],
QuantumBasis
["Y"],
QuantumBasis
["Bell"],​​
QuantumBasis
["Dirac"],
QuantumBasis
["Schwinger"],​​
QuantumBasis
["Wigner"]
There are many properties that can be extracted from
QuantumBasis
object. For example:
In[4]:=
basis=
QuantumBasis
[3];​​Normal/@basis["ElementAssociation"]
QuantumBasis
supports cases with input and output:
In[5]:=
QuantumBasis
[{2},{3}]
In[6]:=
{#["Input"],#["Output"]}&@
QuantumBasis
[{2},{3}]
A quantum state is represented by
QuantumState
object and a quantum operator is represented by
QuantumOperator
.
Define a pure 2-dimensional quantum state (qubit) in Pauli-X basis:
In[7]:=
QuantumState
[{1,-I},"X"]
In[8]:=
%["Amplitudes"]
If the basis is not specified, the default is the computational basis:
In[9]:=
state=
QuantumState
["RandomPure"[3]];​​state["Formula"]
Many named states are available for easy access:
In[10]:=

QuantumState
["UniformSuperposition"],
QuantumState
["PsiPlus"],​​
QuantumState
["GHZ"]
We can also define a qubit state by specifying a Bloch vector:
In[11]:=
QuantumState
["BlochVector"[{.1,.2,.3}]]
Define a quantum operator by a matrix, basis, and order. The order is the information about which subsystems the operator would act on. For example order {1,2} means it would act on subsystem 1 and 2. If the basis is not specified, the default is the computational basis.
In[12]:=
QuantumOperator
["CNOT",{2,3},"XI"]
Define operator by names:
In[13]:=

QuantumOperator
["H",{2}],
QuantumOperator
["CNOT"],​​
QuantumOperator
["Toffoli"]
Extract properties of operator:
In[14]:=
operator=
QuantumOperator
["CNOT",{1,2}];​​operator["Table"]
In[15]:=
operator["HermitianQ"]
QuantumOperator
can operate on a
QuantumState
:
In[16]:=
QuantumOperator
["H"]
QuantumState
["0"]
In Wolfram quantum framework, a measurement is represented by
QuantumMeasurementOperator
and
QuantumMeasurement
.
Define a measurement operator on the 2nd qubit (in computational basis):
In[17]:=
QuantumMeasurementOperator
[{2}]
Define measurement operator by names:
In[18]:=
QuantumMeasurementOperator
["X"]​​
QuantumMeasurementOperator
["QBismSICPOVM"]
Define measurement operator by a
QuantumBasis
object (as an eigenbasis) and a list of eigenvalues:
In[19]:=
qmo=
QuantumMeasurementOperator
["Bell"{1,3,4,5}]
In[20]:=
qmo
QuantumState
[{1,3,0,I},"Bell"]["ProbabilityPlot",​​AspectRatio1/4]
Define a POVM measurement:
In[21]:=
povm=
QuantumMeasurementOperator
["TetrahedronSICPOVM"]
In[22]:=
povm
QuantumState
["RandomPure"]["Probabilities"]
When
QuantumMeasurementOperator
acts on
QuantumState
,
QuantumMeasurement
is generated:
In[23]:=
result=
QuantumMeasurementOperator
["X"]
QuantumState
[{0.2,0.6}]
In[24]:=
result["ProbabilityPlot",AspectRatio1/4]
There are two ways we can perform multiqubit measurements. The first method is sequential measurement:
In[25]:=
result1=
QuantumMeasurementOperator
[]
QuantumState
["RandomPure"[2]]
In[26]:=
result2=
QuantumMeasurementOperator
[{2}][result1]
In[27]:=
result2["ProbabilityPlot",AspectRatio1/4]
To define the state of non-interacting subsystem or to define local operations on composite system,
QuantumTensorProduct
is used. It can performs tensor product on bases, states, or operators.
Tensor product of states and bases:
In[28]:=
QuantumTensorProduct

QuantumState
["0"],
QuantumState
["1"]
In[29]:=
QuantumTensorProduct

QuantumBasis
["X"],
QuantumBasis
["Y"]
Tensor product of operators (
QuantumOperator
or
QuantumMeasurementOperator
):
In[30]:=
QuantumTensorProduct

QuantumOperator
["Z"],
QuantumOperator
["Z"]
In[31]:=
QuantumTensorProduct
​​
QuantumMeasurementOperator
["X"],
QuantumMeasurementOperator
["Y"]
The representation of quantum state and operator can be changed according to any basis transformation. Basis transformation is applicable to
QuantumState
,
QuantumOperator
, and
QuantumMeasurementOperator
as demonstrated below:
Basis change for a quantum state:
In[32]:=
QuantumState

QuantumState
["1"],"Y"
Basis change for a quantum operator:
In[33]:=
QuantumOperator

QuantumOperator
["X"],"Y"
One can do more operations on quantum operators and the result will be a QuantumOperator:
In[34]:=
op=Exp-Iϕ2
QuantumOperator
["X"]
In[35]:=
op
QuantumOperator
["RX"[ϕ]]//FullSimplify

Advanced quantum objects

QuantumCircuitOperator
quantum circuit as a list of quantum operations
QuantumPartialTrace
reduced state or reduced basis by tracing out subsystems
QuantumPartialTranspose
partial transposition of a quantum state or operator
QuantumDistance
distance between two quantum states
QuantumEntangledQ
check whether a quantum state is entangled
QuantumEntanglementMonotone
entanglement monotone that measures the entanglement of a quantum state
QuantumShortcut
label list of a given quantum circuit
Basic objects and operations in discrete quantum mechanics naturally lead to an application in quantum information and computation. Quantum Information is the study of information encoded in quantum systems. Meanwhile, quantum computation is the manipulation of quantum information to perform a computation.
In quantum information, it is often convenient to have a local state description of a multiqubit state. For instance, Alice and Bob shared a (possibly entangled) quantum state. But, since they are really far away from each other, they do not have access to each other state. In such scenario, Alice's description of her part of quantum state is described by a "reduced state" that can be obtained by
QuantumPartialTrace
operation.
Trace out the second subsystem in a two-qubit state:
In[36]:=
QuantumPartialTrace

QuantumState
["PsiPlus"],{2}
Partial trace can also be applied to
QuantumBasis
:
In[37]:=
QuantumPartialTrace

QuantumBasis
[2,2],{2}
Partial transpose is an operation defined for multiple subsystems state in which only a specific subsystem is transposed. For instance, if there are two subsystems, partial transpose with respect to the first subsystem is defined by a map
ρ
1
⊗
ρ
2

T
ρ
1
⊗
ρ
2
. Partial transpose operation is represented by
QuantumPartialTranspose
.
Example of partial transpose:
In[38]:=
QuantumPartialTranspose
QuantumState
["PsiPlus"],{2}
Checking whether a subsystem 1 and 3 is entangled in "W" state:
Measuring trace distance between a pure state and a mixed state:
Wolfram quantum framework also supports Schmidt decomposition and spectral decomposition.
Example of Schmidt decomposition:
Example of spectral decomposition:
Example for the construction of quantum circuit without measurement:
Add measurement into the circuit:
Decomposition of CNOT:
A quantum gate for the magic basis transformation (transforming 2 qubit computational basis to the Bell basis):

© 2026 Wolfram. All rights reserved.

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