First we load the QuantumChemistry package
>
|
|
Next we load the QuantumComputing subpackage
>
|
|
| (1) |
We can initialize a state of 4 qubits on our simulated quantum computer with the InitialState command
>
|
|
The initial wave function has each of its 4 qubits in the lower state of the qubit, denoted by 0. To illustrate preparing a state on the quantum computer, let's use a product of gates (unitary transformations), known as a circuit, to prepare a Schrodinger cat state in which the state of all qubits down becomes entangled with the state of all qubits up. In QCT the circuit is readily assemble as a Maple list of equations. The left side of an equation indicates the qubit or qubits on which the gate acts and the right side provides the gate itself.
>
|
|
| (3) |
To prepare the new state, we act on the initial state state0 with our circuit
>
|
|
| (4) |
The new state entangles a state of 4 "down" qubits with a state of 4 "up" qubits. Like Schrodinger's cat, our state is half up and half down. We can convert the Dirac notation of state2 into an Array using ConvertDirac.
>
|
|
Likewise, we can convert the Array notation of state3 into Dirac notation using a second call to ConvertDirac.
>
|
|
| (5) |