Posts Tagged ‘Anime’

Kenji the quantum computer, Part 2

Thursday, January 12th, 2012

He will use this knowledge in less than 24 hours.

So back when I was moving in at the start of the school year, I decided to try out my BD player on my hot new Dell monitor. Since I didn’t want to take out my Kara no Kyoukai BDs from their box, I opted to crack open the cheap flimsy Summer Wars case and throw in the disc. I hadn’t actually tried playing it yet anyway. I opted to skip the OZ introduction and go straight to the opening. First of all, I was disappointed that Funimation set the credits in goddamn Arial. Seriously, what? I find it difficult to believe they didn’t have Helvetica already from one of countless projects they could’ve used it on already.

More importantly, Funimation translated the chapter title of the book that Kenji was reading on the train. It turns out he was reading about Shor’s Algorithm. Shor’s Algorithm is the quantum algorithm that can factor integers in polynomial time. I alluded to it when I talked about Summer Wars and cryptography a while back and now’s as good a time as ever to get into it, since, you know, this means Kenji really is a quantum computer and all.

In quantum computing, instead of dealing with bits that are 1s and 0s, we deal with quantum bits, or qubits, that are denoted $|1\rangle$ and $|0\rangle$. These are really just quantum states. Quantum states have interesting properties, the most famous of which is being in superposition. Essentially, what this means is that we can have qubits that are in a state where it represents 1 and 0 simultaneously.

This turns out to be a very neat property to have. If we’ve got $n$ qubits, then we’ve got like $2^n$ inputs simultaneously. That’s great, right? We can compute things exponentially fast now! Well, it turns out it isn’t that simple.

Suppose that we do end up running an algorithm or something on our $2^n$ states. What happens when we want an answer? Well, we measure the state. The problem with that is that on measuring a quantum state, you won’t get all $2^n$ results. You’ll only get one of those results with a certain probability. What’s more is that once you measure a quantum state, you’re stuck with whatever it gave you and you can’t go back and check for another result.

That is obviously no good, because we want not just any answer, but, you know, the right answer. So it looks like approaching our problem from the naive interpretation doesn’t seem to work. And in fact, that immediately tells us that quantum computers aren’t a magic bullet that can help us solve SAT in a reasonable amount of time.

What we can do is manipulate our resultant quantum state so that the actual correct result we want is the one with very, very high probability and reduce the probability of getting any of the other results to near-zero. Of course, the problem is that we don’t know which result is the correct one to begin with. It’s actually this exact hitch that prevents us from efficiently solving general NP-complete problems.

Luckily, if we want to factor some numbers, we can take advantage of this. We can reduce the problem of factoring any old number into prime factors to the problem of order finding, which I’d mentioned before. For an integer $N$, there’s another integer $m$ such that $k^m=1\bmod N$ and we call $m$ the order of $k$ in the integers modulo $N$.

So suppose we have $k\bmod N$ with order $m$ and we decide to keep on taking powers of it, like $k\bmod N,k^2\bmod N, k^3\bmod N$ and so on. Eventually, we’ll get up to $k^m\bmod N$, at which point, that’s just $1$ and we start our cycle over again. The thing to note here is that this sequence is finite and periodic, which narrows down what we have to search through.

So what do we do? We create a quantum state for our period that’s in a superposition over all the powers of $k$ in $\bmod N$. We don’t know what our period is (that’s what we’re trying to find), so we just choose a large enough one that our order will be in the period. Now, in order to find this order, we do some magic with a Quantum Fourier Transform.

What?

So I mentioned at the beginning that when we look at a quantum state in superposition, we can think of it as returning one of the possible states with a certain amount of probability. How the probabilities for these quantum states work is actually more complicated and it’s from this that we can massage an answer out of our magic quantum algorithm.

Quantum states have something called amplitudes, which are kind of like probabilities, except that amplitudes can be basically any complex number as long as all of the amplitudes $a_i$ for a quantum state satisfy $\sum|a_i|^2=1$. If we’re just measuring a quantum state, this really doesn’t change anything, we just get state $|i\rangle$ back with probability $|a_i|^2$. But when we’re manipulating quantum states, there’s more to the amplitudes to consider.

