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

  • Circuit Diagram
  • Exploring Fundamentals of Quantum Theory
  • Quantum object abstraction
  • Tensor Network

Symbols

  • QuantumBasis
  • QuantumChannel
  • QuantumCircuitMultiwayGraph[EXPERIMENTAL]
  • QuantumCircuitOperator
  • QuantumDistance
  • QuantumEntangledQ
  • QuantumEntanglementMonotone
  • QuantumEvolve
  • QuantumMeasurement
  • QuantumMeasurementOperator
  • QuantumMeasurementSimulation
  • QuantumMPS [EXPERIMENTAL]
  • QuantumOperator
  • QuantumPartialTrace
  • QuantumShortcut [EXPERIMENTAL]
  • QuantumStateEstimate [EXPERIMENTAL]
  • QuantumState
  • QuantumTensorProduct
  • QuantumWignerTransform
  • QuditBasis
  • QuditName
Wolfram`QuantumFramework`
QuantumState
​
QuantumState
[qs,qb]
represents a quantum state specified by the state vector or density matrix
qs
, in the quantum basis
qb
.
​
​
QuantumState
[qs]
represents a quantum state specified by the state vector or density matrix
qs
, in the computational basis.
​
​
QuantumState
[asso,qb]
represents a quantum state specified by the association
asso
, in the quantum basis
qb
.
​
​
QuantumState
["name"]
represents the named quantum state identified by
name
.
​
​
QuantumState
[QuantumState[...,qb1],qb2]
changes the basis from the quantum basis
qb1
to
qb2
.
​
Details and Options

Examples  
(27)
Basic Examples  
(6)
Pure states can be defined by inputting state vectors, given a basis:
In[1]:=
ψ=
QuantumState
[{α,β},2]
Out[1]=
QuantumState
StateType: Vector
Qudits: 1
Type: Pure
Dimension: 2
Picture: Schrödinger
​

The first argument is the state vector and the second argument specifies the dimension of basis (which is computational). The default basis is the computational basis, unless specified otherwise. With no basis info, the basis is set by default as a
n
2
-dimensional computational basis.
In[2]:=
QuantumState
[{α,β},2]
QuantumState
[{α,β}]
Out[2]=
True
Return amplitudes:
In[3]:=
ψ["Amplitudes"]
Out[3]=
|0〉α,|1〉β
Return formula of the state:
In[4]:=
ψ["Formula"]
Out[4]=
α|0〉+β|1〉
​
Define a 2-qubit state (2D⊗2D Hilbert space):
In[1]:=
ψ=
QuantumState
[{3,2,5,1}]
Out[1]=
QuantumState
Pure state
Qudits: 2
Type: Vector
Dimension: 4
Picture: Schrödinger
​

Return qudits dimensions:
In[2]:=
ψ["Dimensions"]
Out[2]=
{2,2}
Again, note that the basis info can be given explicitly too.
In[3]:=
QuantumState
[{3,2,5,1}]
QuantumState
[{3,2,5,1},{2,2}]
Out[3]=
True
​
Specify the dimension of qudit as 3D:
In[1]:=
ψ=
QuantumState
[{1,2+1,3},3]
Out[1]=
QuantumState
StateType: Vector
Qudits: 1
Type: Pure
Dimension: 3
Picture: Schrödinger
​

Return qudits dimensions:
In[2]:=
ψ["Dimensions"]
Out[2]=
{3}
Note if no basis info is provided, the state vector will be padded to right by zeroes to reach the first
n
2
-dimensional space
In[3]:=
QuantumState
[{1,2+1,3}]["StateVector"]//Normal
Out[3]=
{1,1+2,3,0}
In[4]:=
QuantumState
[{1,2+1,3}]["Dimensions"]
Out[4]=
{2,2}
​
A built-in state:
In[1]:=
ψ=
QuantumState
["PhiMinus"]
Out[1]=
QuantumState
StateType: Vector
Qudits: 2
Type: Pure
Dimension: 4
Picture: Schrödinger
​

Return amplitudes:
In[2]:=
ψ["Formula"]
Out[2]=
|00〉
2
-
|11〉
2
​
One can define a state in a given basis. A state in 4D Schwinger basis:
In[1]:=
ψ=
QuantumState
{1,2,3},
QuantumBasis
[{"Schwinger",3}]
Out[1]=
QuantumState
StateType: Vector
Qudits: 1
Type: Pure
Dimension: 9
Picture: Schrödinger
​

Return amplitudes:
In[2]:=
ψ["Formula"]
Out[2]=
|
S
00
〉+2|
S
01
〉+3|
S
02
〉
​
States (pure or mixed) can be also defined by matrices.
Define a generic Bloch vector:
In[1]:=
mat[r_]/;VectorQ[r]:=1/2(IdentityMatrix[2]+r.Table[PauliMatrix[i],{i,3}])
A mixed state:
In[2]:=
r={.1,.1,0};​​state=
QuantumState
[mat[r]]
Out[2]=
QuantumState
Mixed state
Qudits: 1
Type: Matrix
Dimension: 2
Picture: Schrödinger
​

Test if it is mixed:
In[3]:=
state["MixedStateQ"]
Out[3]=
True
Calculate Von Neumann Entropy:
In[4]:=
state["VonNeumannEntropy"]
Out[4]=
0.985525
b
Purity:
In[5]:=
state["Purity"]
Out[5]=
0.51
A pure state:
In[6]:=
state2=
QuantumState
[mat[Normalize@r]]
Out[6]=
QuantumState
Pure state
Qudits: 1
Type: Matrix
Dimension: 2
Picture: Schrödinger
​

Purity:
Calculate Bloch Spherical Coordinates:
Note the Bloch vector can be given directly, too.

© 2025 Wolfram. All rights reserved.

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