How To Code A Quantum Computer
HTML-код
- Опубликовано: 15 июн 2024
- Have you ever wondered how we actually program a #quantumcomputer ? #Entanglement, which #Einstein called "Spooky action at a distance" and Superposition, which describes how quantum systems can have probability of being in multiple states at the same time, Allow for us to implement special algorithms which would not work on classical computers. Somehow measurement of a state instantaneously determines properties of an entangled partner particle, regardless of distance.
In this video, I aim to explain what quantum entanglement is, some of the math behind it, and how to create it in physical systems. #Physics can get incredibly confusing on a small scale because we as humans don't directly perceive how we interact with the laws of #quantummechanics, so join me as we explore what quantum entanglement really is.
Join My Discord: / discord
Become a patron: patreon.com/user?u=100800416
for access to my animation source code, video scripts, and research materials
Also check out my instagram: / lukasinthelab
-------------------------------------------------------------------------------------------------------------------------
Huge thanks to @Fireship and @SebastianLague For allowing me to borrow a couple of short clips from their videos. I greatly appreciate it! The timestamps are included below.
Fireship: 00:12 - 00:16
Sebastian Lague (1): 03:04 - 03:29
Sebastian Lague (2): 03:37 - 03:49
------------------------------------------------------------------------------------------------------------------------
Music:
Music by Vincent Rubinetti
Download the music on Bandcamp:
vincerubinetti.bandcamp.com/a...
Stream the music on Spotify:
open.spotify.com/playlist/3zN...
So upon watching this back with fresh eyes a few days later, I realized I made a couple of mistakes in the Deutsch algorithm portion of the video. In the next part where I code up the full algorithm these parts are correct. I got mixed up reading my old notes.
1) I said f operates on two qubits (a,b). f actually only operates on one bit, and we have two cases f(0) and f(1), this was confusion from the quantum part, where our oracle (quantum implementation of f) needs to take two bits in order to be reversible. That said, the function that oracle represents is only a function on one bit. If this is confusing I will explain it better in the next video.
2) The Deutsch algorithm classically would take (2) calls of f, not 3. The quantum case being 1 operation of f is correct still.
Sorry for the mistakes, like I said these will be corrected in the next video where I code up the full algorithm.
And you misspelled the name like everywhere, I got confused, because you pronounced it differently, so I looked it up too xD
Instead of a list of bits/bytes, try a superimposed number wheel/magic square. Kinda like wheel of fortune. But each number has its own wheel. The "number" is defined by the difference in positioning of spin, #2 starts "spinning" .10 seconds after #1. Kinda of like a substitution cipher. The code is gibberish without a unique custom "key"/"perspective"
You're forgiven ,😅❤
i noticed too that
Awesome content. Big ups ↑↑ all the best.
i called quantum IT support and complained that my quantum computer wasn't working. They said, "Have you tried turning it off and on at the same time?"
Lol😂
😂 A good one.
I called quantum IT support and complained my computer isn’t working. But then when I looked at it again, it was fixed! :D
They said in thieir parallel world, it seems working just fine
"I tried, but it was neither here nor there."
I'd be lying if I said I understood it fully. But this is definitely the video I'd rewatch many times to try and understand it.
I’m glad to hear it! This kinda stuff is hard for everyone - definitely took me multiple passes before I understood what was going on.
@@Lukas-LabI must disagree with @tongpoo8985, that I didn't understand one qubit of it. But I picked up a "vibe" from the 1970s/1980s, when Bubble Memories were going to change the world, the storage space and what not. A lot of money and research went into it, things "worked" but never scaled to be actually useful, and within 10-15 years the technology had mostly been forgotten. I get the exact same vibe about quantum computing... Maybe I am just a Luddite, but I seriously doubt that the scaling challenges will be solved, and instead something different will accelerate past it.
Honestly that’s totally fair. It’s hard to say whether quantum computing will end up changing the world.
The important thing is that it has the capability to, which is why I research it. I wouldn’t work on it if I didn’t think it had potential. But it’s totally possible that it doesn’t reach commercialization.
There's definitely an audience for videos like these. Fingers crossed you get the viewership your videos deserve!
Thanks! I hope you’re right:)🤞
I am actually sick of watching 🦀 ,
This video is little breeze of fresh air , just a little ,
Because I already knew about it beforehand
QC content is amongst the most of abused content
Followed by Einstein 's all 🦀
Been watching a lot of these to understand larger thought problems and warp drives
I've watched thousands of vids on quantum computing and this one was the only one that taught me quantum computing beyond the basics, so I learned a lot from this video. Thank you for the amazing video!
Wow, thanks! That’s great to hear :)
Same hear bro, I was looking for this.
But, idk what to do with this knowledge.
Whatever, the more you know
Well this is kinda interesting I made something that is basically an input counter that uses binary but the memory storage is structured as pascals pyramid which basically means that I have the input of 1 and 2 already which is 4 basic 2 bit adders that is basically just 2 t flip-flops and an xor as well as an and gate but hooked up in a way so that each input goes into each and the outputs don't interact with each-other and then I basically hook it up to a bunch of and's in which there is already 4 2's but you need extra for the horizontals Which would be for the extra 2's. then you do the higher numbers like 3 and 4 all the way until you get to 8 with a whole bunch of and gates which would be for memory because basically you have all the previous 1's and you would have to hard-wire them to each and gate individually. Well in the game i'm in basically and then you would use or gates to have each form of 2 inputs by a 2x2x2 cube of t flip-flops basically encoded as 2 for all of them. Which then you would use xor gates in which you would input the or gates into as an input which would capture all the numbers then use the xor gates from the highest row of each number to cancel out the lower numbers. So basically its an adder that has memory in the form of and gates and the input interface is a 2x2x2 cube of t flip flops. And if you're wondering where pascals pyramid is in reference for this memory based adder. Well its in the inputs of and's for every single combination of the 2x2x2 cube in which each and is a different value. And if you're wondering about the game. Well its called circuit maker 2 on Roblox of course. and the xor gates are to find every input of odd 1's basically the signals that are on but if it find's an odd number of signals that are on then it outputs a 1 and if it finds an even number of 1's it outputs a 0 basically turning off. And for the and gates you basically have all the inputs set to 1 and so if a certain combination of inputs are set to 1 you can basically hook up those inputs into an and value and then you have a certain pathway for that bit of memory which is how I made my adder work. It's very simple actually and I think it's something that would be a bit difficult to do precisely because it would be tedious to set all the wires and ect. Also anything with a n like a nand gate or a nor gate is basically the opposite of the other gates. Also the sequence because I hooked it up to xor gates made it have significantly less memory that I have to use primarily because it cut all the 8 one values by half making it so that I can have the values of 1,4,10,16,19,16,10,4,1 instead of 8,20,32,38,32,20,8. and then if you want to expand it you basically have the same adder module and then double it and then you wire them together with a bunch of and's and then use a bunch of or's and xors afterwards to make something that would add base 10 integers that would be for every combination of 1 and 8. Which then would be 1,1. 1,2. 1,3. 1,4. 1,5. 1,6. 1,7. 1,8. 2,2. 2,3. 2,4. 2,5. 2,6. 2,7. 2,8. 3,3. 3,4. 3,5. 3,6. 3,7. 3,8. 4,4. 4,5. 4,6. 4,7. 4,8. 5,5. 5,6. 5,7. 5,8. 6,6. 6,7. 6,8. 7,7. 7,8. 8,8. Which each and value would be of storage for the on's of those specific numbers.
@@RobloxPrompt No Zeroes?
This is easily one of the best references I've encountered on this topic. Your style is so damn enjoyable, and I'm sure 3B1B would be stoked to see Manim used so deftly. Look forward to seeing more on the topic, this is an easy instant subscribe.
Thanks so much, this really means a lot!!
im new and only 1 min into your vid, but i rly have to appreciate the little summary at the beginning! its so cool to get an idea of the content of the vid
first time watching it. understood nothing. started studying CS. I will be back once I understand it and edit this comment no matter how long it would take me
1 month keep going
initially cs is very difficult to learn, but with time it becomes easy, so don't give up at initial stages
How's going?
@@shamanthrs1284are there rly ppl this is easy for?
2 month, he learned first page of 5000 from chapter 1 of 100 from book 1 of 10
understand only 20% ,
80% gone over on my head
Thanks for your effort
I look forward to a series on this kinda stuff! I've been writing programs since the 1980s, and seeing how quantum computer programs work is fascinating.
I’m glad this video was helpful!!
This video is brilliant. He explains the right concepts, in the right order. It's very rare to find an explanation that doesn't digress into irrelevant concepts. This video shows exactly how simple the idea is and how, in a way, it is not necessary to know quantum mechanics in depth.
Wonderful presentation with great information. I hope your channel grows, you deserve it!
Thank you! That means a lot :)
idk how i stumbled on this channel but im glad i did. very clear and concise ( well as much as you can given the subject 😅) cant wait see whats in store for the future
This is the first time I actually understood the advantage. Great explanation. Thanks
That's one of my favorite explanation of QC in very nice slides and animation. Well done! 👍🏼
At 17:24 you show the full state, but without distinguishing the states of qbit 0 and 1. Of course there is no commutativity, but I think it might have been clearer to show what belongs to what, with a subscript id or a color, that is also added to the qbits in the graphic above. IDs seem useful since they show up in actual use, like qiskit. Could even be both ID and color.
This would then help to follow states of qbit 0 and 1 throughout the equations shown next, adding a lot of intuition for those unfamiliar with braket notation.
Yeah, you’re probably right here. I thought it would be clear that the first qubit is the one initialized to 0 and the second is the one initialized to 1, but I should’ve explicitly stated that. Thanks for pointing that out - I’ll make sure to keep better track of that in the next video.
This video is very nicely put together appreciate you spreading your knowledge and once it gets recommended to other people just like it did to me you will find an huge audience 😁
Thanks for the support, I put a lot of work into these videos so I really appreciate it :)
Agreed dude wonderful job, if you were testing the waters here keep going because you explain it well and are a great teacher, great video(s) subscribed@@Lukas-Lab
It's good to keep in mind that each gate has different risks involved, like different classical gates having different CPU cycles, error thresholds, or temperature loads on different architectures and actual hardware. But these costs are very emphasised in quantum computing because of how sensitive the system is to external interference and the specific conditions the system has to be held under to remain stable, and with how overloaded each component is due to the low number of qubits. So I would think that it's unwise to use highly abstract languages to generate the gates themselves since the specific deployment of the gates matters a lot for actually using the quantum computer.
Yep this is all true - it’s just that if I were to cover all of this in a video intended for a general audience the video would be way too long and detailed. This is all information I would include in a detailed course lecture for example.
Luka You earned a subscriber today. I appreciate your hard work and research went in. Found someone like minded and catching up with future in present. You are AOT
subbed within the first few minutes of the video. I could already tell you make a good teacher. I took Electrical engineering in college so I really appreciate this video from an engineering view.
To do quatum computing i choose EE and moderne physics or CS and Moderne physics
I like your video and content quality. may you achieve higher than expected!
very concise, knowledgable, thank you
Dang! These videos are fantastic! Keep up the great work! It’ll pay off in the long run as this technology takes off!
i love this kind of content, keep up the great work !!
Leaving this comment to say a very genuine thank you as your videos have provided significant aid in my final year dissertation as a Comp Sci and AI student studying in England. Please I'm sure everyone would love to keep seeing videos from you in the future.
Thanks for the comment man, things like this is why I love to make videos :)
You're a great teacher. Thank you!
Dude thank you so much, this is the exact thing I wanted to know for months :)
Glad it helped!!
Awesome video! It was great to hear you talk about neutral atom qubits and rydburg interactions as this is exactly what my lab does. More on the physics would be great
That’s awesome! Yeah - I’ll probably do deeper dives into each type of qubit later on, although I don’t have any immediate plans for that.
I think the interpretation as matrices is super important, not something to be glossed over (eventually), because as you said it ties into every operation being invertible, and it shows us explicitly how the entanglement works and how it can be resolved without necessarily having to collapse the superposition, as well as giving us neat formulas for the composition of gates via diagonalisation over a finite field (also maybe we should also get into how to express states using the tensor product and vectorisation).
I totally agree, problem is this is a channel for a more general audience. While I’d like to go deeper into the linear algebra I want to keep the videos approachable so that more people can understand. At the end of the day my goal is more to get people interested than to get people to know exactly how to reproduce the algorithm, there are great instructional videos I can link if people want to learn that as well.
He's right, I barely understood all you said and I feel bored.
Excellent video, looking forward to the next one.
Thank for this luka what a great explanation just subscribed now
Subbed! Incredible quality. I feel strong 3Blue1Brown vibes, which is a big compliment imo.
Thanks so much! I’ve taken a lot of inspiration from his videos and style.
@@Lukas-Labhe’s not joking lol I genuinely thought this was done by a huge stem channel like 3blue1brown. I also don’t leave comments, but felt like you should hear it
I don't even know how normal computers work in yhe first place but this is a genuinely interesting topic and I'd love to know more about it and one thing is for sure i will definitely be re-watching this video many times thanku for this content
If you'd like to learn about how classical computing works check out Ben Eater. He starts by explaining how semiconductors work and then works his way up through logic gates and microcode and eventually has a working computer built up one piece at a time.
If you want to learn more about quantum mechanics, well... PBS has some good science content, and you can find some of Feynman's lectures as well. It's a difficult subject to come to grips with, though.
If you'd like to learn more about quantum computing, this video may actually be the best thing you can find without spending money, at least for the time being. There's an old video on the Microsoft Research channel called "Quantum Computing for Computer Scientists", but it mostly just covers the same material in-depth without the visuals and assumes that the viewer was already familiar with the material a bit. It sounds like Lukas has a second video, though, so that would go beyond what the MS video covers.
This is the best series on this subject and i hope one day i will understand this topic. What we have been introduced to is two basic concepts that make quantumn computers unique. 1. Superposition so why is this good? If i could superimpose useful information maybe but if i dont know the state isnt that a disadvantage? The second concept is entaglement is this useful so i can observe a result? Or can we entangle particles diferent ways? For example can we entangle one qubit the match another and another to be opposite to test combinations? These are some basic questions that i have about these machines.
Well explained! Man, gotta admit you're such a great storyteller at such hard topic 👍
Thanks! I really appreciate that
Awesome video dude! You explained it very concrete so it was easy to understand. I wonder if its really that simple tho.
Check the next video, I coded it up and you can follow along and see for yourself :)
super well explained!!!
Great addition to a great collection
Thanks!
Interesting. I can’t wait for the next video.
interesting video and animation. i hope you achieve great heights with your gift of teaching efficiently.
Thanks!!
The good side of YT
I learn a couple basic programming languages an now it has me watching videos like these 😂 … Incredible video btw keep it up !
Awesome! Thanks for tuning in!
This video is absolutely brilliant!
This is beautiful. Thank you so much.
The fundamental explanations and 3Blue1Brown animations are so smooth!
Thanks!!
Love the video, keep it up man, you are great!
Thanks! I appreciate it
Thanks, you made this understanable to some extent, which is very difficult to do.
Great! I’m glad :)
I'm glad you made this video. I don't completely understand everything 😅but I'll definitely come back
This video was truly helpful and amazing to watch but there's one thing I didn't quite get where is the second part I believe you haven't made it right and if yes when do you think it will be ready because I am very excited
Parts 2 and 3 are up on the channel, they’re in a playlist together. Second video is called “I coded a real quantum computer”
Nice video. Keep up with this channel pls! Good content.
Thanks!
The production and thoroughness of this video and its explanation is phenomenal! Unfortunate that the views don't reflect that. In my opinion, the thumbnail of this video needs to be updated and improved with a more catchy title. I feel as though the actual content of the video, especially the first 13 minutes, don't immediately reflect the title, so changing the title shouldn't be an issue. This video gives heavy 3Blue1Brown vibes. I'd suggest to make a thumbnail and title inspired from that style.
Great work!
Thanks for the tips! I appreciate it :)
Honestly, this is one of my best performing videos by far - so I’m really happy with the view count lol. That said, I’ll look into optimizing titles and thumbnails, its hard to say whether the 3b1b style thumbnails would work for my content, but I may give it a shot.
Can't wait to see this programmed out :D
hey! would you recommend some literature on this topic? quantum computing, also what do you think about neural networks in QC? do you have any suggestion reads that eventually would make this topic comprehended?
It depends on the level you’re looking for. Nielsen and Chuang is a great textbook on the topic, there’s also a lot of good review papers that go over things in more depth. If you join my discord server I am compiling a list of different sources over there in a Google doc that I’ve shared
Hey, that's Sebastian Lague's digital logic circuit simulator at 3:37! Love that guy's work. I noticed you didn't mention him in the video
Hey - yeah I’m a huge fan of his work too. I emailed him and checked to see whether it was alright whether I used a short clip. The clips are in the description I forgot to link the videos though - so I should add those.
@Lukas-Lab oh cool! Its just nice to see some appreciation for that legendary individual. Respect to you bro
C++ and C gives you direct access to binary instructions via assembler. Not saying its very pratical but I've seen it used a few applications, but I wouldn't be messing with assembler unless I was doing something very low level like writing drivers or a kernel
wow, just wow, loved the video!
Thanks!
Great presentation. I might have missed it, but why does the Hadamard gate have a "-1" element in row 2, column 2? I've been doing some casual looking around, is this related to a Bloch sphere representation of quantum states? Thanks.
Thanks for the comment!
The hadamard gate maps the state 0 -> (0 + 1)/rt2 and 1-> (0-1)/rt2, since we started on the second line with a 1 state we pick up a - instead of a +
Edit: yes it has to do with the Bloch sphere. The H gate is a 90 degree rotation, so if you rotate 0 by 90deg you get +, if you rotate 1 by 90 you get -
Good stuff. Keep it up!
Thanks for the support! I’m glad you enjoyed it :)
Great video!
There is a typo: the algorithm is called Deutsch algorithm, not Detusch.
Ok, I should read all comments before posting, someone already mentioned it 🙂
Great intro video! Though I'd challenge the notion that circuit building languages are "machine code" for quantum computers. I think that would be the pulse program controlling the physical qubit, which the circuits are a higher level abstraction of. That might not be within the scope of what you were going for in this series though haha
Actually that’s probably a good point - I like this description better.
@@Lukas-Lab Thanks for the response! Eh, I feel like it's fine to call circuit notation "machine code" most of the time, once you move to like measurement based quantum computers though, that notation just kind of fails to be a real primitive. Definitely fine for an intro video, I'm just being unnecessarily picky. Either way, I love to see people spreading the word about quantum computers, I really appreciate you making this series!
I'm a nerd collector,I collect nerdy RUclips channels! Subscribed!
now this is INTERESTING!
Amazing video 👍
Great video!
Perhaps, the better to understand explanation would be, if you used micro controller programing example.
Like, how square root calculation progress works in digital computer vs quantum computer.
One (1) is when electricity flows.
Zero (0) when electricity breaks.
So micro processor works to manipulates the electricity flows
I enjoyed watching this ❤
Great stuff this is our future😊
Luka i again revisited your videos , one thing that I am struggling is to understand the maths notations that you explained . Its going above my head. Could you made some videos teaching maths in easy language to understand. Also if you could share some resources to learn the same so it becomes easy to understand your videos.
This is a great suggestion! Absolutely I’ll do that.
@@Lukas-Lab Thanks bud
I am so confused but good video none the less!
Cannot wait for quantum JavaScript to become a thing, quantum async just sound like a ton of *fun*
great video! good job!
Thanks!!
good job Lukas Lab. A Compiler in a classical computer like in C language generates "static binary". Alternatively, an interpreter like in Java, Python etc generates "dynamic binary".
Do you use the 3brown1blue software to make videos? It looks familiar
Genuinely amazing video
Thanks!
Hi, quick question, what do you know about the Quantum Internet/Quantum Intelligence? Thank you
Quantum internet is still in its infancy, I know a bit about it and I’ll probably make a video on it in the future.
What do you mean by quantum intelligence? Do you mean using quantum computers for AI/ML?
Great video mate
Thanks!
Great explanation, Lucas! How might quantum programming evolve as quantum hardware becomes more accessible?
As the hardware becomes more accessible there will likely be more stuff written on top of things like qiskit and other libraries, so it’ll probably be more accessible to people who don’t know QC in depth. At some point it may be completely disguised, so that all you have to do is remote into a QC but never actually write quantum code yourself, just using libraries that have been implemented and results from the cloud. Not sure how it evolves past there - but seems plausible if things progress at the rate everyone hopes they will.
Ah yes, magic
Can you do a video explaining how to store and distribute videos and other medias with a quantum computer?
Nice video the best on the topic. But i still dont understand what the gates do and how superposition is useful.
You are appreciated
more quantum computing code videos please
Will do! The next vid will be a more detailed walk through coding this up. Then after that I’ll probably do a video on shors algorithm.
Thank you ❤
Bro! This the first time someone made sense out of “what is quantum computing?”!!!
Now I want to learn how to code more
Interestingly, python, as you mentioned is an interpreted language rather than compiled meaning that a separate program written in C will execute your python code rather than building to machine code.
I love your content
I understand everything i am gonna change this industry
Famous last words brody. Don't say it too loud.
*Great video* Thanks Lukas.
Can quantum computers implement standard math operators like + - * / % ? *IF YES* then Quantum mod operator can be used to solve *integer factorization problem* without the complexity of the Shor's algorithm.
Simply pass all d Qu-bits of the denominator through d Hadamard gates to get the *probability-balanced* second operand of the quantum mod operator representing all D = 2^d divisors at the same time.
Now perform the mod operation on the numerator N (the RSA semi-prime to be factored) and you get the d Qu-bit quantum register representing all possible (2^d) remainders in the quantum entanglements of those d Qu-bits. Only 2 out of those 2^d combinations has remainder 0, due to 2 prime factors, which can now be *extracted* through a multiply and then add operation to get the sum S of the 2 primes.
Now that you know the sum (S = p+q) and the product (N = p*q) of the 2 prime factors (p and q), you can use a classical computer to calculate the 2 factors (p and q).
*Example for an 8 Qu-bit Quantum Computer* using python just to show the computation (this is not scalable for classical computer and meant only for quantum computer)
>>> p, q = 223, 211; S, N = p+q, p*q; S == sum([ n * (N % n == 0) for n in range(2, N) ])
True
Interesting Topic!
Great! I’m glad :)
I am a native german so I didn’t understood all of it, but this made me really interested in quantum computing. Sadly there’s no german university that has quantum computing
The more I learn the more I realize I don’t know anything. Good video 👍
Thank you, Luksa's Bla!
What a great way to explain entanglement. What does that even mean?
Good Video.👍🏻 Hope to see you post more often😅
Thanks! Yeah - I’m gonna pick back up with the uploads. Had a long break over the fall since I was busy taking classes, but now that my classes are less intense I should be back to posting more frequently :)
3:59 So, source isn't *necessarily* compiled to machine code -- consider a direct-style *interpreter* -- but in *any case* machine code is being, ultimately, what's executed.
I understand it all. 1 question, If I watch a movie on it will it be different from the original movie?
I saw some demonstration using this algorithm as an example of how P is different form BQP, but is the f in the Deutche Jozsa Algorithm actually a binary function? It looks like it's actually defined on an infinite domain which is like D = (C x C) I guess, so maybe transferring it to a classical computer would make it computable in polynomial time on classical computers too? Also can't we simulate the Hadamard function in polynomial time?
Any quantum circuit made of only one qubit gates would be trivial to simulate classically. The hadamard gates are super important because they get you to the point where entanglement can take over. Also the function is binary not defined on an inf domain, the function operates only on 0 and 1 in a defined way. While the coefficients in the superposition could be anything, it doesn’t matter to the function, the function never computes something based on those coefficients.
Haven't seen anyone mention it but as I'm from Deutschland I just wanna mention it's the "Deutsch" algorithm. You pronounced it right but spelled it wrong :) Anyway great video 👍🏻