Coding, Crafty, Geometry Joys, JavaScript, Math and Computer Science Everywhere, Simon makes gamez, Simon teaching, Simon's Own Code, Together with sis

Ancient Chinese Game Luk Tsut K’i Game in p5.js

Play Simon’s game: https://editor.p5js.org/simontiger/present/1pGeJY7c Code: https://editor.p5js.org/simontiger/sketches/1pGeJY7c

Simon learned this game on Brilliant.org at https://brilliant.org/practice/winning-moves/?chapter=competitive-games (Warning: this link will only work if you have a Premium Subscription to Brilliant). Brilliant describes the game as follows: “Luk tsut K’i is a board game from China in the time of Confucius. In medieval Europe, it went by the title Three Men’s Morris. This game is very similar to tic-tac-toe; the objective is for one player to get their three pieces all on the same line. If this occurs, that player wins”.

Simon and Neva playing the original paper version he made
Coding, Coding Everywhere, Experiments, JavaScript, Milestones, Murderous Maths, Simon teaching, Simon's Own Code, Simon's sketch book

How Many Dice Rolls Until You Get a Repeat. A Probability Experiment in p5.js

How many times, on average, do you have to roll a dice until you get a repeated value? I saw this probability challenge on the Mind Your Decisions channel. I decided to test it experimentally. First, I repeated the experiment myself in two sets of 50. Then I created a diagram in the Wolfram Language to visualize the distribution. Finally, I made a p5.js sketch to roll the dice thousands of times.

repeated the experiment in two sets of 50

Link to my code: https://editor.p5js.org/simontiger/sketches/gM0xws9D

Link to my Wolfram Notebook: https://www.wolframcloud.com/obj/620bf4df-077f-4ce8-8210-c06037f58f9b

explaining the math to dad at dinner

The math behind this project come from this Mind Your Decisions challenge video and this Mind Your Decisions solution video.

Coding, Community Projects, Contributing, Geometry Joys, Group, live stream, Milestones, Murderous Maths, Notes on everyday life, Physics, Python, Simon's Own Code

Live Session with Stephen Wolfram and the Wolfram Demo Project, World Science Scholars.

Simon has completed the course A New Kind of Science with Stephen Wolfram and the World Science Scholars program. Which doesn’t mean he is done with digging deep into Wolfram’s groundbreaking new kind of science! (As a matter of fact, he is still reading Wolfram’s 1500-page book. And as Professor Wolfram told Simon during the live session, there’s nothing in the book that no longer holds).

Simon happy after a major break-through in his demo project, hoping to present his findings to Stephen Wolfram the same evening

At the live session, a few scholars including Simon were planning to present their Wolfram Language demos, but Professor Wolfram was so inspired by his current research that he decided to share his latest discoveries instead (he is tiptoeing closer to laying the foundations of a theory that would unify all natural sciences based on his principle of computational equivalence). It was a very engaging session (even though Simon’s video camera malfunctioned, which hardly mattered).

screenshot of the live session
Danielle Rommel, who works with Professor Wolfram, told Simon she had actually been watching videos on his YouTube channel!

As for Simon’s demo project, that’s a whole story. It took Simon weeks to define what he was actually going to pick as his topic and once he had picked his topic, he didn’t know where to start (because he managed to pick an NP problem). He suggested to collaborate together with another World Science Scholar, as it was that boy who initially inspired to think in the direction of the particular open math problem. The two of them had two long video chats. (It was so much fun to observe them, they both had zero interest in small talk and went straight down to the math, without even saying hi).

Simon during a video chat with a fellow student, discussing the project
ways to write graph data that Simon shared with his fellow student during their talk

Unfortunately, after the original project presentation during the live session with Stephen Wolfram was cancelled, Simon’s partner never really replied to Simon’s chat messages (until weeks later). Simon did manage to get part of the demo done (porting a huge graph into the Wolfram Language, which required writing separate code in Python), but felt stuck later, after several attempts to color the graph failed. He ended up spending several days writing several more Python scripts. We have documented the process on video. The project has turned into a computational essay and it’s definitely still unfinished, but I’m not sure Simon will come back to it in the near future. He got a couple of minutes to present his findings at another live session last week (with a World Science Scholars teaching fellow Aaron Mertz and Rory Foulger, Education Outreach Coordinator at Wolfram Research), but was confused as he didn’t get any feedback about his findings and got the impression his main questions weren’t understood. He was also a bit annoyed with me yelling on the background about what he should do and say (I saw he was confused and was afraid his time would be cut short, so I wanted to make sure he would mention his main points). I’ve learned my lesson now and have decided not to interfere with his live performances anymore, not to put him under additional pressure.

Simon has also written to Professor Wolfram, currently awaiting his reply. His main questions were:

I was surprised to discover that no Heule or de Grey graphs exist (anymore?) built into the Wolfram Language. As part of my research, I’ve created a very long list of all the graphs the Wolfram Language knows about, and HeuleGraph is not in the list. I tried to pose this question during the short discussion of my project at the World Science Scholars live session this week, but didn’t get any feedback (I don’t think my question was understood). Yes, one is able to find images of Heule graphs in Wolfram notebooks, (like this one https://notebookarchive.org/heule-graph–2019-07-0z3zu9k/) and on Wolfram MathWorld (like here http://mathworld.wolfram.com/HeuleGraphs.html). But those are just pictures in archived notebooks, and even if I try to copy/paste the code into my own notebook, it doesn’t work.

My second question concerns coloring such a large graph in the Wolfram Language: do you think it could be possible? As I don’t know a built-in function to do that within the Wolfram Language (and I don’t think such a thing exists), I decided to try to color the graph in Python and then upload it into my Wolfram notebook. I created another Python script to make the graph easier to color, and yet another Python script to actually color all the vertices (using Breadth-First Search). The problem was: it didn’t color it with only 5 colors (but with 8)! I made a video about the making of the project, with me explaining why this task is hard for a computer to do, and even some computational complexity theory!

Timecodes: Converting to CSV: 0:00 Generating the Colors: 23:06 Some Math: 42:16 Part I Conclusion: 56:46

this video is long, but even briefly scanning through its several parts gives a thorough impression of Simon’s current math and coding abilities

The project is attempting to visualize the Hadwiger–Nelson problem from geometric graph theory: what is the minimum number of colors required to color the plane (chromatic number of the plane) such that no two points at distance 1 from each other have the same color. It’s an unsolved problem, but we know that the answer is 5, 6 or 7. In 2018, Aubrey de Grey proved that the chromatic number of the plane is at least 5. His smallest unit-distance graph with chromatic number 5 had 1581 vertices. Several smaller graphs have been found since then, a major contribution done by Marijn Heule, who has come up with his own method of reducing the size of graphs. In 2019, Heule constructed the smallest unit-distance graph with chromatic number 5 so far, with 517 vertices. (Side-note: since I decided I’m going to use the 517 graph, I have actually found a smaller Heule graph with 508 vertices, but it was of a data format that I wasn’t able to use anyway). The goal of my project was to color such a graph in Wolfram language, to create a Wolfram Demo.

In Part 2, I tried to code yet another Python script to group the graph into smaller units to make a smaller graph, and color that one, then blow each vertex back into the unit considered.

Link to Simon’s Wolfram Notebook: https://www.wolframcloud.com/obj/9795e37e-aa73-4ae6-8249-81223ffdbc7f Link to my code on GitHub: https://github.com/simon-tiger/Hadwiger-Nelson-Project-Data

Simon reading Marijn Heule’s paper “Computing Small Unit-Distance Graphs with Chromatic Number 5”

Link to Marijn Heule’s paper “Computing Small Unit-Distance Graphs with Chromatic Number 5”: https://arxiv.org/pdf/1805.12181.pdf

Coding, Geometry Joys, JavaScript, Milestones, Murderous Maths, Simon teaching, Simon's Own Code, Simon's sketch book

Space-filling Curves in p5.js.

Simon prepared this project as a community contribution for The Coding Train (Simon came up with his own way to draw the Hilbert Curve and added interactive elements to enable the user to create other colourful space-filling curves (Hilbert Curve, Z-order Curve, Peano Curve and more!). You can see Daniel Shiffman’s Hilbert Curve tutorial and coding challenge on The Coding Train’s website (including a link to Simon’s contribution) via this link: https://thecodingtrain.com/CodingInTheCabana/003-hilbert-curve.html

Interactive full-screen version, allowing you to change the seed and the grid size: https://editor.p5js.org/simontiger/full/2CrT12N4

Code: https://editor.p5js.org/simontiger/sketches/2CrT12N4

Screen shot of The Coding Train website with a link to Simon’s contribution
Biology, Coding, Experiments, JavaScript, Milestones, Simon teaching, Simon's Own Code, Simon's sketch book

Evolving Creatures in p5.js

Simon’s latest independent coding project involved some biology lessons! He loves the channel Primer by Justin Helps and watched his evolution series many times, studying the rules for species’ survival and multiplication. This resulted in two interactive evolution simulations, in both of which Simon recreated the rules he learned. The first simulation doesn’t involve natural selection and is based on these two videos: Simulating Competition and Logistic Growth and Mutations and the First Replicators.

Full Screen interactive version: https://editor.p5js.org/simontiger/present/MK4b75542

Code: https://editor.p5js.org/simontiger/sketches/MK4b75542

Simon added natural selection in Part 2, based on Primer’s video Simulating Natural Selection (the code Simon wrote from scratch):

Full Screen interactive version: https://editor.p5js.org/simontiger/present/68WXliTza

Code: https://editor.p5js.org/simontiger/sketches/68WXliTza

Coding, JavaScript, Notes on everyday life, Simon makes gamez, Simon's Own Code, Together with sis

Tic-Tac-Tic-Tac-Toe-Toe in p5.js

Simon has programmed this game of Tic-Tac-Tic-Tac-Toe-Toe Game in p5.js from scratch. He and his sister have had hours of fun playing it (and she turned out to be better at this strategic game):

Play Simon’s game online at: https://editor.p5js.org/simontiger/present/k9NfaDmpi

Code: https://editor.p5js.org/simontiger/sketches/k9NfaDmpi

Coding, Experiments, Math Tricks, Milestones, Murderous Maths, Notes on everyday life, Python, Simon's Own Code, Simon's sketch book

Simon’s Formula to Check Triangle Numbers

Simon spent the morning of December 5 pondering about how to test whether a number is a triangle number. “To test if something is a triangle number: double it, ask if it’s a multiple of its own square root. If that square root has a decimal, round it down”. This was his initial hypothesis, later discarded.

Simon jotting equations on a piece of cardboard while I drag him to his French lesson as we’re running desperately late. I feel bad about interrupting his train of thought.

Another formula he came up with was if n is even, m is a triangle number. After we got back home, he quickly wrote some code to check it:

Coding, Crafty, Experiments, Geometry Joys, JavaScript, Math and Computer Science Everywhere, Math Riddles, Milestones, Murderous Maths, Notes on everyday life, Simon makes gamez, Simon teaching, Simon's Own Code, Simon's sketch book

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

Code: https://editor.p5js.org/simontiger/sketches/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

Code: https://editor.p5js.org/simontiger/sketches/2uMPZ8THW