If we think about amplitudes in terms of waves, we can see that we can cancel waves out. For instance, the states $\alpha|1\rangle$ and $-\alpha|1\rangle$ have the same probability if we were to measure them (since $|\alpha|^2=|-\alpha|^2$), but if we put them together and add them, they’d cancel each other out. What’s more is that since amplitudes are complex numbers, so we can think of them as having a direction (like a vector on the complex plane) and we end up with weird stuff like having things partially cancel out.

So just like a regular Fourier transform extracts some information about frequencies from a sequence, we can use the Quantum Fourier Transform to extract some information about all of this amplitude stuff that we can’t see just by measuring the state. And this is exactly how we can manipulate our state so that it increases the probability of the answer we want when we go to measure it and depress the probabilities of all the other answers.

Now after rambling about amplitudes and Fourier transforms and orders, we should probably step back and see what we’ve done in perspective. What we have is a way to find the order $m$ of an element $k \bmod N$. Well, actually, we don’t even have that quite yet. What we get out of all of that quantum stuff is just some information about $m$ that we have to manipulate further, except we just do that with plain old number theory instead of quantum computation. But, what we’ve kind of stumbled through is kind of a vague description of Shor’s algorithm.

Like I mentioned in the first Summer Wars post, this is the only way we know of so far that lets us factor large numbers (especially the ones that are used in cryptography) within a feasible amount of time. Again, Kenji (or at least his brain) is basically a quantum computer. Coincidentally, I played around a bit with what the implications could be if our brains were quantum computers in an earlier post on Kaiba.

But even if Kenji isn’t a quantum computer, he’s goddamn smart for a high school student. The theory behind the computing part of quantum computing is really just a ton of linear algebra, so an understanding of quantum mechanics isn’t really necessary (which is great, because I don’t know any of that crap). The quantum computing course that I took in my undergrad only had second year linear algebra as a formal prerequisite, but that was mainly to allow students from different departments to take it and also implies that you’ve got first and second year math down at the very least.

12 Days XI: Zettai Unmei Seizon Senryaku

Saturday, December 24th, 2011

「little world」/「momoc」

Yeah, I made the same joke last year. But who would’ve thought that we’d get two Utena derived shows within a year? Certainly not me.

But yes, Mawaru Penguindrum is a show that has penguins in it.

It’s fascinating how different Penguindrum is from Star Driver but still manage to be so heavily evocative of Utena. Having Penguindrum as a comparison, I realized that there really was no reason to expect that Star Driver would make as many callbacks to Utena as it does. I mean, it’s not like Igarashi and Enokido hadn’t worked on stuff together before.

Like Star Driver, Penguindrum exudes its own sense of style. In Star Driver, a lot of that is constrained to the more fantastical parts of the show, like whenever we’re dealing with Cybodies and the Glittering Crux. There’s no such separation in Penguindrum. Even in the real world, the architecture and shots of the locations are still really surreal. So while in Star Driver, there’s a clear delineation between real and fantasy, we’re often left wondering which is which in Penguindrum.

And the penguins don’t help very much in this department either.

Looking back at Star Driver, there actually isn’t that much weird stuff going on during the school life section of each episode. I mean, yes, weird events happen and all, but what you saw was pretty much what happened. In Utena, weird things where we’re not really sure how to take happen in the school life parts, which is the route that Penguindrum takes.

Structurally, Star Driver resembles Utena much more because of the clearly defined events that take place in each episode. On occasion, we’ll be missing, say, a song or something but for the most part, we know how each episode goes down. Penguindrum is not very repetitive at all, at least not in how each episode goes. Yeah, there’s SEIZON SENRYAKU, but those are really more diversions than a shadow play and then ZETTAI UNMEI MOKUSHIROKU followed by a substantial duel or APPRIVOISE followed by GINGA BISHOUNEN and a substantial duel.

