Solutions to these exercises are given in Where to Go from Here Solutions.
Consider the block used in Deutsch’s circuit shown in the following circuit:
Suppose the function is constant that always returns a .
Write the truth table for .
Draw Deutsch’s circuit with gates that represent .
Write a Qiskit program to simulate this circuit using a single shot. What state is recorded by the Measure gate that collapses the qubit?
Write a Cirq program to simulate this circuit using a single shot. Place the qubits diagonally across.
Does the quantum circuit simulated on IBM’s Quantum Computer behave as the one simulated on Google’s Quantum Computer?
This exercise is similar to the previous one but uses a balanced function, , defined as follows:
Write the truth table for .
Draw Deutsch’s circuit with gates that represent . (Hint: use a combination of CNOT and X gates.)
Write a Qiskit program to simulate this circuit using a single shot. What state is recorded by the Measure gate that collapses the qubit?
Write a Cirq program to simulate this circuit using a single shot. Place the qubits 2 units apart one below the other.
Does the quantum circuit simulated on IBM’s Quantum Computer behave as the one simulated on Google’s Quantum Computer?
In this exercise you’ll write a Qiskit program to implement Deutsch-Jozsa’s algorithm for a two-qubit function, , defined as follows:
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Function is what type: constant or balanced? Using a classical algorithm, how many samples of do you need to classify its type?
Draw the block that is embedded in the Deutsch-Jozsa algorithm.
Write the truth table for .
Draw the quantum circuit for the Deutsch-Jozsa algorithm, embedding the block from the previous part.
Calculate the matrix for the block, corresponding to the truth table you computed in the previous part. Use the IBM convention to write the matrix.
Write a quantum program for this circuit using Qiskit. Use the Operator method to specify the matrix for the block. Set the program to run just one shot. Report the result as an array.
Does the output match the type of the function you deduced in the first part?
In each of the cases below, identify the correct Qiskit statements to set up the respective gates:
| circuit = QuantumCircuit(3,3) |
| circuit.h(range(3)) |
| circuit = QuantumCircuit(3,3) |
| circuit.h(3) |
| circuit = QuantumCircuit(3,3) |
| circuit.h(0,1,2) |
| circuit = QuantumCircuit(3,3) |
| circuit.h(range(2)) |
| circuit = QuantumCircuit(2,2) |
| circuit.h(range(2)) |
| circuit.measure(range(2),range(2)) |
| circuit = QuantumCircuit(2,2) |
| circuit.h(2) |
| circuit.measure(2,2) |
| circuit = QuantumCircuit(2,2) |
| circuit.h(range(2)) |
| circuit.measure(1,0) |
| circuit = QuantumCircuit(2,2) |
| circuit.h(range(2)) |
| circuit.measure(range(2),[1,0]) |
Consider a quantum gate that acts on the and qubits as follows:
Which description best fits this gate?
Splitter.
Rotates pentagon qubelets.
Rotates triangle qubelets.
Toggles qubelets. That is, a pentagon qubelet is switched to a triangle qubelet, and vice versa.
Only splits a qubit when it acts on the state.
Splitter and rotates triangle qubelets.
When this gate acts on a qubit, are the triangle qubelets rotated? If so, by how much? What’s the probability that the qubit collapses to ?
When this gate acts on a qubit, are the triangle qubelets rotated? If so, by how much? What’s the probability that the qubit collapses to ?
Write a matrix that describes the behavior of this gate.
Is this matrix unitary? Use Qiskit’s Operator class’s is_unitary to check.
Use Qiskit’s Operator class to convert this matrix into a gate you can use in a circuit.
Write a Qiskit program to insert this gate in the following circuit:
Run this circuit on the simulator and write the output states as an array.
Other than using Qiskit’s Operator class to define this gate, is there any other way you could have defined this gate?
Consider the following circuit in which the first two qubits are initialized to the quantum state :
The quantum state is:
Is a valid quantum state? If not, how can you make it valid?
Write a Qiskit program that initializes the circuit with the quantum state you determined in the previous part.
How many independent sets of qubits does this circuit have?
Run this quantum circuit on the simulator. Write the output as an array.
List the quantum effects you’ve learned in this book.
https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm
https://ai.googleblog.com/2019/10/quantum-supremacy-using-programmable.html
https://www.nytimes.com/2019/10/30/opinion/google-quantum-computer-sycamore.html
https://pragprog.com/book/gwpy3/practical-programming-third-edition
https://pragprog.com/book/dzpyds/data-science-essentials-in-python
https://qiskit.org/documentation/install.html#access-ibm-quantum-systems
https://quantum-computing.ibm.com/jupyter/tutorial/fundamentals/3_the_ibmq_account.ipynb (You’ll need to log in to the IBM Quantum Experience.)
https://qiskit.org/documentation/tutorials/circuits/2_plotting_data_in_qiskit.html#Plot-Bloch-Vector
https://qiskit.org/documentation/tutorials/circuits/2_plotting_data_in_qiskit.html#Plot-State
https://qiskit.org/documentation/tutorials/simulators/3_building_noise_models.html
https://aws.amazon.com/blogs/aws/amazon-braket-get-started-with-quantum-computing/
https://cirq.readthedocs.io/en/stable/circuits.html#insertstrategies
https://cirq.readthedocs.io/en/stable/circuits.html#importing-cirq-circuit-from-qasm-format
18.218.234.83