Quantum computers look like the first mainframe computers in the 1940s and 1950s: room-sized devices that only a small number of experts have access to. Almost like the Oracle of Delphi with its special caste of priests.

Unlike back then, today, everyone can use this technology via the Internet.

For example, Microsoft Azure offers access to various quantum computers and has created Q#, a special programming language for quantum computing. Microsoft also offers an online tutorial to learn the Q# language.

Unfortunately, it’s not that simple: you need knowledge of linear algebra and complex numbers. Luckily I learned this all at the university, as well as the connection between complex numbers and trigonometric functions. However, I never had to use all of this in my later professional life, so I struggled to remember it and to fully understand the tutorials.

For many decades we were able to classify programming languages into these four paradigms:

- Procedural
- Functional
- Object Oriented
- Declarative.

Each of these paradigms requires a certain way of thinking in order to solve problems with it.

Now quantum computing requires a completely different way of thinking. You may already have the solution to a problem in a quantum state, but you still have to use tricks to access the solution and you won’t necessarily be able to do it with 100% probability.

### Can quantum computing help us understand the state of Schrödinger’s cat?

I first wrote about the thought experiment of Schrödinger’s cat here in 1997. Let’s try to express this experiment with a simple model in Q#.

A radioactive particle corresponds to a qubit. It has a 50% chance of decaying. However, until we force a state through a measurement, it is still in a quantum state. In Q# we can express it like this:

Message("Preparing radioactive Atom"); use radioactiveAtom = Qubit(); H(radioactiveAtom);

The H operator brings our qubit into a quantum state, which corresponds to a probability wave. There are other operators, e.g. we can use the Y operator to manipulate the phase of this wave “into the imaginary”. However, we don’t need them here.

I model our cat with another qubit. I can now “entangle” the quantum state of the particle with that of the cat. The CNOT() operator is used for this. The fact that this is so easy is impressive.

use cat = Qubit(); SetQubitState(One, cat); // the cat is alive CNOT(radioactiveAtom, cat); // entangle the life of the cat with the radioactive atom

Unfortunately, with this level of modeling we do not get much insights: If we know the state of the particle, we know the state of the cat, and vice versa. Yes, sure.

In Q# I can carry out a measurement with the M() operator and get classic bits again:

let isFired = M(radioactiveAtom); // measure the atom

let isCatAlive = M(cat);

We can now use the Q# simulator to simulate the quantum state before the measurement forces one of the two states. Of course, this is only possible with relatively few qubit because the computational effort increases exponentially. So we are able to peek into the box with Schrödinger’s cat. It allows us to display the quantum states and their wave functions. To do this, we simply call the “DumpMachine()” function. An output can look like this:

Preparing radioactive Atom Radioactive Atom after applying H: |0⟩ 0.707107 + 0.000000 i == *********** [ 0.500000 ] --- [ 0.00000 rad ] |1⟩ 0.707107 + 0.000000 i == *********** [ 0.500000 ] --- [ 0.00000 rad ] Radioactive Atom and Cat after entangle them: |0⟩ 0.000000 + 0.000000 i == [ 0.000000 ] |1⟩ 0.707107 + 0.000000 i == *********** [ 0.500000 ] --- [ 0.00000 rad ] |2⟩ 0.707107 + 0.000000 i == *********** [ 0.500000 ] --- [ 0.00000 rad ] |3⟩ 0.000000 + 0.000000 i == [ 0.000000 ] Radioactive Atom and Cat after the measurement: |0⟩ 0.000000 + 0.000000 i == [ 0.000000 ] |1⟩ 0.000000 + 0.000000 i == [ 0.000000 ] |2⟩ 1.000000 + 0.000000 i == ******************** [ 1.000000 ] --- [ 0.00000 rad ] |3⟩ 0.000000 + 0.000000 i == [ 0.000000 ]

The atom and the life of the cats are initially in the quantum state, with a probability of 50% one or zero. The output shows the probabilities of the states, in a representation with real and imaginary component and also in a representation with the angle of the phase in radian representation.

In our the example, the cat survived the experiment and the qubit is in the “One” state with probability 1.

As interesting as this is, it unfortunately does not allow us to answer the question of what happens to our cat while its life depends on the quantum state of the atom. Specifically, we don’t see if there is any kind of interference pattern between a dead cat and a living cat. My model is probably too simple for that, so the condition of Schrödinger’s cat remains a mystery.

Nevertheless, if you are not afraid of the necessary mathematics, I can recommend experimenting with quantum computing. The simulation output is a nice tool for understanding quantum states. Developing real quantum algorithms remains quite difficult. It will probably take a little time before the first real applications change the world.