Xanadu codebook H.7.2 Question

Does anyone know what’s wrong in my answer


I think i already follow all the steps, find difference, normalize, householder

Hi @Bank_Patamawisut, welcome to the forum, and nice work making it so far into the Codebook :star_struck:

Your answer is quite close - I recommend to check the top of the H.7 code side, and take another look at how the state |\alpha\rangle is defined in terms of the vector elements \alpha_j.

Hope that helps, please feel free to let us know if you have any additional questions!

2 Likes

Thank you, i already passed this question.

Can I ask you about another question H.7.3.
I think my result looks correct because when I change beta_list, the output amplitude also changes correctly.
But it still warns that my amplitude is incorrect.

@Bank_Patamawisut this is quite close, just a bit of additional manipulation to be done to the amplitudes. PREPARE(alpha_list) prepares the state with amplitudes that are the square roots of the elements, |\alpha\rangle \propto \sum \sqrt{\alpha_j} |j\rangle. Here we want to use the same PREPARE function to create a superposition of the form \sum_j \beta_j |j\rangle given a vector of the \beta_j. So, how must those \beta_j be modified before they are sent to PREPARE in order to produce the correct ampltiudes?