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

Q3mini

Guides

  • Fermionic Quantum Computation
  • Q3: Symbolic Quantum Simulation
  • Quantum Information Systems
  • Quantum Many-Body Systems
  • Quantum Spin Systems

Tech Notes

  • About Q3
  • Q3: Quick Start
  • Quantum Fourier Transform
  • Quantum Information Systems with Q3
  • Quantum Many-Body Systems with Q3
  • Quantum Operations
  • Quantum Spin Systems with Q3
  • Quantum States
  • Quantum Teleportation
  • Quick Quantum Computing with Q3

Symbols

  • Basis
  • Boson
  • Bra
  • CNOT
  • ControlledGate
  • ExpressionFor
  • Fermion
  • Heisenberg
  • Ket
  • Let
  • Majorana
  • Matrix
  • Multiply
  • NambuGreen
  • NambuHermitian
  • NambuMatrix
  • NambuUnitary
  • Pauli
  • Phase
  • QuantumCircuit
  • Qubit
  • Qudit
  • RandomWickCircuitSimulate
  • Rotation
  • Species
  • Spin
  • SWAP
  • WickCircuit
  • WickEntanglementEntropy
  • WickEntropy
  • WickGreenFunction
  • WickJump
  • WickLindbladSolve
  • WickLogarithmicNegativity
  • WickMeasurement
  • WickMonitor
  • WickMutualInformation
  • WickNonunitary
  • WickSimulate
  • WickState
  • WickUnitary

Overviews

  • The Postulates of Quantum Mechanics
  • Quantum Algorithms
  • Quantum Computation: Models
  • Quantum Computation: Overview
  • Quantum Error-Correction Codes
  • Quantum Information Theory
  • Quantum Noise and Decoherence
Quantum States
Pure States
Mixed States
The first postulate indicates the mathematical description of the state of a system. Recall that in classical mechanics, the state of a particle in motion is described by the simple values of its position and momentum (or, equivalently, velocity). In quantum mechanics, the description is formulated at two different levels depending on the physical situation.
See also Section 1.1 of the
Quantum Workbook (2022)
.
Ket
Represents a computational basis vector
Basis
Constructs a computational basis
Dyad
Dyadic product of state vectors
BlochSphere
A geometric representation of the two-dimensional Hilbert space for a singleq qubit
BlochVector
A point on or inside the Bloch sphere to represent a quantum state of a single qubit
SchmidtDecomposition
Returns the Schmid decomposition of a quantum state for a bi-partite system
PartialTrace
Partial trace over a part of the system
VonNeumannEntropy
Returns the von Neuman entropy of a quantum state
Multiply
Noncommutative multiplication
Matrix
Returns the matrix representation of a vecotr or an operator in the compputation basis
ExpressionFor
Constructs a ket or an operator expression from a matrix representation
Q3 functions related to what is discussed in this document.
Make sure that the
Q3: Symbolic Quantum Simulation
package is loaded to use the demonstrations in this documentation.
In[127]:=
Needs["QuantumMob`Q3`"]
Pure States
Postulate 1. The quantum state of a closed system is completely described by a state vector in the Hilbert space associated with the system.
The most common example of the state vector is a “wave function”—a member of the Hilbert space of square integrable functions—originally put forward by Schrödinger. Modern approaches associate an abstract vector space with the system, and the specific characters of the particular system are reflected in the choice of basis (see Appendix A.1). When the state is exactly known, the system is said to be in its pure state, and the above description is comprehensive. However, in many cases, it is difficult to know the exact state, and we thus need a more general description to be discussed in the next subsection.
This postulate immediately raises a mind-blowing question: What is the physical meaning of the state vector or its components in a given basis (or of the wave function)? Quantum mechanics has never offered a direct physical meaning of the state vector. Born (1926) proposed a partial resolution to the question and inspired the probabilistic interpretation of quantum mechanics, as formulated in Postulate 3 concerning measurement. This work awarded him the 1954 Nobel Prize in Physics.
Postulate 1 leaves another baffling question: Given a physical system, there is no general prescription to figure out the Hilbert space associated with it. While it is a rather technical question, it is nevertheless an important and serious one when trying to describe a new system (or a yet-to-be-understood system) quantum mechanically.
———
In[127]:=
Needs["QuantumMob`Q3`"]
For demonstration, consider a group of two-level quantum systems, indicated by the symbol S.
In[77]:=
Let[Qubit,S]
Different qubits can be specified by the flavor indices, the last of which has a special meaning (see the documentation of Qubit).
In[78]:=
{S[1,$],S[2,$]}​​S[{1,2},$]
Out[78]=
{
S
1
,
S
2
}
Out[79]=
{
S
1
,
S
2
}
The associated Hilbert space is two dimensional. For many functions dealing with qubits, the final index $ can be dropped.
In[80]:=
bs=Basis[S[1,$]]​​bs=Basis[S[1]]
Out[80]=

