Hello qubits of the world! I was completing the Codercise notebook of pennylane and by far It has been a great experience, and I wanted to point out some typos and errors that I have found:
- In introduction to Variational Quantum Algorithms, at theory section of Optimizers, it doesn’t appear the gradient at the expectation value of the cost function: \nabla \langle \hat{B} \rangle
- In Variational Quantum Eigensolver, at the Codercise V.2.2.a and V.2.2.b, if you write the correct code at the parts of # YOUR CODE HERE #, you will encounter the error of Error: name ‘qchem’ is not defined. And it’s because at the given lines of code for the Hamiltonian and loading the data, we call
singles, doubles = qchem.excitations(electrons=2, orbitals=qubits)
a quick fix (wich appears at the solution,) is by replacing it by
qml.qchem.excitations(electrons=2, orbitals=qubits)
Also I have the question, of why at codercise HS1.1, it works
#e^{- i x O}
#e^{-i H t} = e^{-i a t Z + -i b T X} = Pi_0^N e^{-i a t / n Ẑ} e^{-i b t / n ^X}}
c_i = alpha * time / n
k_i = beta * time / n
for n_i in range(n):
qml.evolve(qml.Z(0), coeff= c_i)
qml.evolve(qml.X(0), coeff= k_i)
and not
c_i = alpha * time / n
k_i = beta * time / n
for n_i in range(n):
qml.evolve(op= qml.Z(0), coeff= c_i)
qml.evolve(op= qml.X(0), coeff= k_i)
Thank you for all the material and these exercises! It has been a great journey so far!
Hi @herbert_diaz , welcome to the Forum!
Thank you for your kind words about the Codebook. The PennyLane team will be very happy to hear them.
Thank you for reporting these typos! The fixes are in progress and they should be visible in the Codebook in the next couple of days. Thank you for helping us improve the Codebook 
Regarding the question about evolve, this seems to be a limitation between Python and how the qml.evolve() method was implemented in PennyLane.
So it doesn’t look like there’s anything inherently wrong, there’s just a subtlety in what kind of arguments this function expects (positional vs keyword arguments). So for now you’ll just need to remember that this function requires the first argument to be positional. I’m thinking the best option here might be to specify this in the documentation so that at least it’s clear there. Thank you for bringing up this issue too!
1 Like
Muchisimas gracias por la bienvenida al foro @CatalinaAlbornoz !
Perfect! i will keep enjoying the next parts of the codebook, the fault tolerant module looks really interesting! And thank you so much for the response about the qml.evolve()
function, it makes it more clear now!
Saludos desde Chile!
Herbert
No problem @herbert_diaz !
Let us know if you have any additional feedback.
By the way, the Codebook fixes should be visible now.
Saludos desde Canadá!
Catalina
Hi @herbert_diaz ,
I wanted to let you know that thanks to your feedback we have now updated the docs for qml.evolve()! We added a clarification about the op
argument and also added another argument that had been missed in the docs (num_steps
). The fix is now visible in the ‘latest’ version of the docs (here).
Thank you for helping us improve!