Simon built this #recursion example/ pattern (a Sierpinski triangle) in Codea (using the language Lua) while we a had a coffee at a cafe:
Tag: geometry joy
Where are my compasses?
There’s been a lot of drawing going on here lately. And jokes, like in the video above. Yesterday, after he got distracted while trying to draw the exact tangent of a circle, Simon said: “I went off on another tangent. To find a tangent!”
Fractal Dimensions
Simon is talking about various shapes having various number of dimensions, which, oddly enough, doesn’t have to be a whole number. Based on maths tutorials on 3Blue1Brown channel, that Simon has been watching a lot over the past several days.
Playing around with sine, cosine and radii
Simon playing around with sine, cosine and radii in Grapher:
Magnitude of a 3D vector
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.
Infinite Line in Processing. Simon’s own code.
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.
Pendulum Force
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:
Oscillation and Drag Force: Spring Project.
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:
y = sine(x)
You’ll notice that the output of the sine function is a smooth curve alternating between –1 and 1. This type of a behavior is known as oscillation, a periodic movement between two points. Plucking a guitar string, swinging a pendulum, bouncing on a pogo stick—these are all examples of oscillating motion.
This is what is known as simple harmonic motion (or, to be fancier, “the periodic sinusoidal oscillation of an object”). It’s going to be a simple program to write, but before we get into the code, let’s familiarize ourselves with some of the terminology of oscillation (and waves).
Simple harmonic motion can be expressed as any location (in our case, the x location) as a function of time, with the following two elements:

Amplitude: The distance from the center of motion to either extreme

Period: The amount of time it takes for one complete cycle of motion
Looking at the graph of sine, we can see that the amplitude is 1 and the period is TWO_PI; the output of sine never rises above 1 or below 1; and every TWO_PI radians (or 360 degrees) the wave pattern repeats.
LSystems
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 Lsystems and Cantor Set worked:
An Lsystem or Lindenmayer system is a parallel rewriting system and a type of formal grammar. An Lsystem 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 Lsestem is “also a contextfree 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 LSystems 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 Lsystem is a String Buffer”:
Triangle Numbers. Simon’s own code
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
 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406 …
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.