In this short computational essay, I explore different way of constructing a quantum state using the Wolfram Quantum Framework. The essay is based on answering some questions, with a how-to-do approach, therefore, it can be considered as a simple pedagogical supplement/documentation for the QuantumState function, in the Wolfram quantum framework.
Comment on conventions
Comment on conventions
We shall follow the Wolfram Mathematica conventions for eigenstates and eigenvalues. For example, for Pauli-Z we have:
In[]:=
Eigensystem[PauliMatrix[3]]
Out[]=
{{-1,1},{{0,1},{1,0}}}
In the Wolfram quantum framework, corresponds to +1 eigenvalue and to -1.
|0〉
|1〉
Install the paclet from the cloud:
In[]:=
PacletInstall["https://www.wolframcloud.com/obj/wolframquantumframework/QuantumFramework.paclet",ForceVersionInstallTrue]
Out[]=
PacletObject
Load the paclet:
In[]:=
<<Wolfram`QuantumFramework`
Check whether definitions are now available:
In[]:=
Names["Quantum*"]
Out[]=
{QuantumBasis,QuantumChannel,QuantumCircuitOperator,QuantumDistance,QuantumEntangledQ,QuantumEntanglementMonotone,QuantumMeasurement,QuantumMeasurementOperator,QuantumOperator,QuantumPartialTrace,QuantumState,QuantumTensorProduct,QuantumWignerTransform}
Pure state
Pure state
Prepare a qubit in |0〉(show different ways of doing it)
Prepare a qubit in (show different ways of doing it)
|0〉
Qubit state can be prepared using following ways.
|0〉
By giving the bit-string as an input:
In[]:=
p1=QuantumState["0"]
Out[]=
QuantumState
By specifying the state vector:
In[]:=
p2=QuantumState[{1,0}]
Out[]=
QuantumState
A simpler version of above code can be done by dropping zero elements from the right (pay attention to the basis dimension). In this case, the state vector is padded to right by zero to reach the desired dimension (here since no info about dimension/basis is given, it is set automatically as 2)
In[]:=
p3=QuantumState[{1}]
Out[]=
QuantumState
By specifying the corresponding density matrix
In[]:=
p4=QuantumState[{{1,0},{0,0}}]
Out[]=
QuantumState
Test the equality of above states.
In[]:=
p1==p2==p3==p4
Out[]=
True
Note whenever test equality of quantum states, the overall/global phases/factors are neglected automatically. For example:
In[]:=
QuantumState["0"]==2QuantumState["0"]
Out[]=
True
Prepare a qubit in |1〉 (show different ways of doing it)
Prepare a qubit in (show different ways of doing it)
|1〉
Qubit state can be prepared using following ways:
|1〉
By specifying the bit-string as an input.
In[]:=
b1=QuantumState["1"]
Out[]=
QuantumState
By specifying the state vector.
In[]:=
b2=QuantumState[{0,1}]
Out[]=
QuantumState
By specifying the corresponding density matrix.
In[]:=
b3=QuantumState[{{0,0},{0,1}}]
Out[]=
QuantumState
Test equality of all above states.
In[]:=
b1==b2==b3
Out[]=
True
Prepare a 2D system (i. e a qubit) in a pure state a|0>+b|1>
Prepare a 2D system (i. e a qubit) in a pure state a|0>+b|1>
A pure quantum state of two dimension can be prepared by providing a list of amplitudes (maximum two elements for 2D)
In[]:=
h1=QuantumState[{a,b}]
Out[]=
QuantumState
Formula is generated using “Formula” property of QuantumState.
In[]:=
h1["Formula"]
Out[]=
a|0〉+b|1〉
Prepare a 3D system in a pure state a|0>+b|1>
Prepare a 3D system in a pure state a|0>+b|1>
Quantum state of ‘n’ dimension is prepared by specifying the dimension argument after the list of amplitudes (in this case 3)
In[]:=
j1=QuantumState[{a,b},3]
Out[]=
QuantumState
Checking the formula.
In[]:=
j1["Formula"]
Out[]=
a|0〉+b|1〉
The state prepared is ‘ a |0〉+b |1〉+0 |2〉’
‘Dimensions’ property gives the dimension of the state.
In[]:=
j1["Dimensions"]
Out[]=
{3}
Prepare a 2-qubit system in the state |01> (show different ways of doing it)
Prepare a 2-qubit system in the state |01> (show different ways of doing it)
A 2-qubit system in specific state is prepared by following ways:
By providing the specific state:
In[]:=
k1=QuantumState["01"]
Out[]=
QuantumState
By specifying the density matrix associated to the state.
In[]:=
k2=QuantumState[{0,1,0,0}]
Out[]=
QuantumState
A simpler version of above code can be done by dropping zero elements from the right. In this case, the state vector is padded to right by zero to reach the desired dimension ( {2,2} specify the dimension of the density matrix)
In[]:=
k3=QuantumState[{0,1},{2,2}]
Out[]=
QuantumState
By providing association.
Test equality of above states
Prepare a qubit in the state (|x+> + i |x->)/sqrt[2] (in the basis of Pauli-X)
Prepare a qubit in the state (|x+> + i |x->)/sqrt[2] (in the basis of Pauli-X)
A Quantum state in a basis can be formed by specifying the ‘basis name’ (in this case ‘X’ for Pauli-X basis)
Check the formula.
Transform above qubit into Pauli-Y basis, and show the formula
Transform above qubit into Pauli-Y basis, and show the formula
Quantum state in Pauli-Y basis can be formed by specifying ‘Y’ in the second argument of Quantum state.
Check formula of above state.
Plot the Bloch vector of (|y-> + i |y+>)/sqrt[2]
Plot the Bloch vector of (|y-> + i |y+>)/sqrt[2]
Define the required state with amplitude as association and ‘Y’ as basis
Bloch vector of a Quantum state can be plotted using “BlochPlot” property.
Prepare a qubit in a random pure state
Prepare a qubit in a random pure state
Randomness has extended to QuantumFramework for pure state through “RandomPure” property.
Check the formula of RandomPure State.
Prepare a 2-qubit system in a random pure state
Prepare a 2-qubit system in a random pure state
Randomness is extendible to n-qudits by specifying it in the argument.
Check formula of a random pure state.
Number of qudits used in Quantum State can be seen from ‘Qudits’ property.
Prepare a 3D system in a random pure state
Prepare a 3D system in a random pure state
Randomness is extendible to N-dimensions as well by specifying it in argument.
Check the formula of 3-D random pure state.
Dimension of a Quantum State can be seen from the ‘Dimensions’ property.
Generate a random Bloch vector (rx,ry,rz) and prepare a qubit in the corresponding state
Generate a random Bloch vector (rx,ry,rz) and prepare a qubit in the corresponding state
Random coordinates in 3 dimensions between -1 and 1.
Corresponding state in Bloch vector is prepared by supplying ‘BlochVector’ property in argument along with random coordinates.
Schmidt decomposition is performed using “SchmidtBasis” property.
Check the association of the decomposition.
Two different Quantum state can be multiplied by a constant and summed to entirely different state. Below is the instance of such state.
therefore, we can use ‘Bell’ basis to define required state.
Test the equality
Verify the formula.
Prepare a GHZ state of 3-qubits, and show its formula
Prepare a GHZ state of 3-qubits, and show its formula
Another predefined quantum state is ‘GHZ’ state (3 qubits are set automatically, unless specified)
Show the formula
Prepare a GHZ state of 5-qubits, and show its formula
Prepare a GHZ state of 5-qubits, and show its formula
We can specify the number of qubits for ‘GHZ’ state (in this case 5).
Show the formula.
Prepare a uniform superposition of 3-qubits
Prepare a uniform superposition of 3-qubits
Use ‘UniformSuperposition’ state (set automatically for 3 qubits)
Show the formula.
Prepare a 2-qubit register state |00>, then find its formula in the Bell basis
Prepare a 2-qubit register state |00>, then find its formula in the Bell basis
Prepare the required state by bit-string as an input:
It can also be prepared by specifying the density matrix.
Test the equality.
Find the formula of above defined state in ‘Bell’ basis.
Prepare a 2-qubit state as |0> ⊗ |+> (qubit-1 in the state |0>, and qubit-2 in the state |+>)
Prepare a 2-qubit state as |0> ⊗ |+> (qubit-1 in the state |0>, and qubit-2 in the state |+>)
Show the formula.
Prepare a 3-qubit state |+ - +>
Prepare a 3-qubit state |+ - +>
Check the formula.
Mixed State
Mixed State
Check the formula.
QuantumPartialTrace gives the reduced state of a qubit. Note that qubit 2 is given in the argument for the reduced state of first qubit.
‘__Q’ boolean function of Wolfram language is extended to the framework for Pure and Mixed state.
Calculate the von Neumann entropy of previous state
Calculate the von Neumann entropy of previous state
Find the Von Neumann entropy using the property under same name.
Create a state with the Bloch vector {.25,.25,.5}, check if it is mixed or pure
Create a state with the Bloch vector {.25,.25,.5}, check if it is mixed or pure
Create a quantum state with the Bloch vector coordinates (in this case (0.25,0.25,0.5) )with the ‘BlochVector’ argument.
Boolean property is used to check the type of quantum state.
Create a random mixed state for one qubit
Create a random mixed state for one qubit
Randomness has extended to mixed state through “RandomMixed” argument. One qubit is set automatically, unless specified.
Check the random state formula.
Create a random mixed state for three qubits
Create a random mixed state for three qubits
We can specify the number of qudits (in this case 3) with the ‘RandomMixed’ argument.
Check the Density Matrix of random state. Note the dimensions of the Matrix.
Create a random mixed state for a composite system of 2D x 3D
Create a random mixed state for a composite system of 2D x 3D
Composite system of ‘m x n’ dimensions is created by {m,n} in the argument of quantum state.
Check the dimension of the state.
Define Identity/2 state by state vector in the Pauli-X basis.
Test the type of state.
We may define it using predefined function as well.
‘Unbend’ turns a pure state into a mixed one in lower dimensions without changing amplitudes or matrix elements.
Check the formula of all defined states.
Test the equality of above defined state.
Given a generic pure state of a qubit, |ψ>= a|0>+ b |1>, prepare a state as s |ψ><ψ| + (1-s)/2 identity
Given a generic pure state of a qubit, |ψ>= a|0>+ b |1>, prepare a state as s |ψ><ψ| + (1-s)/2 identity
Create a generic pure state by supplying list of rules in the argument.
Check the formula of state.
Matrix of the state is visualized using 'DensityMatrix’ property .
Prepare a state as p |0><0| + (1-p) |1><1|
Prepare a state as p |0><0| + (1-p) |1><1|
Define outer product with ‘Unbend’ property beforehand to obtain a quantum state.
Prepare required quantum state using outer product function defined above.
Check Density Matrix of the state.
Prepare a 5D qudit in its maximally mixed state
Prepare a 5D qudit in its maximally mixed state
Prepare a maximal mixed state of 5D.
We can prepare maximal mixed state using Identity matrix as well.
Test the equality.
Check the formula.
Verify the quantum state in matrix form.
The overall/global phases/factors are neglected automatically leading both above states to be equal.
Given a GHZ state, find the reduced state of qubit-1, show it is maximally mixed state
Given a GHZ state, find the reduced state of qubit-1, show it is maximally mixed state
Find the reduced state of GHZ state for qubit-1. Note that we provided {2,3} for the reduced state of qubit 1.
Check the formula
Check the validity of maximally mixed state. Note that the global factors are neglected here validating both states to be equal.