Q3: Symbolic Quantum Simulation is a symbolic quantum simulation framework written in the Wolfram Language to help study quantum information systems, quantum many-body systems, and quantum spin systems. It provides various tools and utilities for symbolic and numerical calculations on these representative quantum systems.
Full version: https://github.com/quantum-mob/Q3
Mini paclet version: https://resources.wolframcloud.com/PacletRepository/resources/QuantumMob/Q3mini/
Mini paclet version: https://resources.wolframcloud.com/PacletRepository/resources/QuantumMob/Q3mini/
Installation
Installation
Find installation guide for both versions here: https://github.com/quantum-mob/Q3/blob/main/INSTALL.md
The first thing to do is loading the Q3:Symbolic Quantum Simulation package.
In[]:=
Needs["QuantumMob`Q3`"]
Quantum Information Systems
Quantum Information Systems
◼
See also tutorial “Quantum Information Systems with Q3” for more details about the use of Q3 to study quantum information system.
◼
See also guide “Quantum Information Systems” for a list of Q3 functions related to quantum information systems.
Choose a symbol to use to refer to the set of qubits. For example, choose S, and declare it to be a qubit.
In[]:=
Let[Qubit,S]
The following expression involves two qubits S[1,$] and S[2,$]. The final index denotes different Pauli operators acting on the qubit. For example, S[1,3] means the Pauli Z acting on S[1,$].
In[]:=
op=S[1,1]**S[2,1]+S[1,3]
Out[]=
X
S
1
X
S
2
Z
S
1
Multiply another operator to the above expression.
In[]:=
S[2,3]**op
Out[]=
+
X
S
1
Y
S
2
Z
S
1
Z
S
2
The computational basis state are specified by . As in many other Q3 functions, one can skip the final for each qubit; it is added automatically. Therefore, the following two expressions give the identical result.
In[]:=
Ket[S[1,$]1,S[2,$]1]Ket[S[1]1,S[2]1]
Out[]=
1
S
1
1
S
2
Out[]=
1
S
1
1
S
2
Construct a quantum state by taking a linear superposition of the computational basis states.
In[]:=
ket=Ket[S[1]0,S[2]0,S[3]0]+3Ket[S[1]1,S[2]1,S[3]1]
Out[]=
+3
0
S
1
0
S
2
0
S
3
1
S
1
1
S
2
1
S
3
Now, apply the operator on the quantum state.
In[]:=
new=op**ket
Out[]=
+3+-3
0
S
1
0
S
2
0
S
3
0
S
1
0
S
2
1
S
3
1
S
1
1
S
2
0
S
3
1
S
1
1
S
2
1
S
3
Quantum Many-Body Systems
Quantum Many-Body Systems
◼
See also tutorial “Quantum Many - Body Systems with Q3” for more details about the use of Q3 to study quantum many-body system.
◼
See also guide "Quantum Many-Body Systems" for a list of Q3 functions related to quantum many-body systems.
In[]:=
Needs["QuantumMob`Q3`"]
Choose a symbol to denote a set of Fermions.
In[]:=
Let[Fermion,c]
Here is an operator expression involving two species of fermions, c[1] and c[2].
In[]:=
op=c[1]**Dagger[c[1]]**c[2]**Dagger[c[2]]+Dagger[c[2]]**c[2]
Out[]=
1-+
†
c
1
c
1
†
c
1
†
c
2
c
2
c
1
Multiply another operator to the above expression.
In[]:=
Dagger[c[2]]**op
Out[]=
†
c
2
†
c
1
†
c
2
c
1
Construct a set of computational basis with up to 2 particles.
In[]:=
bs=Catenate@FermionBasis[c@{1,2},2]
Out[]=
{〉,〉,〉,〉}
0
c
1
0
c
2
1
c
1
0
c
2
0
c
1
1
c
2
1
c
1
1
c
2
Apply the operator on each element in the basis.
In[]:=
op**bs
Out[]=
{〉,0,〉,〉}
0
c
1
0
c
2
0
c
1
1
c
2
1
c
1
1
c
2
Or, construct a linear superposition of the computation basis states.
In[]:=
ket=Total[bs]
Out[]=
|〉+|〉+|〉+|〉
0
c
1
0
c
2
0
c
1
1
c
2
1
c
1
0
c
2
1
c
1
1
c
2
Then, apply the operator on the above state.
In[]:=
out=op**ket
Out[]=
|〉+|〉+|〉
0
c
1
0
c
2
0
c
1
1
c
2
1
c
1
1
c
2
Quantum Spin Systems
Quantum Spin Systems
◼
See also tutorial "" for more details about the use of Q3 to study quantum spin system.
◼
See also guide "Quantum Spin Systems" for a list of Q3 functions related to quantum spin systems.
In[]:=
Needs["QuantumMob`Q3`"]
Choose a symbol to use to denote different spins.
In[]:=
Let[Spin,J]
Here are two spin angular momentum operators acting on two spins S[1,$] and S[2,$], respectively.
In[]:=
op=J[1,2]**J[2,2]+J[1,3]
Out[]=
Z
J
1
Y
J
1
Y
J
2
Multiply another operator to the above expression.
In[]:=
J[1,1]**op
Out[]=
-+
1
2
Y
J
1
1
2
Z
J
1
Y
J
2
Here is the computation basis.
In[]:=
bs=Basis[J@{1,2}]
Out[]=
,,,
1
2
J
1
1
2
J
2
1
2
J
1
-
1
2
J
2
-
1
2
J
1
1
2
J
2
-
1
2
J
1
-
1
2
J
2
Specify a quantum state taking a superposition of basis states. Note that these two states are actually the same.
In[]:=
ket=Ket[J@{1,2}1/2]+I*Ket[J@{1,2}-1/2]
Out[]=
+
-
1
2
J
1
-
1
2
J
2
1
2
J
1
1
2
J
2
Then, operate the above operator on the quantum state.
In[]:=
out=op**ket
Out[]=
--+-
1
4
2
-
1
2
J
1
-
1
2
J
2
1
2
4
1
2
J
1
1
2
J
2
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Q3: symbolic quantum simulation for studying quantum information, many-body, and spin systems
by Mahn-Soo Choi
Wolfram Community, STAFF PICKS, July 18, 2025
https://community.wolfram.com/groups/-/m/t/3514978
by Mahn-Soo Choi
Wolfram Community, STAFF PICKS, July 18, 2025
https://community.wolfram.com/groups/-/m/t/3514978