Quantum States: Exercises


3. Quantum State Tensor Product In quantum computing, you can compute the tensor product of quantum state vectors to represent composite quantum states.

You are given two quantum state vectors: |a⟩ = [0.1, 0.2] and |b⟩ = [0.3, 0.4].

Find the tensor product of a and b using np.kron().


# Import numpy import numpy as np # Find the tensor product of the quantum state vectors. a = np.array([1/np.sqrt(2), 1/np.sqrt(2)]) b = np.array([1, 0]) tensor_product_state = np.kron(a, b) # Print result. print(tensor_product_state) # Import numpy import numpy as np # Find the tensor product of the quantum state vectors. a = np.array([1/np.sqrt(2), 1/np.sqrt(2)]) b = np.array([1, 0]) tensor_product_state = np.kron(a, b) # Print result. print(tensor_product_state) test_object("tensor_product_state") success_msg("You have found the tensor product of the quantum state vectors.")
To find the tensor product of quantum state vectors, use the NumPy function np.kron().

Previous Exercise Next Exercise