Wolfram`QuantumFramework`
QuantumState |
| QuantumState[state,p,qb] state p qb |
| QuantumState[coeffs,qb] coeffs qb |
| QuantumState["name"] name |
| QuantumState[qs,qb] QuantumState qs qb |
Details
Examples
(16)
Basic Examples
(6)
Pure states can be defined by inputting state vectors. For example, define 1 qubit state (2D Hilbert space) in computational basis (default basis, unless specified otherwise):
In[1]:=
ψ=
[{α,β}]
QuantumState |
Out[1]=
QuantumState
|
Return amplitudes:
In[2]:=
ψ["Amplitudes"]
Out[2]=
|0〉α,|1〉β
Return formula of the normalized state:
In[3]:=
ψ["Formula"]
Out[3]=
α|0〉
2
Abs[α]
2
Abs[β]
β|1〉
2
Abs[α]
2
Abs[β]
Dimensions of qudits in the state:
In[4]:=
ψ["Dimensions"]
Out[4]=
{2}
Number of qubits
In[5]:=
ψ["Qudits"]
Out[5]=
1
———
Define 2 qubits state (2D⊗2D Hilbert space):
In[1]:=
ψ=
[{3,2,5,1}]
QuantumState |
Out[1]=
QuantumState
|
Return qudits dimensions:
In[2]:=
ψ["Dimensions"]
Out[2]=
{2,2}
———
Specify the dimension of qudit as 3D:
In[1]:=
ψ=
[{1,2+1,3},3]
QuantumState |
Out[1]=
QuantumState
|
Return qudits dimensions:
In[2]:=
ψ["Dimensions"]
Out[2]=
{3}
———
A built-in states:
In[1]:=
ψ=
["PhiMinus"]
QuantumState |
Out[1]=
QuantumState
|
Return amplitudes:
In[2]:=
ψ["Formula"]
Out[2]=
|00〉
2
|11〉
2
———
A state in 4D Schwinger basis:
In[1]:=
ψ=
{1,2,3},
[{"Schwinger",3}]
QuantumState |
QuantumBasis |
Out[1]=
QuantumState
|
Return amplitudes:
In[2]:=
ψ["Formula"]
Out[2]=
|〉
S
00
14
2
7
S
01
3|〉
S
02
14
In[3]:=
ψ["DensityMatrix"]//MatrixForm
Out[3]//MatrixForm=
1 | 2 | -3 | 0 | 0 | 0 | 0 | 0 | 0 |
2 | 4 | -6 | 0 | 0 | 0 | 0 | 0 | 0 |
3 | 6 | 9 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
———
States (pure or mixed) can be also defined by matrices
Define a generic Bloch vector:
In[1]:=
mat[r_]/;VectorQ[r]:=1/2(IdentityMatrix[2]+r.Table[PauliMatrix[i],{i,3}])
A mixed state:
In[2]:=
r={.1,.1,0};Norm[r]state=
[mat[r]]
QuantumState |
Out[2]=
0.141421
Out[2]=
QuantumState
|
Test if it is mixed
In[3]:=
state["MixedStateQ"]
Out[3]=
True
Calculate Von Neumann Entropy:
In[4]:=
state["VonNeumannEntropy"]
Out[4]=
0.985525
b
Purity:
In[5]:=
state["Purity"]
Out[5]=
0.51
A pure state (by normalizing the vector r):
In[6]:=
state=
[mat[Normalize@r]]
QuantumState |
Out[6]=
QuantumState
|
Purity:
Calculate Bloch Spherical Coordinates