# Approximating pi and e with Randomness

This has been one of Simon’s most ambitious (successful) projects so far and a beautiful grand finale of 2019, also marking his channel reaching 1K subscribers. The project – approximating Euler’s number (e) in a very weird way – is based upon a Putnam exam puzzle that Simon managed to prove:

The main part of the project was inspired by 3Blue1Brown Grant Sanderson’s guest appearance on Numberphile called Darts in Higher Dimensions, showing how one’s probable score would end up being e to the power of pi/4. Simon automated the game and used the visualization to approximate e. Below is the main video Approximating pi and e with Randomness. You can run the project online at: https://editor.p5js.org/simontiger/present/fNl0aoDtW

The history and the math behind the project:

Simon’s proof od the math behind the project:

Simon has visualized this problem and proof at: https://editor.p5js.org/simontiger/present/2uMPZ8THW

# MathsJam Antwerp 20 November 2019. A Blast and a Responsibility.

Today, Simon returned to a problem he first encountered at a MathsJam in summer: “Pick random numbers between 0 and 1, until the sum exceeds 1. What is the expected number of numbers you’ll pick?” Back in June, Simon already knew the answer was e, but his attempt to prove it didn’t quite work back then. Today, he managed to prove his answer!

The same proof in a more concise way:

At MathsJam last night, Simon was really eager to show his proof to Rudi Penne, a professor from the University of Antwerp who was sitting next to Simon last time he gave it a go back in June. Rudi kept Simon’s notes and told me he really admired the way Simon’s reasoning spans borders between subjects (the way Simon can start with combinatorics and jump to geometry), something that many students nurtured within the structured subject system are incapable of doing, Rudi said. Who needs borders?

Later the same evening, Simon had a blast demonstrating the proof to a similar problem to a larger grateful and patient audience, including Professor David Eelbode. The first proof was Simon’s own, the second problem (puzzle with a shrinking bullseye) and proof came from Grant Sanderson (3Blue1Brown) on Numberphile.

“Don’t allow any constraints to dull his excitement and motivation!” Rudi told me as Simon was waiting for us to leave. “That’s a huge responsibility you’ve got there, in front of the world”.

# Why the Golden Ratio and not -1/the Golden Ratio?

Take any real number and call it x. Then plug it into the equation f(x) = 1 + 1/x and keep doing it many times in a row, plugging the result back into the equation.

At some point you will see that you arrive at a value that will become stable and not change anymore. And that value will be… φ, the golden ratio!

But this equation also has another answer, -1/φ. If you plug that value into the equation, it will be the same, too. The real magic happens once you have rounded the -1/φ down (or up), i.e. once what you plug into the equation is no longer exactly -1/φ. What happens is that, if you keep going, you will eventually reach… φ as your answer!

Simon saw this interesting fact in a video by 3Blue1Brown and then came up with a proof as to why it happens.

Simon also sketched his proof in GeoGebra: https://www.geogebra.org/classic/zxmqdspb

# Heat Equation Visualization

A visual solution to Fourier’s heat equation in p5. Play with the two versions online:
https://editor.p5js.org/simontiger/present/EaHr9886H
https://editor.p5js.org/simontiger/sketches/EaHr9886H

Inspired by 3Blue1Brown’s Differential Equations series.

# The Brachistochrone

Simon believes that he has found a mistake in one of the installations at the Technopolis science museum. Or at least that the background description of the exhibit lacks a crucial piece of info. The exhibit that allows to simultaneously roll three equal-weight balls down three differently shaped tracks, with the start and the end at identical height in all the three tracks, supposes that the ball in the steepest track reaches the end the quickest. The explanation on the exhibit says that it is because that ball accelerates the most. Simon has noticed, however, that the middle track highly resembles a cycloid and says a cycloid is known to be the fastest descent, also called the Brachistochrone Curve in mathematics and physics.

In Simon’s own words:

