HW1 - Bonus Problems
Problem 1
Draw the following complex numbers and their complex conjugates in the complex plane. If they are in the standard representation, convert them to the phase representation and vice versa.
- \(w = 1/2 + i\)
- \(z = \frac{5}{2} - i\frac{5\sqrt{3}}{2}\)
- \(\beta = 6(\cos(\pi/4) + i\sin(\pi/4))\)
- \(\xi = 0.01(\cos(4\pi/3) + i\sin(4\pi/3))\)
Problem 2
For each pair of vectors below, compute their tensor product, \(\left<\phi|\psi\right>\) and \(\left<\psi|\phi\right>\).
- \(\left|\psi\right> = \begin{bmatrix}7 \\ 4i\end{bmatrix}\) and \(\left|\phi\right> = \begin{bmatrix}3i \\ 2\end{bmatrix}\)
\(\left|\psi\right> = \begin{bmatrix}3 + 2i \\ -2\end{bmatrix}\) and \(\left|\phi\right> = \begin{bmatrix}1 - 3i \\ 4 + i\end{bmatrix}\)?
Problem 3
Write down a function is_qubit()
in a language of choice that takes as input a list of length 2 and returns True if the input represents a qubit, and False otherwise.
Problem 4
Write down a function random_qubit()
in a language of choice that randomly generates a qubit state. The output of this should pass the is_qubit()
test from the previous problem.
Problem 5
Write down a function inner_product(q1, q2)
in a language of choice that takes two qubit states and returns their inner product. Try running this function with the vectors in problem 2 and compare your solution against the output of the code.