Here Simon explains how to calculate the magnitude of a 3D vector. This is something he partially figured out on his own and partially learned from Daniel Shiffman’s tutorial on Trigonometry and Polar Coordinates.
This blog is about Simon, a young gifted programmer, who had to move from Amsterdam to Antwerp to be able to study at the level that fits his talent, i.e. homeschool.
Here Simon explains how to calculate the magnitude of a 3D vector. This is something he partially figured out on his own and partially learned from Daniel Shiffman’s tutorial on Trigonometry and Polar Coordinates.
A beautiful project in Processing (Java), Simon’s own code, resembling an El Lissitzky painting that you can control and change with the mouse (without Simon knowing El Lissitzky). Resulted from thinking about and playing with infinite line and line segments. Simon used the following formula: slope times x plus yIntercept.
This is a beautiful “lecture” that Simon in his pajamas, chocolate paste adorning is face, game me Friday morning. He spoke about pendulum force, a force he was about to apply in a coding project.
The other videos form the very beginning of the lecture, with Simon plays with sine and cosine and explains why location, velocity and acceleration can be vectors and can be angles:
And this is the code where pendulum force is used. It’s an example from The Nature of Code book by Daniel Shiffman, from Chapter 3 on Oscillation:
Today Simon was watching Daniel Shiffman’s tutorials to learn about drag force and how to apply it when building a spring simulation in p5.js. Simon wrote the formula for drag force in Microfost Word and looked up all the variables:
While building a spring in p5.js, Simon talks about the 3 laws of Isaac Newton:
The project is based upon Daniel Shiffman’s book The Nature of Code, specifically Chapter 3 (Oscillation). Simon spent the rest of the evening studying “simple harmonic motion”, periods and amplitudes. Here is an excerpt from Daniel Shiffman’s book:
What sort of literature do you fancy in the evening? Simon’s downloaded the book The Algorithmic Beauty of Plants tonight.
Here Simon explained to me how L-systems and Cantor Set worked:
An L-system or Lindenmayer system is a parallel rewriting system and a type of formal grammar. An L-system consists of an alphabet of symbols that can be used to make strings, a collection of production rules that expand each symbol into some larger string of symbols, an initial “axiom” string from which to begin construction, and a mechanism for translating the generated strings into geometric structures.
Simon says that an L-sestem is “also a context-free grammar that can have infinite generations”.
The Cantor set is a set of points lying on a single line segment that has a number of remarkable and deep properties.
Simon followed the book and Daniel Shiffman’s tutorial on L-Systems to create beautiful trees and other recursive patterns in
http://turtleacademy.com/playground/en
and
http://www.kevs3d.co.uk/dev/lsystems/#
And “what you also might need by an L-system is a String Buffer”:
Now this was pretty amazing! Simon’s new own code, that he so nonchalantly wrote while “having a break” from practicing recursive functions, generates “triangular numbers”.
A triangular number or triangle number counts the objects that can form an equilateral triangle. The nth triangular number is equal to the sum of the n natural numbers from 1 to n. The sequence of triangular numbers is
https://www.youtube.com/watch?v=Y2QaShP8vHY
“This particular piece of code works with any sequence”, Simon said:
He tried to build the whole triangle but got stuck.
Simon followed Daniel Shiffman’s Fractal Recursion tutorial on how to write functions in Processing that call themselves (recursion) for the purpose of drawing fractals.
Later he programmed a Sierpinski triangle from memory, using circles. A Sierpinski triangle is a fractal set with the overall shape of an equilateral triangle, subdivided recursively into smaller equilateral triangles. Originally constructed as a curve, this is one of the basic examples of self-similar sets, i.e., it is a mathematically generated pattern that can be reproducible at any magnification or reduction. It is named after the Polish mathematician Wacław Sierpiński, but is actually a reincarnation of Pascal’s triangle.
Simon built another project of his own design. His program allows to draw intricate patterns that resemble Islamic tiling, the building block being a polygon of your choice.
First, you can enter the number of vertices that you wish your polygon to have and the program does the rest: connecting all the vertices inside the polygon. This part of code is also available in JavaScript. Play with Simon’s code here: https://alpha.editor.p5js.org/simontiger/sketches/Hyr8m59ax
Simon explaining how it works:
Multiple polygons:
Simon later corrected the bug in his code (removed the empty space in between the polygon tiles):
Simon made this beautiful interactive Islamic star pattern from Daniel Shiffman’s one hour long coding challenge he devoted to the refugees. The coding challenge is based on this paper about computer visualizations of geometrical Islamic art.
Late last night Simon almost completed the project in Open Processing when the browser crashed. He had to start completely from scratch this morning. This time he worked in CodePen. You can play with his Islamic Star Pattern yourself at: https://codepen.io/simontiger/full/BWXwWp
The code: https://codepen.io/simontiger/pen/BWXwWp
The project step by step. The algorithm involved building a grid of polygons and finding midpoints for the sides in those polygons and then making those midpoints send out rays at certain angles that meet to form star-like shapes:
The above picture is from Craig Kaplan’s PhD thesis on Computer Graphics and Geometric Ornamental Design. Below Simon explains what distance δ means:
Since Simon has been using so much trigonometry in his programming lately, we decided to review some SOH-CAH-TOA during his regular math classes and did some Brilliant.org quizzes:
Simon also enjoyed building some trigonometric graphs: