This resource function is obsolete. Use the paclet Wolfram/QuantumFramework instead.

Function Repository Resource:

QuantumDiscreteState

Source Notebook

Represent a discrete quantum state

Contributed by: Jonathan Gorard (with modifications by Ruhi Shah and Taufiq Murtadho)

ResourceFunction["QuantumDiscreteState"][<|b1amp1,b2amp2,|>,purity,QuantumBasis[]]

represents a discrete quantum state with basis elements bi and associated amplitudes ampi, with purity purity, defined with respect to a specified QuantumBasis.

ResourceFunction["QuantumDiscreteState"][{amp1,amp2,},QuantumBasis[]]

represents a (pure) discrete quantum state with state vector {amp1,amp2,}, defined with respect to a specified QuantumBasis.

ResourceFunction["QuantumDiscreteState"][mat,QuantumBasis[]]

represents a (generically mixed) discrete quantum state with density matrix mat, defined with respect to a specified QuantumBasis.

ResourceFunction["QuantumDiscreteState"]["name",pic]

represents a named discrete quantum state "name", with respect to the quantum mechanical picture pic.

ResourceFunction["QuantumDiscreteState"][{"name",n},pic]

represents an n-qudit version of a named discrete quantum state "name", with respect to the quantum mechanical picture pic.

ResourceFunction["QuantumDiscreteState"][ResourceFunction["QuantumDiscreteState"][],QuantumBasis[]]

transforms a specified ResourceFunction["QuantumDiscreteState"] into a new QuantumBasis.

ResourceFunction["QuantumDiscreteState"][ResourceFunction["QuantumDiscreteState"][],pic]

transforms a specified ResourceFunction["QuantumDiscreteState"] into the new quantum mechanical picture pic.

Details

When a QuantumBasis object is not specified, the default is taken to be QuantumBasis["Computational"].
The permitted values of pic in ResourceFunction["QuantumDiscreteState"][,pic] are "Schrodinger" (default—may also be written "Schroedinger" or "Schrödinger"), "Heisenberg", "Interaction" and "PhaseSpace".
ResourceFunction["QuantumDiscreteState"][{amp1,amp2,},d] and ResourceFunction["QuantumDiscreteState"][mat,d] are used to represent a discrete quantum state in the computational basis, specified by the state vector {amp1,amp2,} or the density matrix mat, consisting of qudits of dimensionality d (when d is not specified, the default is taken to be 2).
The Association <|b1amp1,b2amp2,|> has keys given by named basis elements bi and values given by amplitudes ampi (i.e. elements of the corresponding state vector or density matrix). The purity purity is always either "Pure" or "Mixed".
ResourceFunction["QuantumDiscreteState"][]["prop"] gives the property "prop" of the specified discrete quantum state. Possible properties include:
"Amplitudes"association <|b1amp1,b2amp2,|> of basis names and amplitudes
"Basis"which QuantumBasis the state is defined with respect to
"Picture"which quantum mechanical picture the state is defined with respect to
"BasisElements"list of basis elements bi
"StateVector"state vector {amp1,amp2,} (for pure states only)
"DensityMatrix"density matrix mat (for both pure and mixed states)
"VonNeumannEntropy"Von Neumann entropy (entanglement entropy) of the state
"Purity"purity of the quantum state, specified as a real number
"PureStateQ"whether the state is pure (purity equals 1)
"MixedStateQ"whether the state is mixed (purity is not equal to 1)
"Qudits"number of qudits (subsystems) within the state
"Dimensions"dimensionality of each qudit (subsystem)
"BlochSphericalCoordinates"spherical coordinates of the state on the Bloch sphere (qubits only)
"BlochCartesianCoordinates"Cartesian coordinates of the state on the Bloch sphere (qubits only)
"BlochPlot"plot the state on the Bloch sphere (qubits only)
"Properties"list of all property names
ResourceFunction["QuantumDiscreteState"]["name"] or ResourceFunction["QuantumDiscreteState"][{"name",n}] represents an (n-qudit, unless otherwise specified) named discrete quantum state. Possible named states include:
"Plus"positive x-basis state |+〉 on the Bloch sphere
"Minus"negative x-basis state |-〉 on the Bloch sphere
"Left"positive y-basis state |L〉 on the Bloch sphere
"Right"negative y-basis state |R〉 on the Bloch sphere
"PhiPlus"maximally-entangled Bell state |Φ+〉
"PhiMinus"maximally-entangled Bell state |Φ-〉
"PsiPlus"maximally-entangled Bell state |Ψ+〉
"PsiMinus"maximally-entangled Bell state |Ψ-〉
{"BasisState",list}composite computational basis state consisting of a tensor product of single-qudit computational basis states from list
{"Register",n}quantum register consisting of n qudits in the 0th computational basis state
{"Register",n,i}quantum register consisting of n qudits in the ith computational basis state
"UniformSuperposition"uniform superposition of a single qudit
{"UniformSuperposition",n}uniform superposition of n qudits
"RandomPure"random pure state for a single qudit
{"RandomPure",n}random pure state for n qudits
"GHZ"maximally-entangled Greenberger–Horne–Zeilinger state for 3 qudits
{"GHZ",n}maximally-entangled Greenberger–Horne–Zeilinger state for n qudits
"W"entangled W state for 3 qudits
{"W",n}entangled W state for n qudits
"Werner"bipartite Werner state for 2 qubits with relative weight equal to 0
{"Werner",ρ}bipartite Werner state for 2 qubits with relative weight equal to ρ
{"Graph",g}multi-qubit graph state specified by g

Examples

Basic Examples (6) 

Create a pure discrete quantum state from a state vector in the computational basis (default):

In[1]:=
state = ResourceFunction["QuantumDiscreteState"][{1 + I, 1 - I}]
Out[1]=

Return its amplitude association (automatically normalized):

In[2]:=
state["Amplitudes"]
Out[2]=

Return its density matrix:

In[3]:=
state["DensityMatrix"]
Out[3]=

Plot the state on the Bloch sphere:

In[4]:=
state["BlochPlot"]
Out[4]=

Create a mixed discrete quantum state from a density matrix in the computational basis:

In[5]:=
state = ResourceFunction["QuantumDiscreteState"][
  1/4*{{1/2, 2 + I}, {2 - I, 1/2}}]
Out[5]=

Show that the state is not pure:

In[6]:=
state["PureStateQ"]
Out[6]=
In[7]:=
state["MixedStateQ"]
Out[7]=

Return its von Neumann entropy:

In[8]:=
state["VonNeumannEntropy"]
Out[8]=

Plot the state on the Bloch sphere:

In[9]:=
state["BlochPlot"]
Out[9]=

Create a pure discrete quantum state by explicitly specifying an association of amplitudes in a given basis:

In[10]:=
state = ResourceFunction[
  "QuantumDiscreteState"][<|"up" -> 1 + 3 I, "down" -> 2 - 4 I|>, "Pure", ResourceFunction["QuantumBasis"][<|"up" -> {1, 0}, "down" -> {0, 1}|>]]
Out[10]=

Return its state vector (automatically normalized):

In[11]:=
state["StateVector"]
Out[11]=

Return its basis element association:

In[12]:=
state["BasisElements"]
Out[12]=

Return the spherical coordinates of the state on the Bloch sphere:

In[13]:=
state["BlochSphericalCoordinates"]
Out[13]=

Return the Cartesian coordinates of the state on the Bloch sphere:

In[14]:=
state["BlochCartesianCoordinates"]
Out[14]=

Create a maximally-entangled GHZ state for 3 qubits (default):

In[15]:=
state = ResourceFunction["QuantumDiscreteState"]["GHZ"]
Out[15]=
In[16]:=
state["Amplitudes"]
Out[16]=

Create a maximally-entangled GHZ state for 4 qubits instead:

In[17]:=
state2 = ResourceFunction["QuantumDiscreteState"][{"GHZ", 4}]
Out[17]=
In[18]:=
state2["Amplitudes"]
Out[18]=

By default, all discrete quantum states are assumed to consist of tensor products of 2-dimensional subsystems (i.e. qubits):

In[19]:=
state = ResourceFunction["QuantumDiscreteState"][{1, I, -1, -I}]
Out[19]=
In[20]:=
state["Amplitudes"]
Out[20]=

Create a discrete quantum state with the same state vector consisting of a single 4-dimensional subsystem (i.e. a qudit) instead:

In[21]:=
state2 = ResourceFunction["QuantumDiscreteState"][{1, I, -1, -I}, 4]
Out[21]=
In[22]:=
state2["Amplitudes"]
Out[22]=

Create a pure discrete quantum state in the computational basis (default):

In[23]:=
state = ResourceFunction["QuantumDiscreteState"][{1 + I, 1 - I}]
Out[23]=
In[24]:=
state["Amplitudes"]
Out[24]=
In[25]:=
state["Basis"]
Out[25]=

Transform the state to the Fourier basis:

In[26]:=
state2 = ResourceFunction["QuantumDiscreteState"][state, ResourceFunction["QuantumBasis"]["Fourier"]]
Out[26]=
In[27]:=
state2["Amplitudes"]
Out[27]=
In[28]:=
state2["Basis"]
Out[28]=

Transform the state back to the computational basis:

In[29]:=
state3 = ResourceFunction["QuantumDiscreteState"][state2, ResourceFunction["QuantumBasis"]["Computational"]]
Out[29]=
In[30]:=
state3["Amplitudes"]
Out[30]=
In[31]:=
state3["Basis"]
Out[31]=

The initial and final states are the same:

In[32]:=
state == state3
Out[32]=

Scope (14) 

Represent the maximally-entangled "PhiPlus" Bell basis state in the Heisenberg picture:

In[33]:=
state = ResourceFunction["QuantumDiscreteState"]["PhiPlus", "Heisenberg"]
Out[33]=
In[34]:=
state["Basis"]
Out[34]=

Transform the state to the interaction picture:

In[35]:=
state2 = ResourceFunction["QuantumDiscreteState"][state, "Interaction"]
Out[35]=
In[36]:=
state2["Basis"]
Out[36]=

Mixed states do not have state vector representations—only density matrix representations:

In[37]:=
state = ResourceFunction[
  "QuantumDiscreteState"][{{1/4, 1/4}, {1/4, 1/4}}]
Out[37]=
In[38]:=
state["StateVector"]
Out[38]=
In[39]:=
state["DensityMatrix"]
Out[39]=

Return its amplitude association:

In[40]:=
state["Amplitudes"]
Out[40]=

Return its purity:

In[41]:=
state["Purity"]
Out[41]=

On the other hand, pure states have both state vector and density matrix representations:

In[42]:=
state2 = ResourceFunction["QuantumDiscreteState"][{1, 2}]
Out[42]=
In[43]:=
state2["StateVector"]
Out[43]=
In[44]:=
state2["DensityMatrix"]
Out[44]=

Return its purity:

In[45]:=
state2["Purity"]
Out[45]=

Create a 3-qubit random pure quantum state in the computational basis:

In[46]:=
state = ResourceFunction["QuantumDiscreteState"][{"RandomPure", 3}]
Out[46]=
In[47]:=
state["Amplitudes"]
Out[47]=
In[48]:=
state["Basis"]
Out[48]=

Represent the same state in the Pauli-X basis instead:

In[49]:=
state2 = ResourceFunction["QuantumDiscreteState"][state, ResourceFunction["QuantumBasis"]["PauliX", 3]]
Out[49]=
In[50]:=
state2["Amplitudes"]
Out[50]=
In[51]:=
state2["Basis"]
Out[51]=

Represent the orthonormal x- and y-basis states on the Bloch sphere:

