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
QuantumMob`Q3mini`
Basis
​
Basis
[n]
constructs the standard tensor-product basis of a system of
n
unlabelled qubits.
​
​
Basis
[{
dim
1
,
dim
2
,…,
dim
n
}]
constructs the standard tensor-product basis of a total of
n
unlabelled systems with the Hilbert space dimensions
dim
1
,
dim
2
,…,
dim
n
, respectively.
​
​
Basis
[
q
1
,
q
2
,…]
constructs the tensor product basis for the system consisting of species
q
1
,
q
2
,…
.
​
​
Basis
[
q
1
,{
q
2
,
q
3
},…]
is equivalent to
Basis[
q
1
,
q
2
,
q
3
,…]
.
​
​
Basis
[expr]
finds the relevant species from the expression expr and constructs the basis.
​
Details and Options

Examples  
(7)
Basic Examples  
(5)
This assumes a system of three unlabelled qubits. Different qubits are distinguished by their positions in the arguments in
Ket
.
In[1]:=
Basis[3]
Out[1]=
{|0,0,0〉,|0,0,1〉,|0,1,0〉,|0,1,1〉,|1,0,0〉,|1,0,1〉,|1,1,0〉,|1,1,1〉}
This assumes a system of three unlabelled particles which have the Hilbert space dimensions 2, 2, and 3, respectively.
In[2]:=
Basis[{2,2,3}]
Out[2]=
{|0,0,0〉,|0,0,1〉,|0,0,2〉,|0,1,0〉,|0,1,1〉,|0,1,2〉,|1,0,0〉,|1,0,1〉,|1,0,2〉,|1,1,0〉,|1,1,1〉,|1,1,2〉}
​
For labelled systems, the standard basis states are represented by
Ket
[<|…|>]
.
In[1]:=
Let[Fermion,c]​​Let[Boson,a,Top3]​​Let[Boson,b,Bottom2,Top4]
This gives the standard basis of one Fermion labelled by the symbol c.
In[2]:=
bs=Basis[c]
Out[2]=
{|
0
c
〉,|
1
c
〉}
This shows that each state in the basis has the form
Ket
[<|…|>]
.
In[3]:=
bs//InputForm
Out[3]//InputForm=
{Ket[<|c -> 0|>], Ket[<|c -> 1|>]}
This gives the standard basis of a system of two-flavor Fermions.
In[4]:=
Basis[c@{1,2}]
Out[4]=

0
c
1
0
c
2
,
0
c
1
1
c
2
,
1
c
1
0
c
2
,
1
c
1
1
c
2

More examples follow.
In[5]:=
Basis[a]​​Basis[a,b]​​Basis[{a,b}]
Out[5]=
{|
0
a
〉,|
1
a
〉,|
2
a
〉,|
3
a
〉}
Out[5]=
{|
0
a
2
b
〉,|
0
a
3
b
〉,|
0
a
4
b
〉,|
1
a
2
b
〉,|
1
a
3
b
〉,|
1
a
4
b
〉,|
2
a
2
b
〉,|
2
a
3
b
〉,|
2
a
4
b
〉,|
3
a
2
b
〉,|
3
a
3
b
〉,|
3
a
4
b
〉}
Out[5]=
{|
0
a
2
b
〉,|
0
a
3
b
〉,|
0
a
4
b
〉,|
1
a
2
b
〉,|
1
a
3
b
〉,|
1
a
4
b
〉,|
2
a
2
b
〉,|
2
a
3
b
〉,|
2
a
4
b
〉,|
3
a
2
b
〉,|
3
a
3
b
〉,|
3
a
4
b
〉}
In[6]:=
expr=Q[a[1]]+PlusDagger@Pair[a@{1,2}]​​Basis[expr]
Out[6]=
a
2
a
1
+
†
a
1
a
1
+
†
a
1
†
a
2
Out[6]=

0
a
1
0
a
2
,
0
a
1
1
a
2
,
0
a
1
2
a
2
,
0
a
1
3
a
2
,
1
a
1
0
a
2
,
1
a
1
1
a
2
,
1
a
1
2
a
2
,
1
a
1
3
a
2
,
2
a
1
0
a
2
,
2
a
1
1
a
2
,
2
a
1
2
a
2
,
2
a
1
3
a
2
,
3
a
1
0
a
2
,
3
a
1
1
a
2
,
3
a
1
2
a
2
,
3
a
1
3
a
2

​
In[1]:=
Let[Qubit,S]
In[2]:=
bs=Basis[{S[1],S[2,$]}]​​InputForm@First@bs
Out[2]=

0
S
1
0
S
2
,
0
S
1
1
S
2
,
1
S
1
0
S
2
,
1
S
1
1
S
2

Out[2]//InputForm=
Ket[<|S[1, $] -> 0, S[2, $] -> 0|>]
In[3]:=
KetTrim[bs]
Out[3]=
␣,
1
S
2
,
1
S
1
,
1
S
1
1
S
2

In[4]:=
Outer[Multiply,Dagger@bs,bs]//MatrixForm
Out[4]//M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
3
,
0
A
1
2
A
2
1
A
3
,
0
A
1
2
A
2
2
A
3
,
1
A
1
0
A
2
0
A
3
,
1
A
1
0
A
2
1
A
3
,
1
A
1
0
A
2
2
A
3
,
1
A
1
1
A
2
0
A
3
,
1
A
1
1
A
2
1
A
3
,
1
A
1
1
A
2
2
A
3
,
1
A
1
2
A
2
0
A
3
,
1
A
1
2
A
2
1
A
3
,
1
A
1
2
A
2
2
A
3
,
2
A
1
0
A
2
0
A
3
,
2
A
1
0
A
2
1
A
3
,
2
A
1
0
A
2
2
A
3
,
2
A
1
1
A
2
0
A
3
,
2
A
1
1
A
2
1
A
3
,
2
A
1
1
A
2
2
A
3
,
2
A
1
2
A
2
0
A
3
,
2
A
1
2
A
2
1
A
3
,
2
A
1
2
A
2
2
A
3

In[8]:=
EchoTiming[vecBS=Matrix[#,AA]&/@bs;]
⌚
0.010271
Scope  
(2)

SeeAlso
Matrix

© 2025 Wolfram. All rights reserved.

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