Of course, all three still make use of visual symbols and phrases and keep on repeating them a lot. The obvious messages are pretty obvious because they’re shoved in front of you, but it just sort of piles on to you to the point that there are probably some other messages hidden under this mound of symbols you’ve suddenly got. I mean, every goddamn thing that shows up on the screen or uttered by anyone is probably a symbol. Has anyone dissected the Triple-H/ARB songs yet?

Penguindrum also differs from Utena and Star Driver by not being about a prince who strolls into town and upsets the establishment trying to revolutionize the world. Certainly, we’ve got our shadowy cabal trying to revolutionize the world, but it’s really more about two brothers trying to save their sister, which is much less grand. Of course, the penguins would probably deflate any sense of awe pretty quickly.

Not that I don’t appreciate the penguins. I think they’re an awesome part of the show. It’s an interesting way of adding another layer to all of those symbols we’re buried under, in that they supposedly are reflective of the state of mind of the characters they shadow. More importantly, their antics are just plain enjoyable and the show would be much more depressing without them.

Does the choice of penguins mean anything or does Ikuhara just really, really like them? It is a mystery.

Man, I wish I had a penguin that mirrored my internal thoughts and did errands for me and was invisible to everyone except me.

12 Days VIII: Actually, I don’t think I quite caught the bunny allusion

Wednesday, December 21st, 2011

「うさぎドロップ」/「ゆーた」

Single dad manga? Why not? Yotsuba&!’s great!

I don’t know whether there’s much I can add about Usagi Drop. The whole thing is fairly straightforward. It’s a great story about a guy who ends up having to look after a kid all of a sudden and gets into the ups and downs and details of it. I’m sure we’ve all been told that raising a kid is hard and doubly so if you’re the only doing it. Although I guess Daikichi lucked the hell out because Rin is probably the best kid you could hope for.

Okay, maybe I can say something about the much more contentious second half of the story, in which Rin is no longer an adorable child but is a teenager. The immediate reaction is “NOOOO why can’t Usagi Drop be about Daikichi taking care of little Rin forever?” but you know, it doesn’t work like that. Kids grow up and parents should get a chance to feel proud if their kids turn out to be decent human beings, which Rin is in spades.

But also important is that it has some loose threads that need to be resolved. Does anything end up happening between Rin and her mother? Do Daikichi and Kouki’s mom get together? Or do Rin and Kouki get together? I’d imagine a ton of people were interested in seeing how the last two questions get answered. Which of course leads us to the ending.

I’ve already talked about the ending and I’ve tried to understand where it came from. So a lot of people are pissed at the ending because it’s weird as hell and came out of nowhere. But more importantly, it was basically a punch in the gut for everyone who was waiting on those last two questions because it basically resolved the “problem” (because if you think about it, you can’t really have both happen) in the worst way imaginable.

Really, that’s the only snag of the entire thing and I’ll admit it’s a pretty big one. One of the great things about Usagi Drop is its realism and believability, which this development was not. Of course, this is only a concern if you’re at all interested in the manga. If your only desire is to remain in bliss solely in the realm of a guy tries to raise a kid without knowing how, then stick to the anime and the first half of the manga, which is the most adorable thing.

12 Days VII: I want to be a superhero

Tuesday, December 20th, 2011

「Mage Killer」/「三輪」

The first time I read Fate/Zero, I got through about half of the prologue before forgetting about it. That was before I read Fate/stay night.

One of the great things about Fate/Zero is that the particular Holy Grail War it covers is serious business. Instead of having a bunch of high school students kind of flail about, you have some powerful magi all scheming against each other. These dudes know what they’re doing. And actually, that all of these guys basically off each other one way or another kind of explains why we’re left with high school students ten years later.

The main draw of Fate/zero for me has always been that I’d heard it’s particularly brutal and that there was a magus going around ruining everyone with the help of modern technology. After reading Fate/stay night, Kiritsugu’s character became much, much more interesting. As much as people seem to think that Rider is the best (and I’ll admit he is pretty fantastic), Kiritsugu has always been the most compelling character to me.

