First we load the QuantumChemistry package
Next we load the QuantumComputing subpackage
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.
To prepare the new state, we act on the initial state state0 with our circuit
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.
The probability of being "up" in each qubit is 1/2 as we can see from the QubitPopulationsPlot command