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

QuantumPlaybook

Guides

  • QuantumPlaybook

Tech Notes

  • Addition of Numbers
  • Baker-Hausdorff Lemma
  • Chiral Fermion Random Circuit
  • Clifford Operators: How to Test
  • Commutation Relations for Qubits
  • Entanglement Distillation
  • Generalized Pauli Operators: Implementation
  • Hatano-Nelson-Kitaev Model: Monte Carlo Simulation
  • Hatano-Nelson Model: Monte Carlo Simulation
  • Kitaev Chain
  • Kitaev Random Circuit
  • Λ-Matter in a Cavity
  • Measurement of Total Pauli Z
  • Non-Unitary Dynamics of Quantum States
  • Partial Trace: Physical Meaning
  • Quantum Dot Systems
  • A Quantum Playbook
  • Magnetic Exchange Coupling
  • Solovay-Kitaev Algorithm
  • Spin Code
  • Symmetry Effects On Quantum Master Equations
  • Transmon: Quantum Phase Model
  • Transposition as a Supermap
  • Variational Quantum Classifier: Iris
  • Variational Quantum Classifier: Parity
  • Variational Quantum Eigensolver: Transverse-Field Ising Model

Symbols

  • BlochEnergy
  • BlochFunction
  • QuantumPlaybookCheckUpdate
  • QuantumPlaybookEdition
  • QuantumPlaybookUpdate
  • TransmonEnergy
  • TransmonExponent
  • TransmonFunction
  • TransmonHamiltonian
Spin Code
Quantum Error-Correction Theorems: Review
Spin
S=7/2
Spin Algebra: Review
Spin
S=5/2
This example illustrate how to encode a logical qubit into a spin.
Quantum Error-Correction Theorems: Review
Before we delve into the examples, we first recall the quantum error-correction theorems. See Section 6.2 of the Quantum Workbook or the tutorial “
Quantum Error-Correction Theorems
” for more details.

Quantum-Error Correction Conditions (Knill-Laflamme Criteria)

Compact form

Let

be the code space of a quantum code. Suppose that the quantum noise causing errors is described by a quantum operation
ℰ
specified by Kraus elements
{
E
μ
}
. Then, there exists an error-correction or recovery operation
ℛ
that corrects
ℰ
on

if and only if every pair of the Kraus elements satisfies
P
†
E
μ
E
ν
P=
A
μν
P
for a certain Hermitian matrix
A
μν
and all μ and ν, where
P
is the projector onto code space

.

Elaborated form (Knill-Laflamme criteria)

1
.
Let
|
x
〉
be the code word encoding
k
-qubit computational basis state
|x〉≡|
x
1
x
2
⋯
x
k
〉
in
n
qubits. For any two code words
|
x
〉
and
|
y
〉
,
〈
x
|
†
E
μ
E
ν
|
y
〉=
δ
xy
​ for every μ and ν.
This means that corrupted code words
E
μ
|
x
〉
and
E
ν
|
y
〉
must remain orthogonal to each other. This is natural since only orthogonal states can be discriminated with certainty in quantum mechanics.
2
.
The expectation value of given error operators,
〈
x
|
†
E
μ
E
ν
|
x
〉=
A
μν
, must be all the same regardless of code words
|
x
〉
.
This means that no error can reveal any information in encoded states.

Discretization of Quantum Errors

If a quantum noise operation
ℰ
with error operators
{
E
μ
}
can be corrected by a quantum code

, then the code also protects against any quantum noise
ℱ
with error operators
{
F
ν
}
that are linear superpositions of
{
E
μ
}
,
F
ν
=
Σ
μ
E
μ
M
μν
, where
M
μν
is a matrix of complex numbers.
———
Implication: Consider a class of errors on single qubits, described by a quantum operation
ℰ
specified by Kraus elements

μ
E
j

