Quantum random walk of a qubit​
​by Mads Bahrami
Install the quantum paclet:
PacletInstall[CloudObject["https://wolfr.am/DevWQCF"],ForceVersionInstall->True]​​<<Wolfram`QuantumFramework`
Out[]=
PacletObject
Name: Wolfram/QuantumFramework
Version: 1.0.6

Apply 100 operators that are randomly picked as the rotation around X, Y or Z, with a random angle, on an intial state
|0〉
:
states=NestList[QuantumOperator[{RandomChoice[{"XRotation","YRotation","ZRotation"}],RandomReal[{-π/10,π/10}]}][#]&,QuantumState["0"],100];
Find the Bloch Cartesian coordinates of those states:
coords=#["BlochCartesianCoordinates"]&/@states;
For each step, show the Bloch vector, together with the history of trajectory
walk=Table[Show[states[[t]]["BlochPlot"],ListLinePlot3D[coords[[;;t]]]],{t,Length@states}];
Visualize it:
ListAnimate[walk]
Out[]=
Export the viz as a GIF
In[]:=
Export[NotebookDirectory[]<>"RandomWalk.gif",walk,"DisplayDurations"->.3,AnimationRepetitions->100]