PennyLane
Previous

To attempt this challenge, please switch to a larger screen size.

Intermediate
Quantum Information

Recoherence

Challenge statement

This challenge was part of the Canadian Quantum Cup 2023 coding competition.

One of the reasons why building a quantum computer is so difficult is due to the phenomenon known as decoherence, by which quantum states are lost due to interaction with the environment. Loosely speaking, decoherence means that a pure quantum state becomes mixed when it interacts with other states.

To understand decoherence more deeply, let us consider a system of 5 spins interacting with their nearest neighbours, with the geometry shown below.

Their interaction is described by the Hamiltonian

\hat{H}=\sum_{i=1}^4 g_i Z_0 \otimes Z_i,

where 0 labels the central spin and i=1,\ldots,4 labels the spins around it. The force of the interaction between the central spin and spin i is encoded in the coupling constants g_i, which may not be all equal.

After interacting with the spins via \hat{H} for a time t, the state of the central spin will be, in general, a mixed state. However, at certain specific times, the state will be pure again! That is, if you plot the purity of the state against time, you would see something like the plot below.

In this challenge, you will study the evolution of the purity of the central spin as it interacts with the spins around it via the Hamiltonian \hat{H}. Assuming that the initial state for spin i is given by

\vert\psi_{i}\rangle = \cos{\left(\frac{\alpha_i}{2}\right)}\vert 0 \rangle + \sin{\left(\frac{\alpha_i}{2}\right)}\vert 1 \rangle,

where \alpha_0 = \pi/2, \alpha_1 = 0.4, \alpha_2 = 1.2, \alpha_3 = 1.8, and \alpha_4 = 0.6, you are asked to

  1. Create a QNode evolve_state that returns the density matrix of the central spin after it evolves under H for a time t.
  2. Create a function purity that calculates the purity of a density matrix.
  3. Build a function recoherence_time that estimates the recoherence time, which is the first time at which the purity of the central spin's state becomes 1 again.

You'll see that this time is relatively short in the scale we are working in. However, if we had a lot of spins (say \sim10^{23}), this recoherence time would be many times larger than the age of the universe. This is why we don't see macroscopic states randomly recohere. We won't live long enough to see it!

Challenge code

In the code below, you must complete two helper functions:

  • evolve_state: a QNode that calculates the density matrix (np.tensor) of the central spin after evolving the initial state given above for a time time (float) under the action of \hat{H}. The list coeffs (list(float)) of coupling constants [g_1,\ldots, g_4] is also an input for this function.

  • purity: a function that returns the purity (float) of a density matrix rho (array(array(complex))).

Then, you must complete the main function:

  • recoherence_time: a function that returns the first time (float) t\neq 0 in which the purity of the central spin's state is equal to one again. This function takes the list coeffs (list(float)) of coupling constants [g_1,\ldots, g_4] as an argument.

Input

As input to this problem, you are given:

  • coeffs (list(float)): The list of coupling constants [g_1,\ldots, g_4].

Output

This code must output a float corresponding to the recoherece time of the central spin.

Test cases

The following public test cases are available to you. Note that there are additional hidden test cases that we use to verify that your code is valid in full generality.

test_input: [5,5,5,5] sample_output: 0.314 test_input: [1.1,1.3,1,2.3] sample_output: 15.71

Your answer must match the exact answer up to a relative error of 5\%.

Good luck!

Loading...