0
S
1
,
1
S
1

Out[81]=

0
S
1
,
1
S
1

Each state in the logical basis can also be specified manually.
In[84]:=
vec=Ket[S[1]1,S[2]0]
Out[84]=

1
S
1
0
S
2

In[85]:=
vec=Ket[{S[1],S[2]}{1,0}]
Out[85]=

1
S
1
0
S
2

A general quantum state of S[1,$] is a linear combination of the two basis states with two complex coefficients c[0] and c[1].
In[86]:=
Let[Complex,c]​​vec=Ket[S[1]0]c[0]+Ket[S[1]1]c[1]
Out[87]=
c
0

0
S
1
+
c
1

1
S
1


Bloch-Sphere Representation

For a qubit—an idealistic two-level quantum system—the Hilbert space is two-dimensional. A basis of two logical states |0⟩ and |1⟩ is assumed, and it is called the logical basis of the qubit.
A two-dimensional state vector is often visualized as a point, called a Bloch vector, on the Bloch sphere. The Bloch sphere is a geometrical representation of a two-dimensional vector space. Any state vector |ψ⟩ is expanded in the logical basis as
|ψ〉=|0〉
c
0
+|1〉
c
1
with
c
0
,
c
1
∈
. The normalization condition,

c
0
2
|
+
c
1
2
|
=1
, tells us that the state vector can be expressed up to a global phase factor by
|ψ〉=|0〉cos(θ/2)+|1〉sin(θ/2)
ϕ

with θ and ϕ respectively specifying the magnitude and phase, of the expansion coefficients (
θ,ϕ∈
). The Bloch vector associated with the state vector |ψ⟩ is defined by
b:=(sinθcosϕ,sinθsinϕ,cosθ)
.
This way, any state vector in a two-dimensional Hilbert space corresponds uniquely (up to a global phase factor) to a point on the sphere with unit radius, i.e., the Bloch sphere.
The Bloch vector can equivalently be obtained in terms of the expectation values of the Pauli operators,
b:=(〈
x
σ
〉,〈
y
σ
〉,〈
z
σ
〉)
.
Indeed, with |ψ⟩ in the above form, one can show that
〈
x
σ
〉=sinθcosϕ
,
〈
y
σ
〉=sinθsinϕ
,
〈
z
σ
〉=cosθ
.
An important point is that a state can be characterized by expectation values of the Pauli operators which are directly observed in experiments.
———
For demonstration, consider a state vector for a qubit.
In[128]:=
vec=Ket[S[1]0]Sqrt[2]-IKet[S[1]1]
Out[128]=
2

0
S
1
-
1
S
1

Convert it to the Bloch vector, i.e., the corresponding point on the Bloch sphere.
In[89]:=
pnt=BlochVector[vec]
Out[89]=
0,-
2
2
3
,
1
3

Now visualizes the Bloch vector by putting a mark on the Bloch sphere.
In[90]:=
BlochSphere[{Red,Bead[pnt]},ImageSizeSmall]
Out[90]=
Contents cannot be rendered at this time; please try again later or download this notebook for full functionality »

Entanglement

Many quantum systems, especially of many particles, are composed of several parts with independent degrees of freedom. For such a system, the overall Hilbert space is built up from the Hilbert spaces of individual parts by means of the tensor product. For example, consider a system of two parts and suppose that they are associated with the vector spaces V and W, respectively. The total Hilbert space is given by the tensor product
⊗
, which is defined to be the vector space spanned by the tensor-product basis

v
i
⊗
w
j
:i=0,1,2,…,m-1;j=0,1,2,…,n-1
,
where
{|
v
i
〉}
and

w
j

are bases of

and

of dimensions
m
and
n
, respectively. The dimension of
⊗
for the total system is obviously given by
mn
, and in general a state vector of the total system is a linear superposition consisting of
mn
terms
|Ψ〉=
m-1
∑
i=0
n-1
∑
j=0
|
v
i
〉⊗
w
j

