Homework
Homework
Here is the homework from the previous sessions. Feel free to ask any questions in the comments section. Keep in mind, this is a training that will help us prepare for the final quiz!
Session 1
Session 1
Quantum Circuit Ansatz
Quantum Circuit Ansatz
Given the following ansatz:
In[]:=
QuantumCircuitOperator[{"RX"[θ],"CNOT"}]["Diagram",ImageSize->Small]
Out[]=
In[]:=
QuantumCircuitOperator[{"RX"[θ1],"RX"[θ2]->{2},"CNOT"}]["Diagram",ImageSize->Small]
Out[]=
◼
Prove that the first ansatz cannot generate the state .
|10〉
◼
Prove that the second ansatz can generate the state .
|10〉
Session 2
Session 2
Variational Quantum Eigensolver
Variational Quantum Eigensolver
The following code in Python calculates the Hamiltonian for the molecule:
H
2
In[]:=
import pennylane as qml
from pennylane import numpy as np
symbols = ["H", "H"]
coordinates = np.array([[0.0, 0.0, -0.6614], [0.0, 0.0, 0.6614]])
# Building the molecular hamiltonian
hamiltonian, qubits = qml.qchem.molecular_hamiltonian(symbols, coordinates)
qml.matrix(hamiltonian)
from pennylane import numpy as np
symbols = ["H", "H"]
coordinates = np.array([[0.0, 0.0, -0.6614], [0.0, 0.0, 0.6614]])
# Building the molecular hamiltonian
hamiltonian, qubits = qml.qchem.molecular_hamiltonian(symbols, coordinates)
qml.matrix(hamiltonian)
◼
Calculate the minimal energy
You can import the Hamiltonian from the following link:
In[]:=
CloudImport["https://wolfr.am/1tP2IKEfw"]
Out[]=
NumericArray
Beyond VQE: Quantum Approximate Optimization Algorithm (QAOA)
Beyond VQE: Quantum Approximate Optimization Algorithm (QAOA)
Given the classical cost function for the Max-Cut problem:
C=1-,s∈{-1,+1}
1
2
∑
,∈V
s
s
And the quantum analogue:
H
C
1
2
∑
,∈V
Z
Z
◼
Show that |x〉=C(x)|x〉
H
C
Following the same steps from class:
Out[]=
◼
Find the solution for the 5-nodes graph
Session 3
Session 3
No homework!
Session 4
Session 4
In[]:=
RandomComplex[{-1-1*I,+1+1*I},2]
Out[]=
{0.702043-0.804257,0.411178+0.89022}
In[]:=
RandomComplex[{-1-I,1+I},{2,2}]//MatrixForm
Out[]//MatrixForm=
0.60789-0.0846206 | -0.0385657+0.121639 |
0.206188+0.872187 | 0.418208+0.592383 |
◼
Solve the linear system for a random complex matrix and complex vector using the Multiplexer-Based Quantum Linear Solver algorithm