Random Number Generator Graphing Probability

 

This random number generator Simon built in Processing simultaneously graphs the probability of the values as you “throw the dice”. This is Simon’s own code and what’s more, he has turned it into a truly scientific experiment/observation. Simon programmed the generator to automatically throw the dice every 60 frames a second (i.e. every 1/15th of a second). The graph showing the probability of certain values should increasingly resemble a perfect isoceles triangle the more throws occur, because the probability of you getting 7 is much higher than those of getting 2 or 12.

Random Number Generator Graphing Probability 9 Feb 2018Random Number Generator Graphing Probability 9 Feb 2018 2

The perfect triangle was drawn at around 4000 throws.

Simon also experimented with programming the same generator for 3 dice. The graph should then form a bell shaped curve, a parabola, and takes a longer while to shape up. “As the number of dice grows towards infinity, the distribution will change from a uniform distribution to a Gaussian distribution”, – Simon explains.

Random Number Generator Graphing Probability 9 Feb 2018 with 3 dice towards parabola 1Random Number Generator Graphing Probability 9 Feb 2018 with 3 dice towards parabola 2Random Number Generator Graphing Probability 9 Feb 2018 with 3 dice towards parabola 3Random Number Generator Graphing Probability 9 Feb 2018 with 3 dice towards parabola 4

Advertisements

Simon’s Sine Wave Tool

Simon came up with a tool (a circle where you install a pencil) to draw curved lines. He explains how the curved line actually draws the absolute value of the Sine function sin(x). “Because an absolute value of x is square root of x squared, that means that all negative values cancel out”, says Simon, that’s why the wave looks spiky.

Simon’s tool should probably be improved by making it from thicker material like thick cardboard.

dsc_0249847255387.jpg

 

Live Stream #8: Games on a grid in Processing

Simon’s live stream last night was a blast. Simon worked on two games on a grid: 15s Puzzle and Connect Four, both in Processing (Java). He had already made the 15s Puzzle before, but built the Connect Four (also called Four in a Row) without any prior preparation.

The stream got lots of views as Daniel Shiffman kindly advertised it again on his Twitter:

Let me also archive the live chat here, to save it from oblivion:

Schermafbeelding 2018-02-08 om 22.05.26Schermafbeelding 2018-02-08 om 22.06.34Schermafbeelding 2018-02-08 om 22.07.14Schermafbeelding 2018-02-08 om 22.07.32Schermafbeelding 2018-02-08 om 22.07.52Schermafbeelding 2018-02-08 om 22.08.14

Simon playing his game together with sis:

Numbers as products of primes (a useful calculation practice). And the general beauty of primes.

Simon spent hours calculating – something he’s not particularly fond of if it were simple/ pointless sums, the way schoolkids work. His was not pointless!  He did it with the solemn purpose of expressing natural numbers as products of primes, the atoms of all numbers.

PRODUCTS OF PRIME NUMBERS 6 feb 2018 2

PRODUCTS OF PRIME NUMBERS 6 feb 2018

Here a spiral grid where primes form patterns that Simon finds really beautiful, too bad the A4 paper was too small to go on:

DSC_0171

And a sequence in which every number is a sum of cubes (more calculations!):

DSC_0177

Wobbly Circles and the Center of Mass

What shape can roll well, other than a circle (wheel)? Two circles, attached together according to a formula involving a square root of two! Simon made these “wobbly circles” inspired by a Numberphile video where Matt Parker talks about how the ability to roll well (as in a wheel) is caused by the constant height of the center of mass (as opposed to a square wheel, whose center of mass goes zigzagging up and down). Wobbly wheels also have a stable height of their center of mass, hence they roll!

Simon also made a transparent version (with mom’s help):

 

DSC_0150

DSC_0151

DSC_0153

DSC_0155

DSC_0174

 

How to Square a Circle

Inspired by yet another Numberphile video, Simon is explaining why it’s impossible to turn a circle into a square with the same area using only the tools that the ancient Greeks had (this is one of the famous unsolvable math problems from Ancient Greece). We have seen, however, that the brilliant Murderous Math team have found a solution to squaring a circle! It was quite difficult to find the link to that exact page on the Murderous Math website (Simon had to dig into the html code to find it), but here it is: murderousmaths.co.uk/books/MMoE/sqcirc.htm

 

DSC_0073

Pythagorean Triples

Inspired by the 3Blue1Brown video “All possible Pythagorean Triples visualized”. Simon has recently learned about different ways to find Pythagorean Triples, using different formulas (involving complex numbers and not). His sketchbook at home is full of them, and even outside at the playground, while playing with his sis, he takes math breaks to recall the formulas in his memory.

 

DSC_0186