WOLFRAM NOTEBOOK

Wolfram Quantum Team: quantum@wolfram.com
More Resources in Physics: https://www.wolfram.com/resources/physics/

Wolfram <> Quantum Computation

Wolfram quantum computation framework
Documentation pages: https://resources.wolframcloud.com/PacletRepository/resources/Wolfram/QuantumFramework/
github page: https://github.com/sw1sh/QuantumFramework
Install the paclet:
In[]:=
PacletInstall["Wolfram/QuantumFramework",ForceVersionInstall->True]
Out[]=
PacletObject
Name: Wolfram/QuantumFramework
Version: 1.3.5
Load the context:
In[]:=
Needs["Wolfram`QuantumFramework`"]
Or, use this short URL to get the latest development version:
In[]:=
PacletInstall["https://wolfr.am/DevWQCF",ForceVersionInstall->True]Needs["Wolfram`QuantumFramework`"]

Quantum objects: states, operators, circuits and more

Define a random pure state for a qubit
In[]:=
state=QuantumState["RandomPure"]
Out[]=
QuantumState
Pure state
Qudits: 1
Type: Vector
Dimension: 2
Picture: Schrödinger
Corresponding state vector
In[]:=
state["StateVector"]
Out[]=
SparseArray
Specified elements: 2
Dimensions: {2}
In[]:=
Normal[state["StateVector"]]
Out[]=
{-0.48304-0.394564,-0.166227+0.763781}
Corresponding density matrix
In[]:=
MatrixForm@state["DensityMatrix"]
Out[]//MatrixForm=
0.389008+0.
-0.221066+0.434524
-0.221066-0.434524
0.610992+0.
Corresponding Bloch vector
In[]:=
state["BlochPlot"]
Out[]=
Corresponding Cartesian coordinates {x,y,z}
In[]:=
state["BlochCartesianCoordinates"]
Out[]=
{-0.442131,-0.869047,-0.221985}
Corresponding spherical coordinates {r,θ,ϕ}
In[]:=
state["BlochSphericalCoordinates"]
Out[]=
{1,1.79465,4.24176}
Winger transformed state vector
In[]:=
QuantumWignerTransform[state]
Out[]=
QuantumState
Pure state
Qudits: 1
Type: Vector
Dimension: 4
Picture: PhaseSpace

Quick Examples: Bloch Plots and Random Walks

Rotate Bloch vector along x-axis by an angle:
In[]:=
Manipulate[(QuantumOperator["RZ"[θz]]@QuantumOperator["RY"[θy]]@QuantumOperator["RX"[θx]]@state)["BlochPlot"],{θx,0,2π},{θy,0,2π},{θz,0,2π},ControlPlacement->Top,TrackedSymbols:>{θx,θy,θz}]
Out[]=
θx
θy
θz
Wolfram`QuantumFramework`QuantumOperator[RZ[0.]][Wolfram`QuantumFramework`QuantumOperator[RY[0.]][Wolfram`QuantumFramework`QuantumOperator[RX[0.]][state]]][BlochPlot]
Given the initial state
|0
, randomly apply rotations with random angles
In[]:=
states=NestList[QuantumOperator[{RandomChoice[{"RX","RY","RZ"}],RandomReal[{-π/10,π/10}]}][#]&,QuantumState["0"],300];
Follow the random motion on the surface of Bloch sphere
In[]:=
coords=#["BlochCartesianCoordinates"]&/@states;
Put all points together and plot them
In[]:=
walk=Table[Show[states[[t]]["BlochPlot"],ListLinePlot3D[coords[[;;t]]]],{t,Length@states}];
In[]:=
ListAnimate[walk,AnimationRunningFalse]
Out[]=

Quantum Circuits

Rotate a symbolic quantum state by a angle along y-axis
Show the state vector
Create a quantum circuit operator
Add new operations (another rotation and measurement):
Evaluate the result of circuit:
Show the probabilities for each outcome (note that no assumptions have yet been made about the nature of the parameters):
Add some constraints and simply the formulas:
Add bit-flip as noise, with the probability of error as p
Diagram
Run the noisy circuit
Show the result of noisy circuit

POVMs

Create POVM
Corresponding basis for measurement (Wigner Minimal Informationally-Complete)
Add POVM into the circuit
Show measurement results
Show more details of diagram

CHSH Game

For more examples using Bell’s theorem and Bell states read our documentation.
CHSH stands for John Clauser, Michael Horne, Abner Shimony, and Richard Holt.
Charlie is a referee sending random 0 or 1 to Alice and Bob
Let’s look at the statistics of Charlie
Plot probabilities (quantum predictions)
Simulate the measurement and count results

Classical approach to win CHSH game

Alice and Bob strategy: report only 0, no matter what Charlie sends
Show some of the possible results:
Count only the winning results (classical strategy never achieves more than 75%)

Quantum Strategies for the CHSH game

Alice and Bob can use a Bell state and leverage entanglement to win the game with higher probability than any classical strategy.
Calculate probabilities

What about the effects of errors?

Add noise to Alice’s wire and Bob’s wire:
Compute the probabilities of each outcome:
Condense this into the chance to win the game given the noise:
Plot results:
Should Bob’s strategy depend on the amount of noise in Alice’s wire?
Proceed as before:
Get a parametric function for the chance to win:
Use the rest of Wolfram Mathematica’s symbolic capabilities to analyze the result:

Simon algorithm

A secret sequence
Create corresponding Simon oracle
Create the full circuit
Evaluate the Simon circuit
Plot probabilities
List of all potential results
Find the vector spanning the null space of these results (modulo 2)
The secret bit has been found:

Analog quantum computation

Application to NMR

Define a time-dependent Hamiltonian:
Define a symbolic initial state:
Evolve the initial state with the Hamiltonian:

Atom-trap quantum hardware

Set time and other variables of the Hamiltonian:
Create the Hamiltonian operator
Evolve quantum state:
Plot the probability of observing the register state:

Connecting with quantum hardware

Analog quantum processing units: https://wolfr.am/WolframQuEra
Digital quantum processing units:
- AWS
- IBM quantum
Wolfram Cloud

You are using a browser not supported by the Wolfram Cloud

Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.


I understand and wish to continue anyway »

You are using a browser not supported by the Wolfram Cloud. Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.