, where the index
j
indicates the qubit subject to the error and μ denotes different error processes. Since
μ
E
j
are operators on the single qubit
j
, they can be expanded in terms of Pauli operators
0
S
j
,
X
S
j
,
Y
S
j
, and
Z
S
j
. In order to check if a given quantum error-correction code protects against arbitrary single-qubit errors, one has only to inspect the condition
P
μ
S
j
ν
S
j
P=
A
μν
P
​ for all
j
and a Hermitian matrix
A
.
In other words, when one constructs a quantum error-correction code, it is sufficient to check a finite (and hence discrete) set of conditions to ensure that the code protects against arbitrary single-qubit errors.
Spin Algebra: Review
We also briefly review the quantum theory of spin.
Make sure that the
Q3 package
is loaded.
In[101]:=
Needs["QuantumMob`Q3`"]
Choose a symbol to use to refer to the spin. In this example, we choose S, so that S[…, 1], S[…, 2], and S[…, 3] refer to the spin X, Y, and Z operators, respectively. Notice also the option S->5/2 for spins higher than 1/2. See
Spin
for more details.
In[102]:=
Let[Spin,S,Spin5/2]

Spin Operators

These are the spin operators.
In[103]:=
S[All]
Out[103]=
{
X
S
,
Y
S
,
Z
S
}
Use
Matrix
to convert the operators to their matrix representations in the standard spin-angular momentum basis.
In[104]:=
S[1]//Matrix//MatrixForm
Out[104]//MatrixForm=
0
5
2
0
0
0
0
5
2
0
2
0
0
0
0
2
0
3
2
0
0
0
0
3
2
0
2
0
0
0
0
2
0
5
2
0
0
0
0
5
2
0
In[105]:=
S[2]//Matrix//MatrixForm
Out[105]//MatrixForm=
0
-

5
2
0
0
0
0

5
2
0
-
2
0
0
0
0

2
0
-
3
2
0
0
0
0
3
2
0
-
2
0
0
0
0

2
0
-

5
2
0
0
0
0

5
2
0
In[106]:=
S[3]//Matrix//MatrixForm
Out[106]//MatrixForm=
5
2
0
0
0
0
0
0
3
2
0
0
0
0
0
0
1
2
0
0
0
0
0
0
-
1
2
0
0
0
0
0
0
-
3
2
0
0
0
0
0
0
-
5
2
These are the raising and lowering operators.
In[107]:=
S@{4,5}
Out[107]=
{
+
S
,
-
S
}
Convert them to their matrix representations.
In[108]:=
MatrixForm/@Matrix/@S[{4,5}]
Out[108]=

0
5
0
0
0
0
0
0
2
2
0
0
0
0
0
0
3
0
0
0
0
0
0
2
2
0
0
0
0
0
0
5
0
0
0
0
0
0
,
0
0
0
0
0
0
5
0
0
0
0
0
0
2
2
0
0
0
0
0
0
3
0
0
0
0
0
0
2
2
0
0
0
0
0
0
5
0

Check the commutation relations.
In[109]:=
S[1]**S[2]-S[2]**S[1]​​S[2]**S[3]-S[3]**S[2]​​S[3]**S[1]-S[1]**S[3]
Out[109]=

Z
S
Out[110]=

X
S
Out[111]=

Y
S

Standard Spin Basis

This is the standard spin-angular momentum basis.
Convert the basis elements to their matrix representations.
The following Casimir operator is expected to be proportional to the identity operator. This can be confirmed in several ways.
First, by acting it on the basis elements.
Second, by taking the matrix representation of it.

Logical Basis (i.e., Codewords)

This is the logical basis that encodes the single-qubit states.
In the standard spin-angular momentum basis, the above logical basis is represented as column vectors as follows.
Observe how the spin operators transform the logical basis states.

Quantum Error-Correction Conditions

These are error operators that the code claims to correct.
These are the combinations of the error operators above.
According to the quantum error-correction theorem, the following matrix must be zero.
According to the quantum error-correction theorem, the following two matrices must be identical.

Verdict

The suggested code can successfully correct the errors above.

Logical Basis (i.e., Codewords)

This is the logical basis that encodes the single-qubit states.
In the standard spin-angular momentum basis, the above logical basis is represented as column vectors as follows.
Observe how the spin operators transform the logical basis states.

Quantum Error-Correction Conditions

These are error operators that the code claims to correct.
These are the combinations of the error operators above.
According to the quantum error-correction theorem, the following matrix must be zero. However, it does not seem to vanish.
According to the quantum error-correction theorem, the following two matrices must be identical.

Verdict

The suggested code cannot correct the errors.

© 2025 Wolfram. All rights reserved.

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