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

  • Bell's Theorem: CHSH inequality
  • Circuit Diagram
  • Exploring Fundamentals of Quantum Theory
  • Getting Started
  • An IBM Quantum Error Map
  • Connecting to QPU Services
  • Quantum Machine Learning in Phase Space
  • Quantum object abstraction
  • Quantum Object Composition
  • Quantum Optimization
  • Second Quantization Functions
  • Sending Queries to IBM QPUs
  • Tensor Network
  • Time Evolution
  • Fast Gates on a Transmon
  • Quantum Computation

Guides

  • Wolfram Quantum Computation Framework

Symbols

  • CliffordChannel
  • EinsteinSummation
  • GraphState
  • IBMJob
  • IBMJobSubmit
  • LocalComplement
  • PauliStabilizer
  • QiskitCircuit
  • QiskitTarget
  • QuantumBasis
  • QuantumChannel
  • QuantumCircuitMultiwayGraph [EXPERIMENTAL]
  • QuantumCircuitOperator
  • QuantumDistance
  • QuantumEntangledQ
  • QuantumEntanglementMonotone
  • QuantumEvolve
  • QuantumMeasurement
  • QuantumMeasurementOperator
  • QuantumMeasurementSimulation
  • QuantumMPS [EXPERIMENTAL]
  • QuantumOperator
  • QuantumPartialTrace
  • QuantumPhaseSpaceTransform
  • QuantumQASM
  • QuantumShortcut [EXPERIMENTAL]
  • QuantumSimilarity
  • QuantumStateEstimate [EXPERIMENTAL]
  • QuantumState
  • QuantumTensorProduct
  • QuantumWignerMICTransform [EXPERIMENTAL]
  • QuantumWignerTransform [EXPERIMENTAL]
  • QuditBasis
  • QuditName
  • StabilizerFrame
  • StabilizerStateQ

Exploring Fundamentals of Quantum Theory

Quantum Eraser
Hardy’s paradox
Elitzur-Vaidman bomb
Quantum Switch
We will explore some important experiment in the foundation of quantum theory, using the Wolfram Quantum Framework. In this document, we will discuss quantum eraser, Elitzur-Vaidman bomb experiment, Hardy’s paradox, and quantum SWITCH.

Quantum Eraser

If there is path information (stored somewhere, regardless of whether it is measured or not), there won’t be any interference. The mere presence of path information kills quantum interference. But by erasing the path information, one can recover quantum interference. In the following setup, clicking all detectors corresponds to a no-interference case, and clicking of only D1 and D4 corresponds to the interference case.

With path information: no interference