You need the track to be steep, because then it will accelerate more – that’s right. But it also has to be quite a short track, otherwise it takes long to get from A to B – which is not in the explanation. It’s not the steepest track, it’s the balance between the shortest track and the steepest track.

Galileo Galilei thought that it is the arc of a circle. But then, Johan Bernoulli took over, and proved that the cycloid is the fastest.

The (only) most elegant proof I’ve seen so far is in this 3Blue1Brown video: https://www.youtube.com/watch?v=Cld0p3a43fU

There’s also a VSauce1 video, where they made a mechanical version of this (like Technopolis): https://www.youtube.com/watch?v=skvnj67YGmw

We’ve also made some slow motion footage of us using the exhibit (you can see that the cycloid is slightly faster, but as far as I can tell, it’s not precision-made, so it wasn’t the fastest track every time): https://www.youtube.com/watch?v=5Brub0FnpmQ

I hope that you could mention the brachistochrone/ cycloid in your exhibit explanation. I don’t think you can include the proof, because for such a general audience, it can’t fit on a single postcard!

# Simon’s code for an intriguing problem from the 3Blue1Brown math channel

The number of collisions between two objects equals a number of digits of Pi. The code on GitHub: https://github.com/simon-tiger/Pool_Pi

Simon writes:

From where I got this

3rd video: [not out yet]

The idea
The idea is 2 blocks on a frictionless surface. One slides towards the other, that is facing a wall. All collisions are perfectly elastic.

If the two blocks have the same mass, you can quickly calculate that there will be 3 collisions.

If the one block is 100x the other, it just so happens that there will be 31 collisions.

If the one block is 10000x the other, there will be 314 collisions (I get tired of making graphics). If the one block is 1000000x the other, there will be 3141 collisions.

That’s pi!

The issue!
In my own code, I first used Box2D.
It worked for mass ratios of 1 and 100, but it didn’t work for 10000.

Then I started writing my own physics engine, hoping to fix this issue. But it was even worse.
I couldn’t even get 100 to work.

Then I figured that the blocks are colliding too frequently. So I slowed the 1st block down.
I could get 100 to work this way, but not 10000.

Can anybody help to fix this issue?

I borrowed part of the code from here: https://processing.org/examples/circlecollision.html

# A Pythagorean triple

Proving a Pythagorean triple. 3Blue1Brown did it in another way, using i.

# Just another day in graphs

Simon loves looking at things geometrically. Even when solving word problems, he tends to see them as a graph. And naturally, since he started doing more math related to machine learning, graphs have occupied an even larger portion of his brain! Below are his notes in Microsoft Paint today (from memory):

Slope of Line:

Steepness of Curve:

An awesome calculator Simon discovered online at desmos.com/calculator that allows you to make mobile and static graphs:

Yesterday’s notes on the chi function (something he learned through 3Blue1Brown‘s videos on Taylor polynomials):

Simon following The Math of Intelligence course by Siraj Raval:

# 28 times 28

Simon programmed a presentation to explain why 28×28 is not the same as 20×20 + 8×8 geometrically. The code is quite complicated and involves some trigonometry and conditional statements: the grid is divided into different parts every time Simon clicks and depending on how many times he has already clicked. This is typical Simon – coming up with an inherently arduous and complex system to visualise the beauty of the world around him, even of the seemingly trivial things. By the way, the inspiration for the 28×28 grid came from Simon’s favourite math channel, 3Blue1Brown and its latest video on Neural Networks (the grid was used to explain computer vision).

Simon is doing quite a lot of sums in his head nowadays, looks like it’s a new trend. Today, while bathing in the fountain outside, he was calculating how long 1/16th of a minute lasted. And a couple days ago, while waiting for his appointment at the hospital, he calculated how long it would take someone to read a whole page of random numbers, taking an educated guess that one takes 4 seconds to read out one number and remembering Daniel Shiffman mentioned there were 100×5 numbers per page in his book.