This is the final page for the advanced levels. You’re almost done.
Looking for some other page?
As promised, I will return the “Repeat” feature to you.
Yes! We’ve got all the features back. We won!
Finally, we can use mathboxes to do additions and subtractions.
But guys… Do you really think it’s over now?
Hmm…?
Well, we are not done yet!
I still have an important thing I haven’t told you about. Let’s talk about it now.
What? You still have something to say?
First, take a look at this lunchbox:
Hmm… what is this?
It looks like you can fill each of and with a number…
Yeah. Try filling each of and with a random number.
Ok. Let’s use:
Now, let’s use this lunchbox that can be converted to …
And this lunchbox that can be converted to :
Ok, let’s see what happens when you run it.
Let’s run it.
It became this lunchbox that can be converted to .
Now: What numbers did you use for and ?
I used and , and the final result was …
Does that mean: It calculated ?
Exactly! Using the above lunchbox,
So: The above lunchbox can do addition of two numbers.
Oh wow…!
We thought we had to use the “Repeat” feature to calculate additions like this:
But it looks like we can do addition of two numbers without using the “Repeat” feature .
Exactly!
Next, how about this lunchbox? What do you think this lunchbox can do?
It’s similar to the previous lunchbox but slightly different.
Let’s fill and with and like the last time, and see what happens.
Ok, let’s run it.
This one takes time, so if you can’t wait, press “Skip to the end →”.
It became a lunchbox that can be converted to .
We started out with for and for …
And the result was .
Maybe: It can do multiplication?
Exactly! Using the above lunchbox,
So, it’s a lunchbox that can calculate multiplications.
By the way, we don’t have time to explain this, but lunchboxes can also do subtractions and divisions of two numbers.
So: Lunchboxes can do addition, multiplication, subtraction, and division.
What’s coming up next is the final topic we’ll cover. You’re so close to the finish.
Furthermore, lunchboxes can do even more complicated calculations.
Like what?
For example: Lunchboxes can calculate factorials.
Factorials? What’s that?
The factorial of a number can be calculated as follows:
Hmm… Can you give me an example?
For example: This is the factorial of . If you do the math, the result will be .
Another example: This is the factorial of . If you do the math, the result will be .
Ok, I think I got it…
Now, I will show you that: Lunchboxes can calculate factorials.
To calculate factorials, we need to use the lunchbox that can do multiplication (which we saw earlier).
But this time: Instead of using the actual lunchbox, we’ll use the following notation (abbreviation):
In this notation, the icon in the middle indicates multiplication.
Hmm… ok, but why do we need to use this notation instead of the original lunchbox?
It’s because: The lunchbox that calculates factorials is going to be very complicated.
Therefore: We need to use this simpler notation to describe multiplications in order to save some space. Otherwise, the lunchbox will be too big.
I see…
Before we move on, let’s take a look at an example that uses this simpler notation.
For example: This is the earlier lunchbox that calculates :
If we use the notation to simplify the above lunchbox, it will look like below.
You can run it to calculate .
Ok. But how do we use this to calculate factorials?
Let me explain how to calculate factorials using a lunchbox.
First: Take a look at this lunchbox. Notice that there’s a sign between and .
Next: We’ll add more items to the above lunchbox like this (sections in yellow background).
By the way, the bottom half is Y Combinator, which we used on the last page.
That’s it! By using this lunchbox, you can calculate the factorial of any number.
Hmm… really?
Let’s use the above lunchbox to calculate the factorial of .
To calculate this, we just need to change on the lunchbox to .
Let’s run it.
It’s not finished yet, but do you see what just happened?
It became .
Yes. So it does calculate the factorial of .
Let’s run until the end.
So: By running this lunchbox, it calculates the factorial of automatically.
Before we finish this page: Let’s calculate the factorial of .
To calculate this, we just need to change on the earlier lunchbox to .
Let’s run it.
It became .
See, it calculated the factorial of , right?
I see. Very interesting!
So, by using this lunchbox, you can calculate the factorial of any number.
It’s amazing!
This is possible because of Y Combinator, which is used in the bottom half of the above lunchbox.
I see. Y Combinator is indeed magical!
What we learned here is that, lunchboxes can do complicated calculations. They’re more powerful than mathboxes.
Well, I have a question: Are there any calculations that lunchboxes cannot do?
That’s a very good question. Let’s talk about it on the next page.
The next page is the final page: Epilogue.
Finally… we’re almost done!