Simon solving the Ackermann function (a function that cannot be de-recursed). It’s computable but the computer’s soon runs out of its computing power (see the last line of code below):

# Category Archives: Simon’s Own Code

# 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

https://editor.p5js.org/simontiger/present/ruN8CQV77

https://editor.p5js.org/simontiger/sketches/ruN8CQV77

Inspired by 3Blue1Brown’s Differential Equations series.

# Back to the sorting algorithms: Beadsort (and a short lecture about the generator function)

# Slitscan and Edge Detection in p5.js

Simon writes:

Made a cool ~~#~~**slitscan** effect you all can play with: https://editor.p5js.org/simontiger/full/Xr8F_KmnU

Code here: https://editor.p5js.org/simontiger/sketches/Xr8F_KmnU

I have actually figured out the appropriate way to move the image of the webcam such that the resulting trail produces a slitscan!

# Drawing with Turtle

Here we are, on the day of my 40th birthday, while recording a lesson of drawing with turtle in Python. It was meant to be my birthday present, a beginner-friendly hour of code, in which Neva would also be able to take an active part. We ended up recording two beautiful sessions only to find out later that our screen capture video was irreparably corrupted (never record in mp4 in OBS). Simon was inconsolable. We also thought this webcam recording was gone but rediscovered it a day later. So nice to have it as a memory.

And I’m relieved to say that we have managed to redo the whole project from scratch today (sadly without Neva’s participation this time as she had better things to do, so I look rather redundant sitting there next to Simon giving the lesson). Once Simon is done with the editing (which is another two days of work I’m afraid), he will upload the hour of code on YouTube. He also plans to create a website for this project to enable his “students” to draw in a built-in application.

From our session today:

And here is an example of Simon drawing with turtle for his own pleasure, a Serpinski triangle in Python (a few days ago):

# Cat and Mouse

This is a project that Simon started a few weeks ago but never finished, so I think it’s time I archive it here. It’s based upon this wonderful Numberphile video, in which Ben Sparks shows a curious math problem – a game of cat and mouse – in a computer simulation he’d built. The setting is that the mouse is swimming in a round pond and is trying to escape from a cat that is running around the pond. What is the strategy that the mouse should apply to escape, considering that it swims at a quarter of the speed the cat runs?

Simon came up with his own code to recreate the simulation from the Numberphile video. In the four fragments I recorded, he showcases what he has built. Please ignore my silly questions, at the time of the recording I hadn’t viewed the Numberphile video yet and had no idea what the problem entailed.

# Chaos Game and the Serpinski Triangle

Monday morning Simon showed me the Chaos Game: he created three random dots on a sheet of paper (the corners of a triangle) and was throwing dice to determine where all additional dots would appear, always half-way between the previous dot and one of the corners of the triangle.

Very soon, he found it too much work to continue and I though he gave up. Later the same day, however, he suddenly produced the same game in Codea, the points filling in much faster than when he did it manually, yet following exactly the same algorithm. To my surprise, what resulted from this seemingly random scattering of dots was a beautiful Serpinski triangle.

# The Van Eck Sequence

Simon explains that the Van Eck Sequence is and shows the patterns he has discovered in the sequence by programming it in Python and plotting it in Wolfram Mathematica. Simon’s project in Wolfram is online at: https://www.wolframcloud.com/objects/4066d93a-893b-4a99-9fdc-54e265d27888

He also shows Neil Sloane’s proof of why the sequence is not periodic and adds an extra bit to make the proof more complete.

This video is inspired by the Numberphile video about the Van Eck sequence.

# Simon’s new “giant project”: Sorting Visualizations

Simon writes: I’ve built a giant project; a website / community project / platform for making algorithms! I’ve built in this video Bubble Sort, Selection Sort, Insertion Sort, Mergesort, Quicksort, Heapsort, Shell Sort and Radix Sort. So I’m done with the sorting part of the project. In the next video I’ll show you the making of the Pathfinding part of the project, and then, I’m going to put it on GitHub, and pass it on to the community, to put more algorithms on there, and even new types of algorithms!

Play with Simon’s visualizations on Repl.it at: https://repl.it/@simontiger/SortingImproved

Simon has already recorded a series of video tutorials about sorting algorithms earlier this spring. In the videos, he codes on his RaspberryPi, but here are the links to the Python code available on his GitHub page: Parts 1 – 5; Parts 6 – 7.

# Interview with Simon on Repl.it

Repl.it has published a cool interview with Simon! It was interesting how Simon struggling to answer some of the more general questions gave me another glimpse into his beautiful mind that doesn’t tolerate crude dimensionality reductions. The first question, “If you could sum yourself up in one sentence, how would you do it?” really upset him, because he said he just couldn’t figure out a way to sum himself up in one sentence. This is precisely the same reason why Simon has had trouble performing trivial oral English exam tasks, like picking some items from the list and saying why he liked or disliked them. The way he sees the world, some things are simply unfathomable, or in any case, extremely complex, too complex to imagine one can sum them up in one sentence or come up with the chain of causes and consequences of liking something on the spot. He often tells me he sees the patterns, the details. Seeing objects or events in such complexity may mean it feels inappropriate, irresponsible, plain wrong to Simon to reduce those objects and events to a short string of characters.

This made me reflect upon how Simon keeps shaking me awake. I used to find nothing wrong with playing the reductionist game and frankly, had I been asked to sum myself up in one sentence, I would have readily come up with something like “a Russian journalist and a home educator”. It’s thanks to Simon that I am waking up to see how inaccurate that is. I begin to see how many games that we play in our society are forcing us to zoom out too far, to generalize too much. How often don’t we just plug something in, pretending we can answer impossible questions about the hugely complicated world around us and inside us! Well, Simon often honestly tells me that he just doesn’t have the answer.

For that first question in the interview, I suggested Simon answer something like “it’s more difficult to sum myself up in one sentence than to prove that *e* is irrational”, to which he replied: “But Mom, to prove that *e* is irrational is easy! It’s hard to prove that Pi is irrational!”

I must add that at the same time, Simon has really enjoyed the fact that Repl.it has written a developer spotlight about him as well as the social interaction on Twitter that the piece has initiated. It gave him a tangible sensation of belonging to the programming community, of being accepted and appreciated, and inspired him to work on his new projects in Repl.it.