QiskitBlocks icon indicating copy to clipboard operation
QiskitBlocks copied to clipboard

Impossible statevector room 15/16 level I

Open quantumAnsatz opened this issue 4 years ago • 11 comments

I was going through the escape rooms and I got stuck in room 15/16 level I .

I am asked to create a state of the statevector [0.924,0.383j] using two gates, with only Ry and Rz gates available.

I have not solved it yet, but just using the definitions of Qiskit documentation Ry and Rz it seems it is not possible to create such a statevector with just two gates.

I guess that either the solution is ok up to a global phase or the definitions of Ry and Rz are not the same as Qiskit.

screenshot_room15

quantumAnsatz avatar Apr 22 '21 12:04 quantumAnsatz

To clarify, the implementation in QiskitBlocks of Rz gate is a simple Z rotation, not a Qiskit P (phase gate).

On Thu, Apr 22, 2021, at 8:01 AM, quantumAnsatz wrote:

I was going through the escape rooms and I got stuck in room 15/16 level I .

I am asked to create a state of the statevector [0.924,-0,0.383j] using Ry, Rz gates.

I have not solved it yet, but just using the definitions of Qiskit documentation Ry https://qiskit.org/documentation/stubs/qiskit.circuit.library.RYGate.html and Rz https://qiskit.org/documentation/stubs/qiskit.circuit.library.RZGate.html it seems it is not possible to create such a statevector.

I guess that either the solution is ok up to a global phase or the definitions of Ry and Rz are not the same as Qiskit.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JavaFXpert/QiskitBlocks/issues/22, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLZ5WTFIW72LJWPC4CK6E3TKAFYHANCNFSM43MJ5LPQ.

JavaFXpert avatar Apr 22 '21 16:04 JavaFXpert

Thanks for the clarification. This is what I have tried: Two Rz or two Ry will not do. It can be either RyRz or RzRy. Doing first a Rz and then Ry, will not work as R_z is just providing a global phase.

Lastly, Ry and then Rz will also not work, as Ry returns a real statevector, say [n,m] with n,m reals. Followed by Rz, it will return a complex phase to both, something like: [exp(-1j*y/2)n, exp(1j*y/2)m], there is no way to provide a real angle y such that the 1th component is imaginary and the 0th component is real.

To clarify, the implementation in QiskitBlocks of Rz gate is a simple Z rotation, not a Qiskit P (phase gate). On Thu, Apr 22, 2021, at 8:01 AM, quantumAnsatz wrote: I was going through the escape rooms and I got stuck in room 15/16 level I . I am asked to create a state of the statevector [0.924,-0,0.383j] using Ry, Rz gates. I have not solved it yet, but just using the definitions of Qiskit documentation Ry https://qiskit.org/documentation/stubs/qiskit.circuit.library.RYGate.html and Rz https://qiskit.org/documentation/stubs/qiskit.circuit.library.RZGate.html it seems it is not possible to create such a statevector. I guess that either the solution is ok up to a global phase or the definitions of Ry and Rz are not the same as Qiskit. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#22>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLZ5WTFIW72LJWPC4CK6E3TKAFYHANCNFSM43MJ5LPQ.

quantumAnsatz avatar Apr 22 '21 17:04 quantumAnsatz

Thanks. Perhaps the Qiskit implementation has changed since I wrote it, as it used to work. Are you able to go into fly mode (K), and toggle noclip (H) to walk through the wall to room 16?

Regards, Jim

On Thu, Apr 22, 2021, at 1:37 PM, quantumAnsatz wrote:

Thanks for the clarification. This is what I have tried: Two Rz or two Ry will not do. It can be either RyRz or RzRy. Doing first a Rz and then Ry, will not work as R_z is just providing a global phase.

Lastly, Ry and then Rz will also not work, as Ry returns a real statevector, say [n,m] with n,m reals. Followed by Rz, it will return a complex phase to both, something like: [exp(-1j*y/2)n, exp(1j*y/2)m], there is no way to provide a real angle y such that the 1th component is imaginary and the 0th component is not.

To clarify, the implementation in QiskitBlocks of Rz gate is a simple Z rotation, not a Qiskit P (phase gate). … https://www.fastmail.com/mail/Inbox/compose/M1105e3791f0ea7df8fc846b0?u=6a584110# On Thu, Apr 22, 2021, at 8:01 AM, quantumAnsatz wrote: I was going through the escape rooms and I got stuck in room 15/16 level I . I am asked to create a state of the statevector [0.924,-0,0.383j] using Ry, Rz gates. I have not solved it yet, but just using the definitions of Qiskit documentation Ry https://qiskit.org/documentation/stubs/qiskit.circuit.library.RYGate.html and Rz https://qiskit.org/documentation/stubs/qiskit.circuit.library.RZGate.html it seems it is not possible to create such a statevector. I guess that either the solution is ok up to a global phase or the definitions of Ry and Rz are not the same as Qiskit. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#22 https://github.com/JavaFXpert/QiskitBlocks/issues/22>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLZ5WTFIW72LJWPC4CK6E3TKAFYHANCNFSM43MJ5LPQ.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JavaFXpert/QiskitBlocks/issues/22#issuecomment-825051827, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLZ5WW6SIX7JKW53SZVGNTTKBNGHANCNFSM43MJ5LPQ.

