April 2020 Release Notes

Mathematics mostly, with some code sprinkle-tossed in. Solving puzzles never felt more exhilarating.


On the tenth day of the month, I watched The Man Who Knew Infinity, a movie that chronicled the life of India’s greatest mathematician. So, I went off to search for more mathematics to learn. Nothing too rigorous, but I found loads of puzzles that refreshed my high school mathematics. Most of it came easily to me but there were some geometric puzzles that I really struggled over. I’ll write down most of my solutions and notes underneath. The other significant thing in this month was the annual Google Code Jam which I’m covering in another blogpost.

As for books, I read 1984, Animal Farm and Down and Out in Paris and London. I liked last one best. Orwell is really good at descriptive writing, and I enjoyed his account of life as a plongeur in a Paris up-and-coming hotel. The rest of the month, I spent with Jeff Kinney’s Diary of A Wimpy Kid. Those books never fail to crack me up.

John Conway

New York Times obituary of John Conway and a NumberPhile Podcast episode

Also, Conway’s Lesser Known Results and the Guardian obituary

Chess Tips

I wrote to someone who asked me for tips to become better at chess:

Learn endgames, most beginners struggle to play when there are few pieces left and every move could be a difference between a win/draw/loss. Learn checkmates, it’ll help in understanding king movements (both yours and opponents) relative to other pieces.

Regarding Openings:

Learn an opening as white and play it until you feel like you know it well (you stop making major blunders). People say don’t memorize variations and understand the moves but I say, do both. Learn two openings as black, one as a response to e4, and one as a response to d4.

Middlegame practice:

After a while, you develop a style. You either prefer dynamic tactical play like Carlsen, Kasparov and Tal or prefer slow constricting positional play like Karpov and Kramnik. Or you develop a coiled-spring type attack like Fischer and Anand. Then, you look at grandmaster games and study their games, try to understand why they played those moves. Watch YouTube videos on those games etc.

Practice makes perfect:

Play games with long time controls against strong opponents to improve your game in general. Play shorter games either for recreation or to improve your vision and calculation, but don’t play revenge chess where you play the next game because you’re frustrated that you lost the previous game. Get yourself a game partner of your own level and sit down and analyze all your games and moves with them.

Universal:

Lastly, I guess you’ve got to like the game. It is not a means to an end like improving memory etc. but it is the end itself. Hope this helps.

Math with Bad Drawings

I found a series of amazing comics on the mathwithbaddrawings.com site and I’m going to link a few here for posterity.

Image 2 Image 1 Image 3 Image 4

Anti-Calculator Problem

I coded up a solution to this anti-calculator problem. Check it out:


// Disclaimer: This isn't a general solution.
// But it works in effect to show the pattern.
#include <iostream>
using namespace std;

double sod(int a)//sum of digits
{
    double ans = 0.0;
    while(a)
    {
        ans += a % 10;
        a /= 10;
    }
    return ans;
}

int main()
{
    double max = 0, min = 1000;
    int maxnum = 0, minnum = 0;
    for(int i = 10; i < 100; i++)
    {
        double a = (double)(i / sod(i));
        if(a < min)
        {
            min = a;
            minnum = i;
        }
        if(a > max)
        {
            max = a;
            maxnum = i;
        }
    }
    cout << "Maximum: " << max << " for " << maxnum << "\n";
    cout << "Minimum: " << min << " for " << minnum << "\n";
    return 0;
}

I got some interesting answers, if $n$ is the number of digits:

n   Answers
2 Max 10 (10)
  Min 1.9 (19)
3 Max 100 (100)
  Min 10.4737 (109)
4 Max 1000 (1000)
  Min 57.8421 (1099)
5 Max 10000 (10000)
  Min 392.821 (10999)

The Mathematics of Juggling

Let us define the $n^{th}$ throw in this manner; after throw is made, $n - 1$ throws happen, and then the $n^{th}$ throw lands. Using this definition, we shall first number all our juggling patterns as applicable. Examples are

\[\dots |3 \space 3 \space 3| \dots\] \[\dots |3 \space 3 \space 3 \space 4 \space 4 \space 1 \space 3 \space 3 \space 3| \dots\]

Another definition is of vanilla siteswaps. We will consider those actions as vanilla siteswaps that have:

  • Alternating hands

  • Only one ball in a hand at any time

This means that even throws go the same hand and odd throws go to the other hand. With this knowledge, let’s look at what the numbers mean.

