When I first found out that IBM was allowing
free use of their quantum
computers to everyone, I figured that was
something I couldn't pass up.
Now
anyone with an internet connection can try
out various quantum mechanics
principles such as entanglement and superposition.
I did it, and YOU can too.
At the IBM Q website, among other things,
you can click on "Experiment
with quantum".
From there, you can view the "Beginner's Guide"
and/or the
"Full User Guide".
The Beginner's Guide is mostly a trimmed down
version of
the User Guide, but in some cases, with simplified
language.
I'll first very briefly cover some things
you'll need to know about quantum
computing.
The quantum version of the standard bit is
called a qubit.
The
qubit's state can be described as being on
a unit sphere called a Bloch
sphere.
It starts out at zero which is in the +Z direction.
This state is
called zero-ket.
There are various gates that change the qubit's
state and
phase.
The first gate I'll cover is the X gate.
It rotates the qubit 180
degrees around the X axis.
This is considered a NOT since it has the
effect
of flipping the Z value.
In this example, the qubit is now one-ket.
By the way
this is how kets are specified.
The next gate I'll cover is the Hadamard or
H gate.
This is a very
important gate since it creates superposition.
It rotates the qubit 180 degrees
around the X+Z axis.
This has the effect of swapping X and Z.
If you have a
hard time visualizing this rotation, try looking
at the other views of the Bloch
sphere.
In this case, the qubit's state now points
in the +X direction and it
is now plus-ket.
By the way, minus-ket is in the -X direction.
Together they
form the superposition basis.
I'll describe superposition a little later.
In
case you're curious, the +Y and -Y directions
form the circular, or Y, basis
and have complex components.
A Controlled-NOT or CNOT is the circled plus
sign.
A CNOT flips the target
qubit only if the control qubit is
|1>.
As stated before, this flip is
considered a NOT which can be performed by
an X gate.
Although it might seem
like a contradiction, a CNOT is a reversible
2-input XOR.
Pictorially speaking,
the dot part of the CNOT is the control.
The circled plus part is the target.
A CNOT is required to create entanglement.
If you pause this video, you can read some
quantum mechanics information on
entanglement and Schr�dinger's cat.
At least my understanding of them.
You can select which quantum computer you
want to run your program on.
They
are sometimes down for maintenance which can
be for re-calibrating or even
fixing the refrigeration system.
A quantum computer chip has to be cooled down
to as close to 0 degrees Kelvin as possible.
No one has reached absolute zero
yet.
Temperatures very close to absolute zero can
also be used to create
a Bose-Einstein condensate which is a new
state of matter, but that's another
subject.
The various quantum computers have different
topologies.
This means that
CNOTs can only be connected in certain ways.
Topologically speaking, the circle
plus part can go where the arrow points to
in the topology diagram for the
particular quantum computer.
With the tail being the dot part of the CNOT.
In order to create an entanglement, we first,
by using an H gate, put the
control qubit into superposition which means
it will be 0 or 1 or both at the
same time.
Then we put in a CNOT to alter the target
qubit which is qubit 0.
This entangles the two qubits.
The pink box is the measurement box.
You can
only measure along the Z axis.
If you want to measure in a different basis,
add gates before the pink box.
For example, to measure in the X basis, add
an
H before the measure.
Measuring a qubit will collapse any superposition
and/or
entanglement the qubit might have been in
causing the qubit to settle on a
value.
Let's run it.
This is a common experiment, so it already
has saved results
from previous runs by other users.
I want to experience entangling particles
myself so I'll choose to execute it anyway.
That's a lot of experiments queued
up before mine.
In the meantime, let's simulate it to get
an idea of what the
results should be.
The superposition combined with the entanglement
created
two possible states with bit 0 having the
same value as bit 1.
The program
is run several times to get this distribution.
You can also see the QASM code
that was created from the "score" we created.
By the way, if you prefer, you
can type in your experiment in QASM instead
of creating a score in Composer.
On the real quantum computer, by default,
the experiment is run many more
times.
Clicking on "Advanced" will give you more
gates to use.
And here's the results from the real quantum
computer.
As you can see,
there are some unexpected values.
This is because, currently, there is no such
thing as a perfect quantum computer.
For one thing, temperature changes can
affect the results.
But the predominant values are what we expected.
In case you haven't noticed already, quantum
mechanics has a lot to do with
probabilities.
Unfortunately for me, probability and statistics
were not my
strong suits in high school and college.
For this, and also various computer
graphics methods such as path tracing, probabilities
are what it's all about.
Here you can see why we didn't get exactly
the same results as the
simulation (if you understand these values).
Decoherence is one aspect that can
affect the results.
Also, the more CNOTs that are used, the more
error there
will be.
Now, I'll show all the main gates.
In addition to the X and H are the S, T,
Y, and Z.
The S gate rotates 90 degrees around the Z
axis which has the effect
of moving from the X axis to the Y in this
case.
The T gate rotates 45 degrees
around the Z axis.
The Y gate rotates 180 degrees around the
Y axis.
And the
Z gate rotates 180 degrees around the Z axis
which has the effect of flipping
X.
There are also S dagger and T dagger gates
which rotate the same amount
as the S and T respectively but in the opposite
direction.
And an S followed by an
S performs a NOT, so does an S dagger followed
by an S dagger.
And a gate
followed by it's dagger does effectively nothing.
By the way, X, Y, and Z
are also called Pauli gates.
Also, keep in mind these depictions are meant
to
show example rotations.
The starting locations of the qubit could
be different
in any particular part of an experiment.
Here's a Toffoli gate.
A Toffoli gate is a reversible AND gate.
I want to
ensure there aren't any cached results by
adding a do-nothing section via
an S combined with an S dagger.
The barrier will ensure the compiler doesn't
optimize out this do-nothing arrangement.
Let's simulate it.
As you can see,
the only 1 result occurs when both qubits
are 1 (just like an AND gate).
Now I'll run it.
Here's the results.
Just like before, there are some
unexpected values.
You can also download the results.
With QISKit, you can do more advanced experiments,
combining quantum
computing with a high level language such
as Python.
By using QISKit, I believe
you also get access to quantum computers with
more qubits.
Due to the
complexities of QISKit, both in terms of installation
and programming, I won't
cover it in this video.
However, the QISKit website has some useful
things,
such as this tutorial.
Here, if your browser is capable, you can
see many
experiments and the precomputed results.
If you have Jupyter Notebook installed
along with QISKit, going through these pages
will actually run the experiments.
Let's look at a quantum "hello world".
This creates a smiley emoticon.
This
idea will be used later.
There's also a tutorial on visualizing quantum
states.
By using Python, you can graphically display
the results in various ways.
Now, I'll create a custom virtual quantum
computer.
I'll increase the
number of qubits.
Since it is a custom topology, it can only
be simulated.
I
created my version of the hello world idea.
This score will choose between the
letters M and C, which are my initials.
In ASCII, M and C differ only in bits
1, 2, and 3.
So I create a superposition in bit 1, which
means it can be
either 1 or 0 or both.
If it is a 1, bits 2 and 3 are flipped by
CNOTs making them 1.
But for M and C, I need the opposite on these
two bits, so I'll flip them with
X gates.
According to this, I should be called by my
first name.
Alternatively, I could also control qubit
3 with qubit 2 instead of qubit 1.
This might be necessary due to topological
limitations of a real quantum
computer.
The custom topology has no such limitations.
I do wonder if this
new arrangement will skew the results a little
since the system isn't controlled
by the state of a single qubit - it's now
controlled by the states of two
qubits.
I figure a skew is more likely in a real quantum
computer.
Once again,
I should be called by my first name.
Now, let's move it to a real quantum computer.
Due to the restrictive
topology, I now have to do something new.
Since this topology doesn't have the
capability to do CNOTs in the direction needed,
I'll use this configuration
of Hadamards to change the direction of the
CNOTs.
By the way, since this
quantum computer only has 5 qubits, the results
will be just the least 5
significant bits.
The missing bits are the same in both M and
C, so no problem.
Let's simulate it.
Ut oh, it now says I should be called by my
last name.
To
prove it's not always going to be that, let's
simulate it again.
After a few
tries, I finally get an M. This might be because
of the possible skewing I
mentioned before.
I'm not a quantum expert or a probability
expert, so I don't
know.
Let's run it on a real quantum computer.
This time, I shouldn't have to
wait long.
It chose M. Once again, there are some insignificant
unexpected
values.
I modified QISKit's python program to use
my results to plot the
letters.
The higher the result value, the darker the
letter.
If you look
carefully, you should be able to see that
the M is darker than the C. So,
the simulated universe doesn't agree on what
to call me, but the quantum
universe does.
So far, at least.
I'll leave it up to you to decide whether
we live in a real world or a simulated one,
existentially speaking.
By the way,
alternatively, I could have put the superposition
on qubit 2 and use qubit 2 to
control qubit 1 and qubit 3.
Here's the various quantum devices both real
and simulated.
Back at the
QISKit website, you can see more detailed
information on the various real
quantum computers.
You can also see the quantum chip layout.
So, it turns out
I used Raven and Sparrow.
If your brain at this point is fried so much
you feel you need Brain
Salad Surgery, here's some eye candy to make
you feel better?
This is a
Kaleidoscopic IFS fractal version of a Menger
Sponge variation.
I called it
"Alien Quantum CPU".
Alien because the bezel edges look kind of
like bones,
obviously in this case, not human.
Speaking of Brain Salad Surgery, this to me
kind of looks Gigerish.
Let's rotate the equations used to create
this.
Here's a mandelbox fractal area I called "Welcome
to the Machine" after the
Pink Floyd song by the same name.
I figured it looked like it could be a
teleporter using quantum teleportation.
If you were inside that, someone might
say "welcome to the machine".
And, interestingly, I think some of the song
sounds kind of like the refrigeration units
of IBM's quantum computers.
So,
it seems rather apropos.
I had thought of doing an experiment on quantum
teleportation, but I didn't want to deal with
the question of whether it's
really teleportation or just copying.
QISKit has a teleportation experiment if
you want to give it a try.
I know what you might be thinking - "Isn't
a quantum computer just a fancy
expensive coin-flipper?"
Well, it can do more than that.
Admittedly, right
now, quantum computers aren't extremely useful,
unfortunately.
But, in the future,
with advances, who knows how powerful they
will get.
Their usefulness stems
from their ability to quickly look at all
the possible cases by using
superposition and entanglement.
It could still be a challenge to create
programs that can use this aspect.
We'll see.
But for now, everyone with
internet has the capability of being part
of the future.