JavaFXpert avatar Apr 22 '21 18:04 JavaFXpert

Thanks again for the suggestion. So I toggled noclip on (by modifying minetest.conf). I went into room 16/16 level I.

I actually could solve room 16 but up to a global phase of -1 (see restrictions below).

Maybe the puzzles with Rz blocks were thought as U1 or phase blocks initially? This is why I think that it is so:

  • Rz blocks in the game can only have rotations between 0 and 2pi. But a Rz gate is defined between -2pi and 2pi. As I was unable to do negative rotations, I could only solve room 16 up to a phase, gladly it worked!
  • When a Rz block in the game is rotated pi radians, it becomes a Z block, but this is not what is expected Z!=Rz(pi)=[[-1j,0][0,1j]], rather P(pi)=Z.
  • Both room 15 and room 16 could have been solved exactly and more naturally using phase gates.

I will retry room 15 later.

quantumAnsatz avatar Apr 28 '21 10:04 quantumAnsatz

Thanks for your suggestion. Next time I modify QiskitBlocks I’ll change Rz rotations to Phase rotations.

Have you started on Level II escape rooms yet?

Regards, James (Jim) Weaver

On Apr 28, 2021, at 6:24 AM, quantumAnsatz @.***> wrote:

 Thanks again for the suggestion. So I toggled noclip on (by modifying minetest.conf). I went into room 16/16 level I.

I actually could solve room 16 but up to a global phase of -1 (see restrictions below).

Maybe Rz blocks were thought as U1 or phase blocks initially? This is why I think that it is so:

Rz blocks in the game can only have rotations between 0 and 2pi. But a Rz gate is defined between -2pi and 2pi. As I was unable to do negative rotations, I could only solve room 16 up to a phase, gladly it worked! When a Rz block in the game is rotated pi radians, it becomes a Z block, but this is not what is expected Z!=Rz(pi)=[[-1j,0][0,1j]], rather P(pi)=Z. Both room 15 and room 16 could have been solved exactly and more naturally using phase gates. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

JavaFXpert avatar Apr 28 '21 14:04 JavaFXpert

Great! A phase block would be awesome! Meanwhile, a quick fix would be to slightly change the statevectors demanded in room 15 (can this be modified easily? I could try to do it).

I just finished level II, no issues there, I like it very much. Thank you for this amazing game!

Edit: I can change the solution vector, but I do not know where the positions of the wall blocks are defined.

quantumAnsatz avatar Apr 28 '21 16:04 quantumAnsatz

I was also unable to solve escape room I-15 so far. Due to the many possible combinations it could be the case that I didn't find the correct combination yet.

Hiradur avatar May 02 '21 11:05 Hiradur

@Hiradur If this helps, you can replace the measurement block with a third rotation block and solve the puzzle. As I wrote above, I cannot envision a solution with with only two slots for the blocks given (and with only half rotations of the gates).

quantumAnsatz avatar May 02 '21 17:05 quantumAnsatz

I tried to solve it with 3 blocks but could not find the right combination. However, through creative mode I gave myself an S gate which allowed me to solve the puzzle quite easily in combination with an Ry block. Perhaps the S gate was supposed to be used here instead of an Rz gate?

BTW:

So I toggled noclip on (by modifying minetest.conf).

There is an easier way to turn noclip on: Open the chat/console window (T key) and enter /grantme noclip. You can then toggle noclip on and off with the H key. Noclip will only be active in fly mode though (K key).

Hiradur avatar May 03 '21 19:05 Hiradur

@Hiradur thanks for the tip.

If I remember correctly S gates are supposed to be introduced in level 3. A quick fix for room 15 level would be to either add an additional slot for another block or change the statevector (but that implies to change the wall blocks, I haven't figured that out yet). Yet I will insist for a Phase block, the implementation of the rotation blocks in the game is unusual.

quantumAnsatz avatar May 05 '21 09:05 quantumAnsatz

I can confirm that challenge #15 can't be easily solved. It seems impossible.

Evgenii-Barannik avatar Jun 20 '21 16:06 Evgenii-Barannik