Archive for the ‘Anime’ Category

12 Days I: Catch you, catch me

Wednesday, December 14th, 2011

「闇の力を秘めし鍵よ」/「hatsuko」

I don’t think it’s that much of a surprise if I tell you that Madoka made me watch Cardcaptor Sakura. Well, that’s not entirely true. A more accurate phrasing of that statement would be, I watched Cardcaptor Sakura in anticipation of Madoka. Yep, I spent a good chunk of the Christmas break just before Madoka aired watching the entirety of Cardcaptor Sakura.

Cardcaptor Sakura seems to be one of those childhood anime that sits alongside the likes of Dragon Ball or Sailor Moon. I actually had no idea it was dubbed in English and aired here until when I was way too old and cool for that crap. More recently, it went from ‘that show that a few of my friends watched that seemed lame’ to ‘that show that people cite as the epitome of its genre’.

CCS is a pretty lengthy show, at about 70 episodes. After I got into the whole magical girl thing, I’d planned to watch it eventually, but never really had the time or motivation to do so (which is fairly common for shows that I plan to watch because I “should”). But with 2011 and Madoka quickly approaching and having finished all of my grad school applications, I convinced myself to finally start.

Up until then, my benchmark for magical girl shows was Nanoha. As far as Sakura and Nanoha go, they’re pretty similar. For a while, before I watched either of them, I’d get them confused sometimes. Obviously, I knew that CCS wasn’t going to have huge explosions or funnels, but it was sort of surprising because I’d forgotten that magic doesn’t necessarily manifest itself as a giant pink beam of death. It turns out magic has a wide array of uses.

Speaking of magic, I was surprised to learn that Sakura’s magical girl outfit was not and that there wasn’t even a default outfit. I don’t even know if she actually ever wears the one that she’s seen wearing in most promotional art in the show. The only constant in her magical girl wardrobe is her staff. But nope, Sakura’s eclectic fashion is thanks to Tomoyo.

And I’m not entirely sure when it happened but the focus of the show seemed to shift slightly from Sakura learning to be a magical girl to include falling in love. She basically spends the entire show tracking down the Clow Cards in some way, but somewhere along the line we also get scenes of her and Syaoran sorting their feelings out. Something that I didn’t expect was for the entire show to basically consist of Sakura dealing with the Clow Cards. But even then, the last thing that Sakura had to do before everything ended wasn’t to save the world, it was to tell Syaoran that she loved him.

This love thing was new to me, especially coming from Nanoha, where at best, we have some best friends forever stuff crossing the line occasionally with undertones. Girls and boys interested in each other? Why I never! But it was interesting because it actually went there instead of dancing around it. And it was quite nice seeing Sakura and Syaoran growing in that way.

I think this show made me realize it’s okay to watch shows made for little girls even if they’re not wrapped in a layer of beam weaponry and sci-fi military trappings.

P.S. despite this post’s title, the best OP is Platinum

“12 Days of Japanimu”

Tuesday, December 13th, 2011

「キャスターと龍之介」/「ラク」

It’s that time of year again, in which I brush off a bunch of drafts that I’d hoped to post over the course of the year but didn’t get around to finishing on time. A funny thing happened on the way here, which is that I was expecting to not have enough to post about. The reason is that I would have been posting consistently about all the things I wanted to post about all this time. But as it turns out, well, “@blkmage ha ha haaaaa”.

Look forward to twelve days of quality handcrafted posts about some japtoons.

Suugaku Girl supplementary handout for chapter 2: On definitions

Thursday, December 8th, 2011

An introduction to mathematical writing

In chapter 2 of Suugaku Girl, we’re introduced to the third component of the little love triangle that’s forming. Tetra is the underclassman that the main character is tutoring and she’s one of the many people who think they might like math but school eventually beats that silly thought out of them.

Anyone who’s taken a real math class will know that by the end of it, your notes are essentially a giant list of definitions, theorems, and proofs along with an example thrown in once in a while. By a real math class, I mean a math class that’s actually concerned about reasoning about how we get our theorems instead of focusing on how to use them for practical applications. I did my undergrad at a school where math has its own faculty and where there’s a lot of rivalry between the various faculties. Everyone in math often jokes about how an example suffices as a proof for engineers and their ilk.

I checked your textbook for a proof and it said that we’ve done enough examples for it to be plausible. Must have been written by engineers.
— Vanderburg, PMATH 340 (F09)

Here, Tetra falls into the same trap when the main character asks her to define what prime numbers are. So MC-kun has to explain how definitions work. First of all, definitions have to be precise, just like theorems. It’s pretty easy to lose marks for misstating theorems and definitions by leaving off an edge case for 0 or 1 or something silly like that. Of course, that leads Tetra to question why these things need to be so precise and arbitrary.