Prepare a series of quantum gates representing the above setup:
In[1]:=
ops={"H","CX","H",{1},{2}};
Construct the quantum circuit:
In[2]:=
qc=
QuantumCircuitOperator
[ops];​​qc["Diagram"]
Calculate the system evolution through each step:
In[3]:=
steps=ComposeListqc["Operators"],
QuantumState
["Register"[2]];
Show the states prior to measurement:
In[4]:=
Grid[Transpose[{Style[#,Bold]&/@{"Initial state",​​"After 1st Hadamard","After CNOT",​​"After 2nd Hadamard"},#["Formula"]&/@steps〚;;-3〛}],​​FrameAll,AlignmentLeft]
Get the probability of each outcome:
In[5]:=
qc
QuantumState
["Register"[2]]["ProbabilityPlot"]

Erasing path information: interference

Prepare a series of quantum gates representing above setup:
In[6]:=
ops={"H","CX","H","H"2,{1},{2}};
Construct the quantum circuit:
In[7]:=
qc=
QuantumCircuitOperator
[ops];​​qc["Diagram"]
Note that the Hadamard gate acting on 2nd qubit serves as quantum eraser.
Calculate the system evolution through each step:
In[8]:=
steps=ComposeListqc["Operators"],
QuantumState
["Register"[2]];
Show the states prior to measurement:
In[9]:=
Grid[Transpose[{Style[#,Bold]&/@{"Initial state",​​"After Hadamard on 1st qubit","After CNOT",​​"After Hadamard on 1st qubit",​​"After Hadamard on 2nd qubit"},#["Formula"]&/@steps〚;;-3〛}],​​FrameAll,AlignmentLeft]
Get the probability of each outcome:
In[10]:=
qc
QuantumState
["Register"[2]]["ProbabilityPlot"]

Elitzur-Vaidman bomb

Given quantum interference in a Mach-Zehnder setup with only one beam-splitter, a detector click can be inferred as the presence of an object along one arm of interferometer. However, due to the interference, there is a 50% chance that the photon does not move through that arm, as if one can infer the presence of that object without any interaction. To dramatize the case, think about that object as a bomb! This thought experiment is also called the interaction-free measurement.

Simple case: 50:50 beam splitter

Prepare a series of quantum gates representing the above setup:
In[11]:=
ops={"H","CX","H",{1},{2}};
Construct the quantum circuit:
In[12]:=
qc=
QuantumCircuitOperator
[ops];​​qc["Diagram"]
Get the probability of each outcome:
In[13]:=
prob=qc[]["Probabilities"]
Note that detecting
|01〉
or
|11〉
means that there is interaction with bomb (or a photon passed through the arm where the bomb is), while
|00〉
means that, with the help of quantum interference, the bomb is detected with no interaction. Therefore, the efficiency rate
η
can be expressed as
η=
P
00
/(
P
00
+
P
01
+
P
11
)=
P
00
/(1-
P
10
)
.
Calculate the probability:
In[14]:=
prob​​
QuditName
[{0,0},"Dual"False]1-prob​​
QuditName
[{1,0},"Dual"False]

Beyond 50:50 beam splitter

The Hadamard gate acts like a 50:50 beam splitter. One can replace it with a
R
y
(θ)
gate, which is rotates along the
y
-axis with an arbitrary angle θ:
In[15]:=
QuantumOperator
["RY"[θ]]
Compare the Hadamard gate with the
R
y
(θ)
gate on the quantum state
|0〉
:
In[16]:=
QuantumOperator
["H"]
QuantumState
[{1,0}]["Amplitudes"]
In[17]:=
FullSimplify/@​​
QuantumOperator
["RY"[θ]]
QuantumState
[{1,0}]["Amplitudes"]
Note that the reflection will turn the qubit to
|1〉
, meaning it will be in the arm where the bomb is located.
Define a new quantum circuit using
R
y
(θ)
:
In[18]:=
qc=
QuantumCircuitOperator
[{"RY"[θ],​​"CX","RY"[θ],{1},{2}}];​​qc["Diagram"]
Get the probability of each outcome:
In[19]:=
prob=FullSimplify[#,θ∈Reals]&/@​​qc
QuantumState
["Register"[2]]["Probabilities"]
Return the efficiency rate:
In[20]:=
prob​​
QuditName
[{0,0},"Dual"False]1-prob​​
QuditName
[{1,0},"Dual"False]
Plot the efficiency rate:
In[21]:=
Plotprob​​
QuditName
[{0,0},"Dual"False]1-prob​​
QuditName
[{1,0},​​"Dual"False],{θ,0,2π},​​Ticks{{0,π/2,π,(3π)/2,2π},Automatic},​​GridLines{{0,π/2,π,(3π)/2,2π},Automatic}

Increasing efficiency by using a series of beam splitters

Define a new quantum circuit using
R
y
(θ)
:
In[22]:=
qcN[θ_,m_Integer]:=​​With{n=m-1},​​
QuantumCircuitOperator
@​​Append[Table[{"RY"[θ],"CX"{1,i+1}},{i,​​n}],"RY"[θ]]​​;
In[23]:=
qcN[θ,5]["Diagram"]
Return the efficiency rate
η=
P
00,...,0
/(1-
P
10,...,0
)
:
In[24]:=
η[θ_,n_]:=​​Module{ψr,ψt,ψf,pDet,pNul},​​(*|000,...,00〉*)​​ψr=
QuantumState
["Register"[n]];​​(*|100,...,00〉*)​​ψt=
QuantumOperator
["X"]@
QuantumState
["Register"[n]];​​(*finalstateattheendofthecicruit*)​​ψf=qcN[θ,n][ψr];​​(*innerproductswrtfinalstate*)​​{pDet,pNul}=​​Abs[First@
†
#1
[ψf][​​"StateVector"]]^2&/@{ψr,ψt};​​(*η*)​​pDet(1-pNul)​​
Plot the efficiency rate:
In[25]:=
ListPlot[Table[{n,N@η[π/n,n]},{n,2,12}],​​GridLinesAll,AxesLabel{"#BS","η"},​​PlotLabel"η vs #Beam-Splitters, with θ=π/#BS"]
Note that the dimension of matrices is
#BS
2
, so increasing the number of qubits can lengthen the computation time.

Hardy’s paradox

Get the final state:
Plot the nonlocal probability in 3D:
Show the nonlocal probability as a density plot:

Quantum Switch

Commuting example

Create a random 2D unitary operator:
Create two random commuting operators:
Consider the case where [A,B]=0:
Construct the circuit based on a quantum switch (defined in the initialization):
Perform the measurement:
The result confirms the commuting case.

Anti-commuting example

Create a random 2D unitary operator:
Create two commuting operators:
Note that we consider the case where {A,B}=0:
Construct the circuit based on a quantum switch (defined in the initialization):
Perform the measurement:
The result confirms the anti-commuting case.

© 2026 Wolfram. All rights reserved.

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