Quantum Basis and Quantum State (10)
A computational basis can be defined by inputting the dimension information as arguments of QuantumBasis. Alternatively, an association can be used, with the basis name are given as the keys and the corresponding basis elements are specified as the values.
Define a 3D quantum basis (computational):
Use QuantumBasis[n,m] to define a basis for m qudits of dimension n (for which the overall dimension will be nm). For example, define a 2×2×2-dimensional quantum basis:
Use QuantumBasis[{n1,n2,…,nm}] to define an n1×n2×n3×…×nm-dimensional Hilbert space of m qudits as a list. For example, define a 3×5-dimensional quantum basis (with two qudits):
There are many 'named' bases built into the quantum framework, including "Computational", "PauliX", "PauliY", "PauliZ" ((or simply "X", "Y" or "Z"), "Fourier", "Identity", "Schwinger", "Pauli", "Dirac" and "Wigner":
After a basis object has been defined, it is straightforward to construct quantum states and operators. A quantum state is represented by a QuantumState object and a quantum operator is represented by QuantumOperator.
A state can be defined by two arguments: QuantumState[arg1,arg2], where arg1 specifies amplitudes or the density matrix, and arg2 specifies the basis. With no basis specified, the default basis will be the computational basis, the dimension of which depends on the amplitude vector given in arg1.
Define a pure 2D quantum state (qubit) in the Pauli-X basis:
If the basis is not specified, the default is the computational basis of dimensions ( qubits):
Binary strings can also be used as inputs:
Many "named" states are available through the framework:
A state can also be defined by inputting a density matrix:
Quantum Operators (5)
Quantum operators can be defined by a matrix or by specifying eigenvalues with respect to a QuantumBasis. Additionally, there are many built-in named operators that can be used.
Define a Pauli-X operator:
Apply a Pauli-X operator to a symbolic state :
Test to see if the application of the Pauli-X operator yields the correct state:
Multi-qubit operators can take specific orders.
For instance, first define the state α+β:
Then, apply a Pauli-X operator on the second qubit only (by defining an order for the operator):
Test the result:
For multi-qudit cases, one can define an order or construct the operator using QuantumTensorProduct. For example:
One can create a new operator by performing some mathematical operations (e.g., exponential, fraction power, etc.) on a quantum operator:
Show that the result is the same as a rotation operator around x:
Get the fractional power of the NOT operator:
Quantum Measurement (9)
In the Wolfram Quantum Framework, one can study projective measurements or, generally, any positive operator-valued measurement (POVM) using QuantumMeasurementOperator.
PVMs (projective measurements) (2)
A measurement can be defined by specifying the corresponding measurement basis.
Measure a 3D system in its state basis:
POVMs (7)
One can also give a list of POVM elements by which to define the measurement operator:
Check that all POVM elements are explicitly positive semidefinite:
Check the completeness relations:
Measure POVMs on a quantum state:
Get the post-measurement states:
Get the corresponding probabilities:
Show that post-measurement states are the same as states initially defined as POVMs:
Quantum Partial Tracing, Partial Transposing, Distance and Entanglement (4)
In the framework, there are some functionalities to explore the quantum distance, entanglement monotones and partial tracing, as well as other useful features.
Trace out the second subsystem in a 2-qubit state:
A partial trace can also be applied to QuantumBasis:
Given a Werner state (two qubits, with probability p), take the partial transpose with respect to qubit-2:
To know whether a state is entangled (or part of that state), use QuantumEntangledQ.
Test if W-state of 4-qubits is entangled or not:
Test if qubit-1 and 3 are entangled or not:
In quantum information, there exist notions of distance between quantum states, such as fidelity, trace distance, Bures angle, etc. One can use QuantumDistance to compute the distance between two quantum states with various metrics.
Measure the trace distance between a pure state and a mixed state:
Quantum Circuits (3)
One may create a list of QuantumOperator and/or QuantumMeasurementOperator objects to build a quantum circuit, which can be represented as a QuantumCircuitOperator object.
Construct a quantum circuit that includes a controlled Hadamard gate:
The wire labels can be customized (for more info, please refer to Diagram documentation):
Define a combination of control-0 and control-1 qubits:
There are many named circuits in the Wolfram quantum framework:
quantum phase estimation, for QuantumOperator[{"Phase",2π/5}], in four steps (ie using 4-qubits):
Bernstein-Vazirani circuit, given a secret string:
Graph circuit, given a graph:
Grover search algorithm, given a Boolean function:
Ising-type of interactions and their Trotter-Suzuki decomposition (4th order):