what is going on everybody and welcome
to a quantum computer programming
tutorial series right out of the gate I
just want to stress I am NOT a quantum
physicist I know a little bit about
things but I am just not an expert on
quantum stuff okay
I would argue that it seems like nobody
really truly is but I am less so than
most okay that might talk on this
subject anyways so my you my credentials
are Python you tuber especially give you
a little bit of understanding of my
understanding of quantum physics so with
that out of the way I do want to at
least give a basic foundation of quantum
at least in terms of quantum computers I
might say some wrong things so I
encourage you to go out and learn that
yourself I think there's really no
shortage of material even just on
YouTube but just on the internet in
general in terms of concepts and
visualizations and just the theory of
quantum mechanics and quantum computers
what there's almost nothing of is the
actual practical side of things so
that's what I want to come here and do
so first of all what's a quantum
computer so a quantum computer is just
made up of qubits or quantum bits as
opposed to our classical computer which
is made up of bits so the next question
of course is what's a qubit so a qubit
is well first what's a bit so a bit is
in your classical computer it's just a
is it's a transistor right and that that
can be either a 0 or a 1 and it gets its
value from is it a high signal so we
send voltage through either it's a high
signal or it's a low signal if it's a
high it's a 1 if it's a low it's a 0 so
a bit can be a 0 or a 1 a qubit on the
other hand can be a 0 a 1 or both wait
that's illegal no I assure you
apparently it can so so it does this
through two characteristics that are
unique to these quantum bits which are
superposition and entanglement so the
idea of superposition is it is
anything it could be right and it
doesn't actually pick something until
you make the observation so so for
example I think the mug is actually a
pretty good example right inside this
mug there could be water coffee tea
I don't know hot fudge all kinds of
things right and we and in and so if
this mug was in super position it would
be all of those things right and it's
only when we look into it and be like Oh
what do we got do we does it collapse on
one of those values that's the concept
of superposition now to me and my you
know I don't know lizard brain it says
no there's really only one thing in that
cup so whatever but but I'm just saying
hey that's the property the next thing
is entanglement and the concept of
entanglement is also magical and this is
kind of the if you've ever heard the
Einstein's spooky action at a distance
this is what it comes from so if two
qubits are entangled a change in one
causes a change in another one
instantaneously and distances are
relevant again I agree that's not
allowed
it seems pretty spooky to me but you
know people much smarter than me assure
us that it's not actually spooky action
at a distance we're not violating
certain laws like transferring
information faster than the speed of
light I mean that's what it seems like
to me but we are assured that is not is
so anyway I'll leave the theorizing to
other people all I can say is we have
these two properties how we have them I
don't know but we have them so cool hmm
so that that's the difference between a
qubit and a regular bit now what happens
when we have these two characteristics
is in a classical computer the amount of
like states that you can represent right
so each bit has two states that it could
plausibly be it could be a zero and it
could be a one right in a quantum
computer it could be 0 1 or anything in
between so what or I hate to say
anything that's incorrect
I would say 0 1 or both states let's
just stick with that because it's like a
multitude it's not like it wouldn't be a
scalar
to my understanding anyway I see the
comment section is probably blowing up
with some experts anyways what this
means to us as programmers on the
practical side of things is a classical
computer can represent n bits times two
states that's it a quantum computer can
represent two to the power of n bits
States so this is exponential this is
massive it's a huge difference right so
how many states both we can represent
but also like consider so so quantum
computers are unlikely to just like
replace classical computers one because
we kind of need classical computers to
work with quantum computers but also
it's not that quantum computers will
solve all the things that regular
computers do or classical computers do
faster right it's not that it's quantum
computers will solve problems that
classical computers can't solve
they just can't that it would just be
intractable impossible to solve right or
it would take a really long time such as
factoring numbers when it comes to like
factoring four prime numbers so for
example breaking encryptions one of
those things gets thrown around all the
time that quantum computers could do
that's true so if you're somebody that
owns a database that today if somebody
was siphoning from it right now in
twenty years with that if that data
would still be highly valuable I'd be
careful if I was you because probably in
20 years RSA encryption could is done
yinz
so so these are things we have to think
about I don't really think we're there
now and also as you'll see when we
actually do the practical side of things
quantum computers have noise and error
and we don't quite yet know how to
remedy that for some problems it really
doesn't matter for other problems like
breaking encryption for example it makes
a huge difference so yeah so so the
problems that quantum computers are
going to be and currently are and going
to be useful for our problems where like
the state space
is just just massive right so these
exponential things so a good example to
think about is like anytime you have
many combinations so one example that I
see gets thrown around by you know
people that are trying to kind of sell
the idea of quantum computers is like
logistics so if you're delivering
packages and you've got a route that you
need to take you know each kind of
intersection that you pass is in theory
a branch that you could have taken and
before long each each turn that you you
pass or take branches out and creates
this just again intractable number of
other possibilities that you could have
taken a classical computer kind of
checks each each one it kind of in a
brute-force manner sometimes we can use
things like gradient descent or you know
something like that to to sort of
optimize this task but a quantum
computer just simply can analyze all of
them all at once given the correct
number of bits but it doesn't take long
to have that correct number of qubits it
doesn't take that long to have enough
qubits because there it's exponential so
like logistics is one another one is
like modeling for like molecules those
are things in like chemistry right now
classical computers can sort of model
things but classical computers the best
thing that classical computer do can do
is like get close to statistics we can
sort of simulate probabilities but it's
not real probability right
whereas a quantum computer as best I can
tell
dare I say is probability like it just
it's just it's true so that's the
difference right so another kind of
really simple example that I think is
easy to fit in one's brain is like let's
say you're you're organizing a charity
event and you're gonna seat people at a
table and ideally you'd want those
people all to get along so they're in a
nice donating mood well if you have five
people then that would be you know in
you've got like five seats at a table
you the the combination of people that
you could like you know what combination
do you want to seat people you only have
five people but the combinations are
five factorial right so this means it's
five times four times three times two
times one right so that's
hundred and twenty combinations but if
you just add one more person it's
because you went from five to six it's
120 times six now right so six factorial
seven twenty right and then let's just
jump all the way to like ten people it's
like three point six million all right
so as you keep just any just one more
one more option things get crazy so
these are the types of things that like
you know a classical computer could
obviously solve for the hundred and
twenty and the classical computer can do
a pretty good job when you start getting
to six million or three point six
million let's say but as you continue to
go further and further the classical
computer at some point it's just not
even possible because at some point you
at you end up having more more
possibilities than there are like you
know atoms in the entire universe
so you just it's just impossible right
and so we can prove that already we can
definitely have quantum computers that
will eventually exceed clock anything a
classical computer could do in terms of
large state spaces okay so I I think
that's really all I really want to talk
about in terms of the fundamentals if
you've got questions feel free to ask
them if I said something silly feel free
to correct me below like I said I'll put
some other resources in the description
but let's say you're interested in this
stuff you know you'll want a quantum
computer what do you do well it turns
out as you might expect building a
quantum computer I mean I don't know
exactly how much would go into it but
I'm gonna imagine that if you wanted to
start from scratch it's probably like at
least a 100 million dollar enterprise
you you can buy like I've seen that
d-wave has sold at least one quantum
computer for 15 million D waves quantum
computers are different from what
appears to me to be everyone else's and
I'm not intelligent enough to explain
exactly why but something tells me that
they're questionable compared to the
differences are questionable at least so
so let's I'm just going to throw out
that they're probably about a hundred
million dollar device right like it so
you so if you
Google's you know 50 qubit quantum
computer or rpms or whatever so so
they're expensive whatever the heck they
are so what do these companies do with
them well it turns out they just connect
them to the cloud and anybody can
connect and run these quantum circuits
on them for free that's incredible to me
this seems like it's like the equivalent
of like if NASA was like hey you can
drive the Mars rover just connect to it
and drive it around Mars that's what it
seems like to me it's this incredible
but I think the thing is right now we're
in a time where nobody totally knows
what exactly are we going to use quantum
what all can we use quantum computer
computers for and so it's just like a
big kind of experiment right now so
anyway what a cool time to be alive that
we can even play with these machines so
yes we will play with actual quantum
computers as well as simulator so I
think we've got the time let's go ahead
and set the set the mood so first of all
I'm gonna be working in the following
I'm just gonna have this quantum
computing tutorial and then we're going
to we're gonna install something so let
me get out of the way - I'm assuming
everybody at if you're following this
tutorial please know the basics of
Python and installing packages if you
don't I will try my best to put a link
to the basics tutorial in the
description but otherwise go to Python
programming net go to the fundamentals
and learn Python the basics of Python it
you honestly could learn the basics of
Python I feel like in a day maybe that's
unfair
but days uh okay so yeah so cool so
moving on what we're gonna need for this
series is some form of piff I'm gonna be
using Python three seven so really I
would say pip three seven but depending
on what operating system yeah it's gonna
vary but mostly pip install and then
we're going to be using kiss kit that's
Qi s k i-- t--
hi i'm gonna be doing things in a
jupiter notebook so jupiter lab if you
want to use jupiter notebook you can use
whatever editor you want matplotlib and
then kiss kits IBM Q and then provider
and so if that doesn't give it away
we're gonna be using IBM's quantum
computers so there's a lot of providers
like d-wave has them in the cloud Google
has I think in the cloud Microsoft
definitely does and then yeah IBM I'm
sure there's other providers I'm spacing
out right now I kind of poked around
everybody's and honestly the IBM is in
my opinion the best by far
first of all you can get set up I'm
gonna hopefully I'm gonna be yakking and
explaining things but you can honestly
get set up and running in like a minute
or not a minute let's say two minutes on
IBM stuff so anyway shouts out to IBM
for forgetting this right and then kiss
kit I don't know if it's people at IBM
who made kiss kit or what but they seem
to be entangled I'm so cool so install
those things I'm not gonna run it
because I've already installed those
instead what I'm gonna do Jupiter lab Oh
also on at least Linux I found that a
kiss kit IBM cube provider might get
installed with kiss kit and then it's
like you already have this it's fine
and then I attempted to use it and it
didn't work so I needed to do a sudo pip
install upgrade force reinstall of that
and I also got a warning about
mismatching version numbers after force
installing it everything was great but
if you have a problem please let me know
even though I think IBM is doing a
phenomenal job here with this all of
this stuff is is fairly buggy for what
it is it's awesome but just expect to be
mean to be patient I'll also try to put
the slack for a kiss kick kiss get has
like a slack channel and at least when I
needed help I got help pretty quick and
it was actually useful help so anyway
I'll try to remember to put that in
there but yeah there's there's so many
things to talk about it in point you to
and stuff so I might forget something
but if I forget someone doesn't remind
me and I'll put it in there anyway
Jupe
Space Lab to open a new book okay so
let's get this good enough okay so let
me name this kiss kit 1 or something
like that obviously just I'm assuming
you guys aren't amateurs but kiss get
one just name it something that isn't
kiss kit dot pi because watchlist
ipython notebook you get away with it
probably anyway just a good idea not to
name it exactly the thing that you're
going to use so let us go ahead and get
started but actually before we get
started you could actually start with
kiss gate but you're gonna have a hard
time so I might have to do some blurring
if I screw this up but I'm gonna show
you guys how to set up I think because
we're gonna run on a quantum computer
first but so so probably before we get
started the next thing we should do is
go to quantum - computing dot IBM comm
so let me see if I can just bop over
there yeah so you'll have to make an
account and if I think you can just
connect your Google account
anyway I forget how simply I set a gut
set up here but anyway you'll need to do
that and then you click on this my face
is on it let me do this cool
this little account icon if you click on
that and then you go to my account
you'll see you'll have a token here
hopefully I'm not showing anything else
so I don't think I am
and just click copy token which reminds
me I need to copy over a token dang it
I'm gonna have to edit this video let me
do it so actually I might have to edit
this video so I am going to have my
token in a separate file because I just
don't want to show it but you don't
necessarily have to have to do that I
just don't want to end up showing it on
on camera so token so I saved mine in a
file called token dot
next and then if I go back to where we
are pasta
boom done don't have to edit nice so you
would copy that token and then you would
use it in a moment so just take note or
you could copy it I think you'll be fine
we won't do any copying and pasting
until we need it anyways so now what
we're ready to do is import kiss get as
q all of the like official kiss kit
tutorials that I've seen do from Kiska
import asterisk I think that's the only
thing I would complain about don't do
that guys it's not that bad form that
form and then Matt plot lib in line and
kiss kit just simply somewhere along the
lines is imported I think when you do
your visualization tools they just
import matplotlib and then this is just
notifying Jupiter notebook to plot in
line like in the actual notebook so if
you are not in Jupiter notebook you
don't need a tight man plot limit line
okay so now we're going to define our
actual circuits so again with quantum
computers we're working with the bits so
so we that's how far down we're going so
I it's painful as a Python programmer I
know but we got to start at the bit
level and this is partly why we're going
why I don't see quantum computers at
least and not anywhere in the near term
replacing classical computers because we
actually kind of need to work with both
of them so with with with what we're
gonna do here generally you'll have you
know Python doing the most of your logic
or a bunch of your logic and then for a
certain task you'll pass it through a
quantum computer get your your response
so the way it works generally is you're
going to define your circuit right in
Python and then you it's just kind of a
representation of the circuit you pass
it through the quantum computer the
quantum computer does its thing and then
actually what it does is even though so
it runs it through and it runs it
through these qubits and then spits back
out the answer and it spits out the
answer in bits so classical bits and
again this will make more sense I think
as we
actually work with this so anyway I'm
just trying to explain as we go so we we
have to build these circuits and these
circuits or these like bit circuits
welcome to CS 101 so cute dot quantum
circuit and then what we're gonna say is
2 comma 2 another thing that I kind of
noticed was the the shorthand here for
how to actually get away with this
varies so I've I've I've kind of been
running through a bunch of different you
know documentation and stuff like that
and over time this appears to have
changed and it might change some more in
the future but so sometimes you'll just
see two here and I'm not sure how that
would have ever worked but anyways it it
has worked for me so anyway whatever I
guess I guess you could probably get
away with two if all you were doing was
pluck we're like not actually running it
and taking measurements anyway I've
personally found that confusing but what
these each value means is basically the
it's two qubits and then we'll have two
classical bits so then what we're going
to do is circuit circuit dot X so this
is a a not gate so we're gonna say we're
gonna apply a not gate to qubit 0 so by
default these bits are going to start as
zeros so we're going to say ok cubits
cubits zero not so we're just flipping
it okay so now qubit zero is so let's
say just to make it super clear so
currently qubit let's just assume these
are qubits it's just a 0 0 we're saying
ok qubit cubed 0 not now so then we're
gonna say 0 1 or 1 0 trying to help now
what we're gonna do is apply a circuit
dot Z X this is a control knot or a C
naught and this basically intent it's
it's I guess maybe the more probably one
of the more common ones and this will
entangle the to two qubits so you're
gonna pass two through here but also
what it does
is let me just note it here so it's a C
naught or controlled-not and it flips
second qubit cube qubit value if and
only if the first qubit qubit is a one
writer is on basically so so we'll see X
and then it's going to be 0 and 1 so in
theory you could actually you could put
other qubits in here we only have to
anyways so but what we're saying so we
flip this so this circuit now or this
qubit rather is 1 so already knowing
that it flips the second qubit so it
flips qubit 1 if the first qubit is a 1
is let's say is a 1 just to be clear so
what will happen right so what we should
get in return at least up to this point
right should be a 1 1 right because we
flipped qubit 0 to be a 1 so then what
we could say is we don't have to say
this as again was kind of confusing to
me when I was going through things but
we take our measurement so when we
measure it's important to understand
that as soon as you take your
measurement if you did have qubits in
superposition they will collapse into a
value so more on that later but just
know that at this point now we're
actually measuring we're looking inside
the the Schrodinger's box with the cat
right so we're going to see what's in
the coffee mug so we measure mmm and
then again I didn't quite understand
this but it slowly began to make sense
we specify the actual qubit register how
it is going to map to the classical bit
register so we're going to say 0 1 here
and then again whoops 0 1 so it's going
to be a direct representation of qubits
to class or rather yeah qubits to
classical bits what this means is the
value after we take our measurement the
value for qubit 0 is what we're going to
return for classical bit zero and then
the same thing for number 1
so what we should get at this point when
we take this measurement is one one as
classical bits so again with quantum
computers you take in that whatever the
the circuitry is right you're gonna
probably use a classical computer to
build the circuit logically with with
beautiful programming languages like
Python then you're gonna pass them
through this this quantum machine which
is gonna run this quantum circuit with
qubits and then after we got the qubit
answer we're going to translate that
answer back to classical bits so that we
can pass that then back to our beautiful
Python language and do the next things
that we plan to do for now we're just
building circuits so that's that's all
we're going to do so so we take that
measurement and then what we can do at
this point is there's some really cool
methods in here whoever made these I
don't know if you're watching
probably not but whoa so circuit draw
what we get is a ASCII representation of
this circuit um that is really cool that
the amount of thinking that goes into
making a visualization like this this
way is really cool so awesome job
whoever made that so another option you
have is circuit dot draw and then is it
back-end I have to check oh no its
output I always want to say back-end but
its output equals MPL this is matplotlib
so now you get a more pretty
representation but I really like these I
really like this one yeah anyway here is
kind of how they denote the measurement
so actually the first time I was started
I was like looking at the actual outputs
here I was a little confused because I
didn't know what was this right and so
this is the symbol for measurement same
thing here it's a plus sign rather than
I'm sure that's the that's coming from
historical things but like why isn't
like this is an X but then a
controlled-not looks like this I don't
know it's a little confusing but anyway
you can see here you've got your your
your classical bit number
here and then here I don't know I just
like this one better I think but anyway
you can see here this is our not gate
right and then this is our controlled
not gate like it's based on this value
here and then these M's we take in our
measurement just a nice way for us to
kind of see where we're headed so from
here we can actually run these things
through our quantum machines now you can
either run it through an actual quantum
machine or you can run it through a
simulator so you would use the
simulators just when you're doing R&D
but then when you're actually ready to
do your true research you want to see
what the actual answer is that's when
you're gonna feed it through a you know
an actual quantum computer so you can
you can do either of these two things
but I know everybody is going to want to
at least try once to run things on a
quantum computer this way when you're
done you can actually update your resume
and call yourself a quantum programmer
now so so in order to do this mmm I'm
gonna show you guys and you may follow
along but especially if you're following
along on the day of release feel free to
do it but the queues will probably be
quite long so do what you want but
anyway
what we're gonna do is make some space
and what we're gonna say is from kiss
kit we're going to import IBM q and then
we're gonna say IBM Q dot save
underscore account and then you would
put your token in here so you might even
still have it copied paste it in there
for me I saved my token to a file so I'm
actually gonna say oops I'm going to sit
one of these days I'm going to say open
token texts open token text dude we'd
better wrap it up a token text and then
dot read and then close it all off cool
so I could run that it's going to say
the credential is already exists because
I've already done this so you actually
only need to do this once it saves it so
in your other programs you don't really
need to do that so you only need to run
that one time and then to use it
subsequently
just do IBM Q dot load underscore
account and there we go
so it's an account it tells you hey this
is an IBM Q account blah blah blah and
then now what we can do is actually
start working with IBM q which is this
here which then gives us access to these
following back ends so continuing along
to actually send it send something to
those backends what we're going to say
is provider first of all is going to be
equal to IB M Q dot get underscore
provider and we're going to say IBM dash
Q that's our provider and then we have a
bunch of backends now there's a few ways
that we can access these backends one is
you could just look and pick one of
these if we go to the home page you can
see here like IBM Q or IBM yeah IBM q ml
born has a Q of 87 jobs which is a ton
of jobs I don't know what the deal is
when I'm like when I was working with
this initially there there's like no
competition there was like the queues
were all super short but today it's just
going nuts so interesting anyways and
the jobs seem to be taking longer like I
said there's a lot of variability here
it's buggy might not be the right word
but it you patients will be required
sometimes anyway
IBM q get provider I mean cool so now
what we could do is for for beck and in
provider backends we're going to try
this is going to be a terrible cubit
cubit underscore count equals len
back-end dot properties 'don't cubits
we're trying because one of them is a
simulator accepts werner you were gonna
handle the exception we're just going to
say cubit count equals simulated and
then we're going to print and we'll just
make this a nice f string we're going to
say back-end dot name has and then we're
going to say back-end dot status
and then dot pending jobs queued and
qubit count qubits cool hopefully that
works
no cube always spelled qubit run okay
qubit qubit count area qui bit and we
spelled cued wrong terribly wrong let's
run that one we're done okay so um it's
in simulated huh cubic count back and
properties cube do we spell we spoke
qubits wrong again that's why cubits
cubits that's why you don't on yeah
that's why you don't not handle your
exceptions but anyway so so real quickly
we can just kind of see ok well the
chasm simulator does have any cubed
that's cuz it's a simulator so it should
run pretty quick and then I bet they
don't even have a queue for it and then
here we can see okay there's fourteen
cute eighty-seven cube we can see
immediately when we're actually running
our script and then later you can even
work this in to pick the exact back end
right before you want to run so you get
the lowest queue so long as it has
enough cubits so different ones have
different cubits right the biggest one
available to me has fourteen cubits
whereas the rest of them have five so at
least right now the lowest queue is IBM
cube Burlington so we could say okay
let's use that one mm so the next thing
that we're gonna say is from kiss kit
dot tools monitor import job underscore
monitor what this does is it tells us
where we are in the queue and then where
we are when we actually go to run the
job so we're gonna say back-end is going
to be equal to provider dot get
underscore back back-end and then we're
going to pass the name so we said IBM
cube Burlington we'll just go with that
one that's fine so that gives us our
back-end
then we're gonna actually say our job is
going to be Q dot execute and then we're
gonna execute the circuit that we built
and then we're going to say the back end
is whatever back-end we chose and then
shots this is how many times we want to
send it through because again every time
you take a measurement it collapses to
one value so we want to send enough
shots through to get a decent
representation so I'm just gonna say 504
now
so then after well as we run CUDA
execute it's gonna stored a job but we
also want to do the job monitor for that
job so let's hope that works and if it
does I probably have to pause and wait
as we see what kind of cue I'm in okay
we are fourth and cue mmm sometimes this
runs pretty quick like historically like
I said if I was fourth in line it would
take less than a minute but lately it's
been taking a lot longer so we will see
I'm gonna code that at least the next
block and if it's done then it's done
and if it's not done
I'll probably just pause or something
and then if you're running one you can
either pause or you can just break the
current you know just hit stop and then
run it on a simulator and then later
come back and run it you know maybe when
you're gonna go eat dinner or something
wait in line and actually run the code
but anyway so so yeah so once that
actually runs we end up getting
something from the job which in this
case will be a result of it'll be it
basically be 500 results which are just
these counts of what are the the actual
bit values that we got in return and
it'll be 500 examples because we ran
this through the circuit 500 times so
now we're going to say it's from kiss
kit dot visualization we're going to
import plot underscore histogram and
again just like that
ASCII thing and even this is really cool
for matplotlib like these are all very
hard visualizations to make so really
impressed with whoever did all the
visualizations for for kiss couture I
assume it was probably multiple people
but anyway pretty cool one spot line
closer so apply histogram and then from
mat plot live I'm going to import style
you may or may not need to do this if
you're on a dark theme like me you will
at least if you want to see numbers and
then so I'm gonna say style dot use and
I'm going to
all this dark background and then we're
going to say result equals job dot
results so in this case it will be these
like it'll be a result object actually
but basically what it like I said what
it is is it's going to be a collection
of bit values right so it should be a
collection of you know in this case
there's there's four possibilities
because it could be a 1 1 a 1 0 0 1 or a
0 0 in theory it really could only be
one of those things but you'll see in a
second so job dot result and then let's
do counts equals results dot get
underscore counts for the circuit and
then we will do plot underscore histo
gram for the counts and then we'll say
legend well we actually don't really for
this one we don't need a legend that's
where are we in the job still in third
place Oh terrible and then obviously
everyone's job is a little different so
some people's jobs are pretty quick like
when we go to run this I feel kind of
bad because everyone's gonna be running
jobs but our jobs are actually really
quick like we don't really take that
much time to run this little simple
circuit but anyway so then anyway
whenever this is ready we would run this
now unfortunately I'm still third in
line don't really see any reason to stay
here second in line I don't want to sit
for too much longer but while we wait I
will say shouts out to the recent new
channel members I am sure Chung Chris
Austin Meyer Dean ariya and Corey
Schaeffer thank you all very much for
your support you guys are awesome
especially Corey Schaeffer if you like
Python programming tutorials and you
want more check out Corey shavers
channel if you just type that in to
search you'll find his channel really
good good tutorials so anyways I am Oh
our job is running look at that perfect
timing so our job is running hopefully
we don't get any errors if you do get
errors
is it job that Aaron maybe get errors I
forget what it is there is a way to to
access your her actual errors but even
this job is taking a while so I said I
think something's going on today that is
making things run a little longer than
normal people I thought it was quantum
computing I thought it was supposed to
be fast Oh has successfully kisk it
visualization visualization I was like
oh no do we hit an error huh
I just type out visualization let's try
one more time cool so we get our counts
now this is why we can't actually break
encryption so as you can see the the
most common response was one one which
is the the one we were supposed to get
but as you can see we got some zero zero
sum zero one and some one zero why is
that we have quantum noise notice how
everything in quantum physics just
sounds awesome
like this is a quantum tutorial I'm a
quantum teacher this is quantum errors
but anyway it's because of noise and a
lot of noise my gosh maybe that's what's
going on I don't know what's going on if
they're like throwing a party in the
same room that they have the quantum
machines who really knows but they're
susceptible to noise like a change in
temperature even right so these qubits
are stored at like as close to like
absolute zero as possible it is colder
than outer space right as far as we know
it's like the coldest it's the closest
place that we know of which is also nuts
by the way anyways mmm so okay so a
sense that took so long I think the next
thing I'm going to do is just run this
through a simulator if you're finding it
to go fast feel free to keep running it
through the real backends also if if you
you can run it either through the back
end you can run it through the actual
chasm simulator which is this one here
or there is the local version that you
could run but for now I think I'm
actually just going to run things on the
chasm simulator so I'm just going to
change the back end before I forget to
Kasim Kasim I don't need to type that I
can just copy a copy
pasta and now what I'd like to do is
actually change our circuit a bit so so
what I'm gonna do I think we'll just
copy what we have up here I'm just gonna
copy that
come down here pasta so we're still
going to be a 2/2 we start we started by
flipping X but instead what I want to do
this time is use a Hadamard gate
probably butchered his name as well
anyway what this does is it puts
whatever qubit you pass here and a
superposition so now we'll see the
result of whether this qubit was a 0 and
a 1 depending on how many shots we end
up taking so again we'll take 500 shots
though just so we do see what the result
is so we've so this one was in is
entangling qubit 0 and 1 together so we
already saw entanglement but we did not
see superposition and really
superposition is I mean they're part
they're both pretty valuable but
superposition is the one that's maybe
more bonkers but I don't know
entanglement is pretty pretty Bunker's
as well anyway so we're gonna run them
through the simulator and so we've got
the backend simulator buhbuh blah
circuit draw we take the measurement
there so let's go ahead and draw that
circuit make sure it makes sense so as
you can see we have the atom art gate
here but otherwise you've still got that
see not gate and then we take our
measurements so the only thing that we
flipped is rather than flipping qubit
zero now we're saying actually cubed
zero so when we flipped it we just said
cubed 0 is 1 basically now what we're
saying is qubit 0 is actually in
superposition and then we're running the
rest of the circuit so that's our
circuit now we can actually run that on
the back end so again we're just gonna
say job that executes monitor job so
we're actually using the the chasm
simulator so we'll still connect run the
job and then we'll get our result
so copy this come down here pasta that
this time as you can see we got two
major results either a 0 0 or 1 1 makes
total sense because again we're using
this C not gate and the only time it
will flip that second bit is if the
first qubit is a 1 so it's either going
to be at 0 0 or a 1 1 exactly what we
expected and as you can see since we use
a simulator it's simulating a perfect
quantum machine which we don't have but
that's why you don't see the other
options because it's it's simulating as
if we had a quant a perfect quantum
computer we don't so if I if we were to
run this exact same circuit feel free to
if you want but if we were to run this
exact same circuit on an actual quantum
machine we would have found that we got
vastly different results right or not
vastly different we would have found
that it was 0 0 and 1 1 were the highest
bars but we would have also seen some
noise ok so finally just in case you
know you're on the airplane right and
you don't have you didn't feel like
paying 20 bucks for the Wi-Fi you can
also run locally on a simulator so
that's the last thing I'm going to show
before we bounce out of here so the
other option is from kiss can't kiss kit
import air so this is your simulator
framework or a kiss kit and then we're
gonna say the sim back-end equals air
get underscore back-end Kasim Kasim
simulator and again there's also
multiple backends here you've got the
chasm simulator a unit teri simulator
and then a date vector I think but we
can also iterate over them so I'll do
that real quick so we could say for
back-end in air don't get back in flips
bat back ends prints back-end dirt get
back ends really what did I do wrong
here air get back end is it back oh I
try to do the same thing before all
right good ok so we've set our sim back
into already be the chasm simulator but
as you can see you get
state vector and unitary so again this
is what represents and is most closely
like the actual quantum machine that
you're going to use right you're going
to pass it through a quantum machine and
each time you make one pass you get one
measurement right things can be in
superposition but as soon as you take a
measurement you that superposition
collapses down to that value right so
you're going to pass 500 times so
there's the return you get from the
chasm simulator is going to be counts
for however many shots you passed state
vector on the other hand you could
actually just pass one time what you'll
get back is all of the possible states
right because it's a simulator okay so
one thing to take into consideration
though is if you're actually working on
real quantum like problems the state
vector simulator is going to be a
problem because you're going to have to
store all of the states and memories so
the whole point of quantum machines is
so we don't have to do that or that
we're going to solve problems that we
can't do that on a classical computer so
this is really cool and it comes with a
bunch of extra visualization type stuff
that we can do same thing here they're
all really good but but the chasm
simulator is most closely related to
what we're actually doing here so anyway
so once we've got the sim back-end again
we can run all of these exact same
things so I'll just take this pasta and
then rather than back-end will say sim
back-end and then we'll do this loop
wait for add because we're running 500
shots so don't forget and again our
simulator locally is also perfect so we
don't have any error so we only get
zeros around one one but okay I'd say
that's enough it looks like I've been
recording now for 46 minutes that's a
good introduction to quantum computers
like I said not an expert but there you
go
moving forward I don't know you know I
don't know how long this series will be
when the next video is coming out I'm
going to keep tinkering around I think
it's really cool it's a it's a
completely new paradigm it's a new way
for us to have to think about computing
so it's just really interesting to me
and I also think it's just awesome that
you can run things on a real quantum
computer like I said I'd find it similar
to if they if NASA let you control the
Mars rover so anyway really cool to
continue along like I said I'll put some
some further resources in the text-based
version of this tutorial also if you
just go to that quantum - computing to
IBM comm and then click the little thing
it looks like a jupiter notebook you get
start here and that has a bunch of links
to further information there's also a
textbook that i linked in the text-based
version of the tutorial why are you
taking so long thank you it's got a
whole bunch of information here I would
at least you know if you really want you
can go through all of this kind of stuff
here and then there's the advanced one
so you've got advanced and fundamentals
there's a bunch of stuff there's just so
much information and like I said I think
its side I think iBM has done a really
good job of just getting all this stuff
out there and making it really quick and
simple to get running right so yeah
pretty cool also again things might be
buggy also if especially the day I
released this video chances are the
queues are gonna be massive you might
want to wait you might just want to use
the simulator and then run it later or
something like that but okay
that's all for now questions comments
concerns feel free to leave them below
come join us in the discord that's
discord GG slash sent Dex again thank
you to the new channel members and I
will see you guys in another video