Number Meaning
1 1 ball cascade (handoff)
2 1 ball in each hand (hold)
3 3 ball cascade
4 2 balls in each hand
0 Empty hand

Let us look at an example

\[\dots | 6 \space 6 \space 1 \space 5 \space 1 \space 5| \dots\]

The $6’s$ lead back to themselves, the $1$ goes to the next slot and the $5’s$ lead back to the $1’s$.

Theorem: The number of balls participating in a juggling pattern is equal to the arithmetic mean of the number of throws.

Idea: It’s easy if all the numbers are equal. If not, find a decrease, $m > n$ and replace with $n + 1, m - 1$. Stir until done.

Examples:

\[5 \space 2 \space 5 \space 1 \space 2 \rightarrow 3 \space 4 \space 5 \space 1 \space 2 \rightarrow 3 \space 4 \space 2 \space 4 \space 2 \rightarrow 3 \space 3 \space 3 \space 3 \space 3\] \[2 \space 3 \space 3 \space 3 \space 4 \rightarrow 3 \space 3 \space 3 \space 4 \space 2 \rightarrow 3 \space 3 \space 3 \space 3 \space 3\]

Note that in the second example, there is no immediate decrease but we can rearrange the terms so that we obtain a decrease.

Question: Looking at the pattern, how hard is it to judge the difficulty of juggling? Answer: The highest number in the sequence is the best possible indicator. The second is when you have high-low pairs like $(7, 3)$. It is tough for the juggler to see both throws.

Some more definitions are given below:

Multiplex: Many balls in one hand at the same time. Square brackets indicate throws at same time.

\[2 \space 1 \space [4 \space 5]\]

Synchronous throws: Throws at the same point in time.

\[(4^L \space 4^R)\]

Question: Imagine we’re watching a video of a juggler and we pause the video. We have all the required information about the past, how much information do we have about the future?

Exponentials!!!!

Let us define a function exp(x) as

\[exp(x) = \sum_{n = 0}^{\infty}{\frac{x ^ n}{n!}}\]

Now, a function in Python that does the above reasonably well for our purpose


import math

def exp(x):
    # return 1 + x / 1! + x**2 / 2! + ...
    return sum([
        x**n / math.factorial(n)
        for n in range(0, 100)
    ])

Let us go through some of the values


In [1]: exp(1)
Out[1]: 2.7182818284590455

In [2]: exp(2)
Out[2]: 7.389056098930649

In [3]: exp(3 + 4)
Out[3]: 1096.6331584284578

In [4]: exp(3) * exp (4)
Out[4]: 1096.6331584284578

We can write down an expression from the above values

\[exp(a + b) = exp(a) \cdot exp (b)\]

This isn’t really obvious by just looking at the function definition and I’d like to take some time later and actually show you the entire proof. But it is important to understand the fact that $e^x = e \cdot e \cdot e \dots$ where $e = exp(1)$ is not something that arises trivially. Apparently, Euler chose this particular letter because he wanted a vowel and $a$ was already taken.

Now, let us look at the proof, we know that

\[exp(x) \cdot exp(y) = \sum_{m,n = 0}^{\infty} \frac{x^ky^m}{k! \cdot m!}\]

and with knowledge of the binomial theorem, also know that

\[exp(x + y) = \sum_{n = 0,m = 0}^{n = \infty, m = n} \frac{1}{n!}{n\choose k} x^ky^{n-k}\]

Using the knowledge that

\[{n\choose k} = \frac{n!}{(n - k)! \cdot k!}\]

we can safely say:

\[exp(x + y) = exp(x) \cdot exp(y)\]

A more elaborate proof can be found here.

Note that an interesting question to ask here is if this holds true for imaginary numbers. And going to the next level, does it hold true for matrices? I will not answer the question but I will give you a hint: commutativity.

Extremely informative video about how Liverpool optimized their throw-ins to yield better results

Listen to this first hand account of a New Orleans nurse by The Daily: On the Front Lines in New Orleans

Beautiful episode on The Joe Rogan Experience: Michael Shermer

“Must’ve been a good speech”

Barack Obama’s 2008 acceptance speech

Ken Ono on Srinivasa Ramanujan

Dan Jurafsky, Talks at Google

Manchester United vs. Chelsea (UEFA Champions League Final, 2008)

Mathematics in India

Lee Holloway, his story is extremely tragic. And he’s one of those who’s getting his treatment.