In[52]:=
states = ResourceFunction["QuantumDiscreteState"][#] & /@ {"Plus", "Minus", "Left", "Right"}
Out[52]=
In[53]:=
#["Amplitudes"] & /@ states
Out[53]=

Represent the maximally-entangled Bell basis states for 2 qubits:

In[54]:=
states2 = ResourceFunction["QuantumDiscreteState"][#] & /@ {"PhiPlus", "PhiMinus", "PsiPlus", "PsiMinus"}
Out[54]=
In[55]:=
#["Amplitudes"] & /@ states2
Out[55]=

Represent the {0,1} computational basis state for a pair of 2 qubits:

In[56]:=
state = ResourceFunction[
  "QuantumDiscreteState"][{"BasisState", {0, 1}}]
Out[56]=
In[57]:=
state["Amplitudes"]
Out[57]=

Represent the {2,2,1,1} computational basis state for a 4-tuple of 3-dimensional qudits:

In[58]:=
state2 = ResourceFunction[
  "QuantumDiscreteState"][{"BasisState", {2, 2, 1, 1}}, 3]
Out[58]=
In[59]:=
state2["Amplitudes"]
Out[59]=

Represent a 3-qubit quantum register in the 0th computational basis state:

In[60]:=
state = ResourceFunction["QuantumDiscreteState"][{"Register", 3}]
Out[60]=
In[61]:=
state["Amplitudes"]
Out[61]=

Represent a 3-qubit quantum register in the 4th computational basis state:

In[62]:=
state2 = ResourceFunction["QuantumDiscreteState"][{"Register", 3, 4}]
Out[62]=
In[63]:=
state2["Amplitudes"]
Out[63]=

Represent a quantum register consisting of 2 3-dimensional qudits in the 4th computational basis state:

In[64]:=
state3 = ResourceFunction["QuantumDiscreteState"][{"Register", 2, 4}, 3]
Out[64]=
In[65]:=
state3["Amplitudes"]
Out[65]=

Represent a uniform superposition state for a single qubit:

In[66]:=
state = ResourceFunction["QuantumDiscreteState"][
  "UniformSuperposition"]
Out[66]=
In[67]:=
state["Amplitudes"]
Out[67]=

Represent a uniform superposition state for 3 qubits:

In[68]:=
state2 = ResourceFunction["QuantumDiscreteState"][{"UniformSuperposition", 3}]
Out[68]=
In[69]:=
state2["Amplitudes"]
Out[69]=

Represent a uniform superposition state for 2 3-dimensional qudits:

In[70]:=
state3 = ResourceFunction["QuantumDiscreteState"][{"UniformSuperposition", 2},
   3]
Out[70]=
In[71]:=
state3["Amplitudes"]
Out[71]=

Represent a random pure state for a single qubit:

In[72]:=
state = ResourceFunction["QuantumDiscreteState"]["RandomPure"]
Out[72]=
In[73]:=
state["Amplitudes"]
Out[73]=

Represent a random pure state for 3 qubits:

In[74]:=
state2 = ResourceFunction["QuantumDiscreteState"][{"RandomPure", 3}]
Out[74]=
In[75]:=
state2["Amplitudes"]
Out[75]=

Represent a random pure state for 2 3-dimensional qudits:

In[76]:=
state3 = ResourceFunction["QuantumDiscreteState"][{"RandomPure", 2}, 3]
Out[76]=
In[77]:=
state3["Amplitudes"]
Out[77]=

Represent the maximally-entangled GHZ state for 3 qubits:

In[78]:=
state = ResourceFunction["QuantumDiscreteState"]["GHZ"]
Out[78]=
In[79]:=
state["Amplitudes"]
Out[79]=

Represent the maximally-entangled GHZ state for 4 qubits:

In[80]:=
state2 = ResourceFunction["QuantumDiscreteState"][{"GHZ", 4}]
Out[80]=
In[81]:=
state2["Amplitudes"]
Out[81]=

Represent the maximally-entangled GHZ state for 3 3-dimensional qudits:

In[82]:=
state3 = ResourceFunction["QuantumDiscreteState"][{"GHZ", 3}, 3]
Out[82]=
In[83]:=
state3["Amplitudes"]
Out[83]=

Represent the entangled W state for 3 qubits:

In[84]:=
state = ResourceFunction["QuantumDiscreteState"]["W"]
Out[84]=
In[85]:=
state["Amplitudes"]
Out[85]=

Represent the entangled W state for 4 qubits:

In[86]:=
state2 = ResourceFunction["QuantumDiscreteState"][{"W", 4}]
Out[86]=
In[87]:=
state2["Amplitudes"]
Out[87]=

Represent the entangled W state for 3 3-dimensional qudits:

In[88]:=
state3 = ResourceFunction["QuantumDiscreteState"][{"W", 3}, 3]
Out[88]=
In[89]:=
state3["Amplitudes"]
Out[89]=

Represent the bipartite Werner state for 2 qubits, with relative weight equal to 0 (default):

In[90]:=
state = ResourceFunction["QuantumDiscreteState"]["Werner"]
Out[90]=
In[91]:=
state["Amplitudes"]
Out[91]=
In[92]:=
state["DensityMatrix"] // MatrixForm
Out[92]=

Return its purity:

In[93]:=
state["Purity"]
Out[93]=

Represent the bipartite Werner state for 2 qubits, with relative weight equal to 0.5:

In[94]:=
state2 = ResourceFunction["QuantumDiscreteState"][{"Werner", 1/2}]
Out[94]=
In[95]:=
state2["Amplitudes"]
Out[95]=
In[96]:=
state2["DensityMatrix"] // MatrixForm
Out[96]=

Return its von Neumann entropy:

In[97]:=
state2["VonNeumannEntropy"]
Out[97]=

Represent the 3-qubit graph state described by a 3-vertex path graph:

In[98]:=
pathGraph = Graph[{a -> b, b -> c}]
Out[98]=
In[99]:=
state = ResourceFunction["QuantumDiscreteState"][{"Graph", pathGraph}]
Out[99]=
In[100]:=
state["Amplitudes"]
Out[100]=

Represent the 3-qubit graph state described by a 3-vertex triangle graph:

In[101]:=
triangleGraph = Graph[{a -> b, b -> c, c -> a}]
Out[101]=
In[102]:=
state2 = ResourceFunction["QuantumDiscreteState"][{"Graph", triangleGraph}]
Out[102]=
In[103]:=
state2["Amplitudes"]
Out[103]=

QuantumDiscreteState objects can be constructed purely symbolically (without explicit vector or matrix elements):

In[104]:=
state = ResourceFunction[
  "QuantumDiscreteState"][<|"up" -> x, "down" -> y|>, "Pure", ResourceFunction["QuantumBasis"][<|"up" -> {a, b}, "down" -> {c, d}|>]]
Out[104]=

View the amplitude association:

In[105]:=
state["Amplitudes"]
Out[105]=

Standard operations can still be performed on purely symbolic states:

In[106]:=
state["DensityMatrix"]
Out[106]=
In[107]:=
state["BlochSphericalCoordinates"]
Out[107]=

View a list of properties that can be extracted from a QuantumDiscreteState object:

In[108]:=
state = ResourceFunction["QuantumDiscreteState"]["RandomPure"]
Out[108]=
In[109]:=
state["Properties"]
Out[109]=

Return the association of amplitudes:

In[110]:=
state["Amplitudes"]
Out[110]=

Return which QuantumBasis the state is defined with respect to:

In[111]:=
state["Basis"]
Out[111]=

Return which quantum mechanical picture the state is defined with respect to:

In[112]:=
state["Picture"]
Out[112]=

Return the association of names and basis elements:

In[113]:=
state["BasisElements"]
Out[113]=

Return the state vector:

In[114]:=
state["StateVector"]
Out[114]=

Return the density matrix:

In[115]:=
state["DensityMatrix"]
Out[115]=

Return the von Neumann entropy (0 for pure states):

In[116]:=
state["VonNeumannEntropy"]
Out[116]=

Return the purity (1 for pure states):

In[117]:=
state["Purity"]
Out[117]=

Determine whether the state is pure:

In[118]:=
state["PureStateQ"]
Out[118]=

Determine whether the state is mixed:

In[119]:=
state["MixedStateQ"]
Out[119]=

Return the number of qudits (subsystems):

In[120]:=
state["Qudits"]
Out[120]=

Return the number of dimensions:

In[121]:=
state["Dimensions"]
Out[121]=

Return the spherical coordinates of the state on the Bloch sphere:

In[122]:=
state["BlochSphericalCoordinates"]
Out[122]=

Return the Cartesian coordinates of the state on the Bloch sphere:

In[123]:=
state["BlochCartesianCoordinates"]
Out[123]=

Plot the state on the Bloch sphere:

In[124]:=
state["BlochPlot"]
Out[124]=

Publisher

Jonathan Gorard

Version History

  • 1.1.0 – 02 June 2021
  • 1.0.0 – 22 March 2021

Related Resources

License Information