One of the things I realized about math is that it’s all about trying to do things with the definitions you start out with. You can kind of see that in how the number system is built up. We can start with plain old numbers that we use to count things. And then we can add things to it. Like, what happens if we have less of a thing, how would we represent that? Tada, we’ve got negative numbers. Okay, now what if we have a part of a thing? Now we’ve got fractions. And so on and so forth. We realize that not every number can be written as a fraction and suddenly we’ve defined real numbers.

I’m sure we’ve all wondered why complex numbers work out the way they do. It’s because we’ve defined everything to work out like that. Some guy tried to take the square root of a negative number and found that it didn’t work out very well, so we defined the square root of -1 to be $i$. Now we have this $i$ thing, what can we do with it? Well, we can just start writing crazy things like $3 + i + 4i^2 + 5i^3 + 9i^4 + 2i^5 + 6i^6$, but then we realize that it just becomes $2-2i$. Well, okay that’s kind of neat.

But now we know that all complex numbers can be written as $a+bi$ with $a,b\in\mathbb{R}$. So someone along the line must’ve been like, what would happen if we tried to graph these things? So we treat $a$ as the $x$ component and $b$ as the $y$ component and it turns out we can think of complex numbers as other structures like a vector or just a 2-tuple or something. And suddenly, this gives us a way to compare complex numbers, by taking the length of the vector that they define. And now that we have vectors, we can do some weird geometry stuff with them. We can think of these things as the length of the vector and the angle that they form. And then you can go crazy and talk about roots of unity or what multiplication of complex numbers might mean.

The point is that all of mathematics is built up like this. You start off with some definitions or premises and you go nuts. Of course, you don’t have to use the same definitions as everyone else. The problem with doing that is you might not end up with anything interesting. Like, what if we did something nuts and defined 1 to be a prime number like so many people do when they leave off that condition? Well, not much, we’d probably just rephrase all of our theorems to exclude 1.

On the other hand, sometimes when we play around with definitions, we do end up with something interesting. For instance, we can define something called the extended complex numbers, which is just the set $\mathbb{C}\cup\{\infty\}$. Yep, we just say okay, infinity is a number now, deal with it. So what can we do now?

Well, we can divide by 0 now.

I imagine there might be a few people who might flip out at this notion, but yes, since $\infty$ is included in our number system, we can define $\frac{1}{0}=\infty$. Of course, we can’t do everything — $0\times\infty$ and $\infty-\infty$ still don’t mean anything. But if you’ve been paying attention, you might be going, okay well, we can divide by 0, but what else can we do? Dividing by 0 is kinda meaningless if there’s nothing new we can do.

As it turns out, the extended complex numbers defines a very different geometric object. If we remember from the example of the complex numbers, we can basically define every complex number as a vector over a two-dimensional plane. Here, with the extended complex numbers, we can define every number as a line passing through something called the Riemann sphere. And like the complex plane, this sphere lets us create weird relationships between numbers and angles and stuff. This turns out to have interesting properties in complex analysis and quantum mechanics.

So yes, definitions are often arbitrary. Why? Because it’s just useful and interesting that way. You could argue that it’s because nature forces us to define things a certain way. Kind of like, of course you can’t take a square root of a negative number, you just can’t do it! What happens, though, is that we always seem to end up finding useful things that line up with our mathematics rather than inventing our mathematics to do useful things with. After all, mathematicians have been playing around with imaginary numbers for at least a few decades before electromagnetism was even discovered.

Fun with computer science in Kaiba

Wednesday, November 23rd, 2011

「希望」/「niuya」

I’d been rewatching Kaiba with a bunch of people a while ago. Kaiba’s a great show to watch if you want to talk about things, especially if you like dealing with the sorts of moral and ethical issues that come about in a world that’s so starkly different from ours. The obvious things to talk about revolve around identity and existence. Being the computer scientist and the guy who likes to make laboured analogies to things I like, I began to think about memories and cognition from a CS point of view.

Kaiba’s already done a lot of the “what if” in exploring the idea of memories that are as easy to work with as data on today’s computers. There was an observation in one of the episodes that it seemed like one of the characters’ had too many memories and seemed to be unable to create anymore since there was no more room to store them. The obvious answer to me seemed to be just to throw in another disk or something. Of course, another thing we can do, since we can manipulate memories like data, is to selectively choose less important things to throw onto that extra “disk”. In a way, that’s kind of like what we do already, except instead of having a machine suck out our memories, we do things like write them down or take pictures of them. And in the case of photos, it kind of is like having a machine suck a memory out. In either case, that relieves us of the burden of having to keep it in our brain.

