Chapter 7 – Programming with Qiskit
Question 1
Construct a random quantum circuit with a width of 4
and a depth of 9
.
Answer
from qiskit.circuit.random import random_circuit
#Circuit with a width = 4, a depth = 9
qc = random_circuit(4, 9, measure=True)
Question 2
Create another random quantum circuit with the same width as the circuit you created in Question 1 and concatenate it so that it is added before the random quantum circuit you created.
Answer
qc1 = random_circuit(2,2)
qc_combined = qc.compose(qc1, [0,1], front=True)
Question 3
Print the circuit properties of the concatenated quantum circuit from Question 3 and specify the total number of operators, not including any measurement operators.
Answer
qc_combined.draw()
qc_combined.count_ops()
Question 4
Create a circuit with a parameterized RY gate that would rotate by an angle of .
Answer
import numpy as np
from qiskit.circuit import Parameter
param_theta ...