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 Spin Systems with Q3
Basic Usage
More Examples
Wigner is a Mathematica package to help study quantum spin systems.
Spin
Quantum spin
Ket
Quantum state of Spin
Rotation
Rotation operator
Frequently used functions from the Wigner package.
Basic Usage
Load the application.
In[114]:=
Needs["QuantumMob`Q3`"]
Consider S=1 spins:
In[118]:=
Let[Spin,S,Spin1]
In[119]:=
v=Ket[S[None]0]​​v//InputForm
Out[119]=
|
0
S
〉
Out[120]//InputForm=
Ket[<|S[$] -> 0|>]
In[121]:=
v=Ket[S[None]0]​​v//InputForm
Out[121]=
|
0
S
〉
Out[122]//InputForm=
Ket[<|S[$] -> 0|>]
In[123]:=
u=S[1]**v
Out[123]=
1
2

2

(-1)
S
+
2

1
S

In[124]:=
matU=Matrix[u];​​matU//MatrixForm
Out[125]//MatrixForm=
1
2
0
1
2
In[126]:=
uu=ExpressionFor[matU,S]​​u-uu//Elaborate
Out[126]=
|
(-1)
S
〉
2
+
|
1
S
〉
2
Out[127]=
0
In[128]:=
S[1]**uu
Out[128]=
|
0
S
〉
Consider a system of many spins.
In[129]:=
Let[Spin,S]
In[130]:=
v=Ket[S[1]-1/2]
Out[130]=

-
1
2
S
1

You can add additional elements or modifies existing elements.
In[131]:=
v=Ket[v,S[3]1/2]​​v=Ket[v,S[2]-1/2]​​v=Ket[v,S[2]-1/2]
Out[131]=

-
1
2
S
1
1
2
S
3

Out[132]=

-
1
2
S
1
-
1
2
S
2
1
2
S
3

Out[133]=

-
1
2
S
1
-
1
2
S
2
1
2
S
3

The spin values are automatically verified:
In[134]:=
Let[Spin,S]
In[135]:=
w=Ket[S[1]1]
KetVerify
::spin
:Invalid value 1 for spin
S
1
.
​
Out[135]=
|␣〉
Accessing the values
In[136]:=
u=Ket[S[1]1/2,S[2]-1/2]​​u[S[2]]​​u[S[3]]​​u[{S[1],S[3]}]
Out[136]=

1
2
S
1
-
1
2
S
2

Out[137]=
-
1
2
Out[138]=
1
2
Out[139]=

1
2
,
1
2

In[140]:=
Let[Spin,S,T]
In[141]:=
Ket[S[{1,2,3}]1/2]
Out[141]=

1
2
S
1
1
2
S
2
1
2
S
3

In[142]:=
v=(3Ket[S[{1,2,3}]1/2]+4Ket[S[1]-1/2,S[2]-1/2,S[3]-1/2])/5​​vv=S[1,0]**v​​uu=T[1,0]**v
Out[142]=
1
5
4
-
1
2
S
1
-
1
2
S
2
-
1
2
S
3
+3
1
2
S
1
1
2
S
2
1
2
S
3

Out[143]=
4
5

-
1
2
S
1
-
1
2
S
2
-
1
2
S
3
+
3
5

1
2
S
1
1
2
S
2
1
2
S
3

Out[144]=
4
5

-
1
2
S
1
-
1
2
S
2
-
1
2
S
3
+
3
5

1
2
S
1
1
2
S
2
1
2
S
3

In[145]:=
Dagger[v]**v​​Dagger[v]**S[1,0]**v​​Dagger[v]**T[1,0]**v
Out[145]=
1
Out[146]=
1
Out[147]=
1
Let us see how
Spin
operators act on state vectors.
In[148]:=
Let[Spin,J,Spin3/2]
In[149]:=
v=Ket[]​​v1=J[1,3]**v​​v2=J[3,1]**J[1,1]**J[2,1]**v1//Simplify​​v3=J[1,1]**J[1,2]**v
Out[149]=
|␣〉
Out[150]=
3|␣〉
2
Out[151]=
9
16
3

1
2
J
1
1
2
J
2
1
2
J
3

More Examples
To the column vector form, then back to the Ket form.
To be compared with the Ket form.
Sometime one has to manually put spin values. In such a case, the following form will be useful to avoid tedious typing. Notice the Null input at the end, which will be automatically converted to the default value.

© 2025 Wolfram. All rights reserved.

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