In light of this, it’s kind of a good thing that our brain cells do decay eventually and we do forget things. Otherwise, without a way to manipulate our memories like they do in Kaiba, we’d actually run out of room. Usually, we like to think of data or information as this ethereal sort of thing, but realistically, it’s constrained by the physical world. Those bits have to be written down somewhere, whether it’s on a magnetic platter on a hard disk or in a cell in our brains or in a photon in a quantum computer or in a weird capsule like it is in Kaiba.

Recently, someone linked to something about solving NP-complete problems in polynomial time by taking advantage of the many-worlds interpretation of quantum mechanics. This lead me to some of Scott Aaronson’s papers. Scott Aaronson is a complexity theorist who does quantum stuff at MIT and writes a neat blog. I read through the lecture notes for this course he did while he was a postdoc at Waterloo called Quantum Computing Since Democritus and a paper called Why Philosophers Should Care About Computational Complexity. These two things attempt to tie computational complexity and quantum computing with philosophy (duh). The Democritus stuff is pretty accessible if you have a bit of mathematical background and it introduces concepts like computability, complexity, and quantum computation if you’re not familiar with them. The complexity for philosophers paper assumes you’ve done some computational complexity.

So in Kaiba, we can send our minds around and stick them in other bodies or even in machines. But if we can stick them in machines, what’s running it? We’re not sure, but if we can build machines to interface with our minds or run those processes, then we’ve got a computer that can simulate our brains. This is where computational complexity comes into play.

Aaronson notes that a lot of people who think they consider AI a metaphysical impossibility really haven’t thought it through that far and are only considering the practical impossibility. For instance, what can we extract from the fact that Kaiba has computers that can simulate brains? One thing is that simulating a brain can be done efficiently, presumably in polynomial time.

See, in computer science, a lot of things (like simulating a brain) are possible if you just hardcode everything into a lookup table. Luckily, like I mentioned before, there’s a finite amount of stuff we can hold in our heads. So yeah, you could simulate a brain like that and it’ll work because the table’s finite, but you’d probably run out of atoms in the universe to hold all of that data and the possible choices that would branch out that the computer could make as it went along. Of course, that’s only a practical concern.

Which is why Kaiba’s brain simulating must be efficient, otherwise it wouldn’t be physically feasible. This would seem to imply that simulating a brain didn’t turn out to be that hard. Of course, this means that we’ve got a way to formally describe and model the way brains work too. Anyhow, this is all to ask, if we did have a way of doing this, would a computer simulating a person be that person? And then, we can go a bit further and ask whether a person that we’ve fabricated the data for and is simulated by the computer also constitutes a person.

It’s kind of the same question as whether clones would be people, isn’t it? Except instead of creating perfect copies of the entire person, we can just create perfect copies of the person’s memories and throw it into a computer. Of course, this leads us to the implication that brains are deterministic. Otherwise, this entire memory transfer thing wouldn’t work. You wouldn’t be able to designate a person as their memories if how they behaved changed with the brain that they occupied.

We do have some indication that the brains seem to function differently based on the body that they’re controlling. When Kaiba is in Chroniko’s body and meets the girl who’s in the huge guy’s body, they mention something about getting used to the body. It does make sense that biological processes are governed by the brain and isn’t tied to the person’s identity, but then we see how the body interacts with the person when they start to have ~feelings~ for each other. Of course we can consider the body as another part of the input into the brain and then that discrepancy goes away.

So the thing is that in Kaiba, we’ve got a way of creating something that’s literally indistinguishable from a person. Well, okay, we did start with the premise that it’s possible to simulate a person’s brain, which is kind of a stretch in the real world. But now we ask, what properties would human consciousness need to have in order for a computer to be unable to efficiently simulate it?

It turns out there are some possible ways for this to happen. For instance, if we could solve NP-complete problems or do quantum computations, then a classical computer wouldn’t be able to simulate our brains. Of course, that’s assuming P≠NP, so if it turns out that P=NP, then we might have to rethink this condition, and a quantum computer will be able to do quantum computations, so if we ever built one of those, then that also reduces our options. And of course, the bigger problem is that it assumes we can solve NP-complete problems or do quantum computations in our head.

On a slight tangent, this idea of quantum computations in our head leads to the question of what happens if our brains stored quantum information. That would make it very difficult to make perfect copies of our memories because of the no-cloning theorem in quantum information. The theorem is exactly what it sounds like: it’s impossible to make a perfect copy of an unknown quantum state. What this would imply is that if you tried to make a copy of yourself, it would not be 100% identical to you. Admittedly, it’s pretty unlikely that our brains can store any quantum information.

To close, something that’s slightly related, since it happened around the same time as I was watching, was a department seminar I went to where the guy was talking about neuroscience and brain imaging and tying it into graph theory. Essentially, what he did was he took a bunch of MRI scans of someone’s brain and created some graphs on them somehow. He then ran a bunch of algorithms on the graphs for a bunch of metrics to see if graph theory were any use for neuroscience purposes.