Those who are familiar with Fate/ will know that it’s all about dealing with ideals, whether it’s defending your ideals, sorting out your ideals, or having your ideals challenged. It’s kind of an easy subject to bring up when fighting for the Holy Grail. Fate/stay night is essentially about Shirou sorting out his ideals. In Fate/zero, we have Kiritsugu, who has the same ideals as Shirou, but ends up choosing a vastly different way of realizing them.

This combined with the high calibre of opponents means that there is a ton of cool stuff that goes down in this story. The fact that these are people prepared for the Grail War and not high school students not only means that their fights are better just because they’re better, but they’re also much better prepared. Calling the Grail War a war in Fate/stay night always seemed a bit silly to me, but in Fate/zero, I think there are enough casualties and heavy weaponry to justify it.

Of course, that’s all after I went through Fate/stay night. So what drove me to try and read the books the first time? Well, I’d just finished playing Saya no Uta at the time. Saya no Uta probably remains one of the most horrifying and disturbing things I’ve read. So obviously, I was looking for more in that vein and found this light novel that the same guy wrote.

On the physical horror front, I think Team Caster’s got it covered. In terms of emotional despair, we’ve got everyone else who’s connected to the events of Fate/stay night. It’s mentioned somewhere in the notes of the first volume that there is basically no happy ending for Fate/zero given what we know plays out in Fate/stay night. Basically, everyone involved bets the house on winning the Grail and ends up ruining their childrens’ lives in the process.

It’s going to be a long three months once the first half of Fate/zero is finished. I guess there’s uncensored Team Caster fun times to look forward to in March, though.

12 Days VI: http://www.johntitor.com

Monday, December 19th, 2011

「シュタインズゲート・瓦礫と助手」/「huke」

Even though the track record for anime adaptations of Nitro+ games has been abysmal, I couldn’t help but hope that Steins;Gate would turn out well. After all, it’s the best visual novel ever or something according to Japan. And if it didn’t pan out, I guess I’d just fall back on the visual novel with huke’s pretty art.

And as I was watching it, I thought it was pretty funny and all. I was still trying to figure out why Japan loved this thing so much. It wasn’t until someone mentioned something about 2ch jokes that I think I got it.

So I’d known that Steins;Gate was about time travel, based on the synopsis. What I didn’t know was that the story was basically based on the John Titor story. And it the connection wasn’t superficial either. It wasn’t just, there’s a guy calling himself John Titor from the future on 2ch. A lot of details, like the IBM 5100 and the mechanics of time travel and divergence numbers, are taken straight from the story. You can think of Steins;Gate as one giant John Titor reference.

This is fascinating to me, because even though I’m not intimately familiar with the details of the John Titor story, I’ve been on the Internet long enough to remember this whole thing. It’s kind of weird to see something that was sort of the early-web version of an internet meme be used as the skeleton of a more fleshed-out story. I guess something like Densha Otoko would qualify as well, but I think there’s a lot less you can do with it to make something unique like Steins;Gate.

This whole aspect of Steins;Gate got me because I am a nerd and nerds friggin love references. I mean, look at any Shaft anime. But yes, Steins;Gate has tons of references and where there aren’t any, it’ll just create memes. For the most part, these references are all internet memes. If it’s not part of the John Titor mythos, they’ll be working in a 2ch meme. And then there’s stuff like EL PSY CONGROO and tutturu~ which seems like it was designed to be spammed across the internet.

The characters themselves are exactly the same kinds of people. After all, they encounter John Titor on 2ch. What kind of people read and post on 2ch? Daru and Okarin are really obvious otaku. But Mayuri seems relatively normal, except that she works at a maid cafe in Akiba and buys doujin at Toranoana. Okay. Even the most respectable and well-adjusted of the cast, Kurisu-TINA, is a closet VIPPER.

So I guess what’s special about Steins;Gate isn’t that it’s just a good story about a bunch of friends who fall into some time travel conspiracy. It’s that it’s a good story about a bunch of friends who are just like the people watching it who fall into a time travel conspiracy based on an internet urban legend.