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 use the MeasureState command to measure the probability of the first qubit being up (in 1 rather than 0). First, we assemble the operator to measure up from a combination of the Identity and Pauli-Z gates.
>
|
|
Second, we measure that operator with respect to state2
>
|
|