What he found was that the brain activity that could be seen from the scans translated to changes on the graph. Those graph transformations acted on the graphs in a predictable way from the metrics. He raised the possibility of linking thought or computations in the brain with graph transformations. The nice thing about graphs is that, even though there are plenty of problems that are hard, we still know a lot about them and we’ve got a ton of graph algorithms already.

Who knows, maybe we’re further along in figuring this brain thing out than we might think.

Suugaku Girl supplementary handout for chapter 1: Sequences

Sunday, August 21st, 2011

That really isn't enough terms to identify as Fibonacci

Suugaku Girl is a manga about people who really like math. The great thing about it is that it contains a substantial amount of math. This is also great because it will give me plenty to blog about.

The first chapter of Suugaku Girl is about the main character’s initial meeting with Milka, our socially retarded genius meganekko. She just starts spouting out numbers and, for whatever reason, he feels compelled to guess what comes next. And that is apparently the beginning of this love story.

In the chapter, we’re introduced to a few sequences, some of which are famous and some of which you might not have considered a sequence. It’ll probably help to understand what a sequence is beyond just being a bunch of numbers in a prescribed order.

Formally, we define a sequence as a function $a:S\to R$. The set $S$ is basically our index and is $\{1,2,…,n\}$ if $a$ is a finite sequence or the set of natural numbers $\mathbb{N}$ if we’re dealing with an infinite sequence. Normally, functions are written as $a(n)$, but, as was alluded to before, we refer to terms by index as in $a_n$.

However, $R$ can be any set. In the case of Suugaku Girl, it seems to be sticking with integers, but we can have sequences of bitstrings, vectors, complex numbers, functions, or whatever. What this also means is that a sequence doesn’t necessarily need to have a “pattern”, but can really be any ordered list of numbers (or functions or vectors or…).

Milka also brings up the idea of infinite sequences. A lot of the time, people will try to “solve” a sequence by completing it when they’re given only the first few terms. But, like Milka suggests, what they’re doing in that case is assuming that the rest of the sequence goes on as initially implied. Really, we can define any sequence we like with any behaviour we like. Again, remember that a sequence can be anything we want it to be. In fact, the sequence that Milka defines using the digits of π is kind of like that in that it’s completely arbitrary and doesn’t really have the kind of sequence definitions we’re used to seeing.

For finite sequences, we can just list all of the terms of our sequence like $(1,1,1,1,1,1000000,1)$. Obviously, we can’t do that for an infinite sequence. Luckily, a lot of the time we define sequences that have some sort of useful pattern that we can represent in a succinct way. Sometimes, like the digits of π sequence, this is harder.

We can try to formally define all of the sequences that were given in the manga. For instance, the Fibonacci sequence $(a_n)_{n=1}^\infty$ is commonly defined as $a_n = a_{n-2} + a_{n-1}$, but we have to give the first two terms $a_1 = 1, a_2 = 1$. The second sequence (which we’ll call $(b_n)_{n=1}^\infty$) takes a bit more work to define. We’ll need to define $p_n$ to be the $n$th prime number and then we can define $b_n = p_n \times p_{n+1}$. The third sequence $(c_n)_{n=1}^\infty$ is easy, it’s just $c_n = n^n$. And we can formalize the last one, which I’ll call $(d_n)_{n=1}^\infty$, just like the first two with a few more words. We let $\pi = q_1q_2q_3\cdots$ be the decimal expansion of π. Then $d_n = 2\cdot q_n$.

So that’s all fine, but what exactly are sequences used for? I’m pretty sure everyone’s learned about arithmetic and geometric sequences in grade school. Obviously, we can study sequences and their behaviour on their own. We can talk about whether they increase or decrease or how fast they grow or whether they converge. Apart from that, I don’t remember seeing sequences used for something besides sequences until analysis.

Analysis is basically the field of pure math that formalizes the concepts that we’re introduced to in calculus and generalizes them to spaces. Limits are a fundamental idea in calculus and analysis and these are defined by how a sequence converges. And this is where those weird sequences of vectors or functions comes into play, since we can talk about the convergence of a sequence of vectors or a sequence of functions in these other spaces that we want to do analysis in.

That’s probably the easiest example of an “application” of sequences. For myself, over the last few months I’ve read about automatic sequences, which are sequences that can be generated by a deterministic finite automaton. This gives us a way to relate automata theory to number theory and algebra. For instance, once we have k-automatic sequences, we can talk about k-regular sequences and come up with power series with respect to certain rings and fields and bla bla bla.

If you ever want to find out what crazy sequence you might have a part of, check out the Online Encyclopedia of Integer Sequences.