c
ij
.
Some state vectors are factored into the form
(|
v
0
〉+|
v
1
〉+|
v
2
〉+⋯)⊗(|
w
0
〉+|
w
1
〉+|
w
2
〉+⋯)
.
Such a state is said to be separable. For example, the superposition of all the logical basis states of two qubits
|0〉⊗|0〉+|0〉⊗|1〉+|1〉⊗|0〉+|1〉⊗|1〉
.
is factored into
(|0〉+|1〉)⊗(|0〉+|1〉)
.
and is a separable state. On the other hand, the state
|0〉⊗|0〉+|0〉⊗|1〉+|1〉⊗|0〉
.
can never be factored. Such a state is said to be entangled.
The Schmidt decomposition is a systematic way to test whether a given quantum state |Ψ⟩ in a tensor-product space is separable or not. The Schmidt decomposition is a method to choose proper bases
{|
′
v
i
〉}
and

′
w
j

of

and

, respectively, to rewrite the given state vector |Ψ⟩ in the least number of terms of the form
For demonstration, consider the following state of a two-qubit state.
This gives the Schmidt decomposition of the state. It turns out that its Schmidt rank is two and the state is an entangled state.
SchmidtForm presents the Schmidt decomposition in a more intuitively-appealing form. For a thorough analysis of the result, use SchmidtDecomposition.
The Schmidt decomposition is incredibly complicated for such a simple-looking system. Let us take an approximation to get an impression of how the state is entangled.
Mixed States
One often encounters a situation where the state of a system is not completely known. In this case, the system is said to be in a mixed state. A common example is when the system is interacting with its surroundings.
Sometimes, it is convenient to describe the statistical mixture in terms of a set of unnormalized vectors
For demonstration, consider a density operator representing a statistical mixture of two pure states.
From the specifications of the ensemble, this constructs the density operator for the mixed state.
This gives the matrix representation -- the “density matrix” -- of the density operator in the logical basis.
This gives the expression of the density operator in terms of the Pauli operators.
as expected. The physical meaning of diagonal elements further implies several basic yet important properties of density operator:

Unitary Freedom in Mixture

It is also interesting to note that the density operator and the relevant physical properties do not depend on all the details in the specification of the statistical ensemble, which in some sense makes the description of mixed states in terms of the density operator so powerful and efficient.
For demonstration, consider a statistical mixture of the following three pure states.
These are the associated probabilities.
The mixed state is described by the density operator.
Next consider another set of pure states.
The associated probabilities are as following.
The mixture leads to the same density operator.
The two sets are related by the following unitary matrix

Bloch-Sphere Representation

Recall that two-dimensional pure states are visualized on a Bloch sphere. A mixed state ρˆ for a qubit can be similarly visualized, but in general the representing point resides inside the Bloch sphere. As for a pure state, the Bloch vector b corresponding to a mixed state ρ is defined by
Recalling that any operator on a two-dimensional vector space is a linear superposition of the Pauli operators, we decompose a density operator into the form
For demonstration, consider again the density operator discussed above.
Convert it to the Bloch vector, i.e., an Euclidean point inside the Bloch sphere.
Visualize the Bloch vector.

System+Environment Model

In this sense, taking a partial trace over a particular part of the total system physically corresponds to “ignoring” that part.

Purification

To construct a purification of a mixed state ρ, take the spectral decomposition,
Purification is not unique. Different purifications give rise to the same mixed state ρ,
as long as
A simple yet important aspect of the above observation is that when |Ψ⟩ of the total system is a separable state, |Ψ⟩ = |α⟩ ⊗ |β⟩, the reduced state
For demonstration, suppose that Suppose that two qubits are coupled and that the total system is in the following state. We can regard the first qubit as the “system” and the second as the “environment”.
The first qubit is in a mixed state. The density operator is given by the partial trace over the second qubit.
This is the matrix representation of the density operator in the logical basis.
A purification is a pure state of an extended system composed of the “system” and the “environment”. Here S[2,$] is regarded as the environment.
As purification is not unique, the above purification is not the same as the total state above. However, upon tracing out the environmental degrees of freedom, the purification reproduces the density operator.

Von Neumann Entropy

The von Neumann entropy offers a far more general way to characterize a mixed state ρ. The von Neumann entropy of a density operator ρ is defined by
For demonstration, consider again the same density operator discussed above.
Calculate the von Neumann entropy of the mixed state.

Separability of Mixed States

As an object describing a mixed state, one can ask whether a density operator is separable or not. Consider a system consisting of two subsystems A and B. A density operator ρ (and the associated mixed state) is said to be separable if it can be written as a convex linear combination
Unlike pure states, for which the Schmidt decomposition provides a simple test of entanglement, it is generally hard to tell whether a given mixed state is separable or entangled, and this remains an open question.

© 2025 Wolfram. All rights reserved.

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