Simon’s favorite piece for the moment – Schubert’s Unfinished Symphony:
Simon also worked on a Markov Chains projects this weekend, trying to introduce a slider into his text generating code.
“A Markov Chain can be described as a sequence of random “states” where each new state is conditional only on the previous state. (…) An n-gram is a contiguous sequence of N elements. (…) Using an N-gram model, we can use a markov chain to generate text where each new word or character is dependent on the previous word (or character) or sequence of words (or characters)”, Daniel Shiffman writes.
In other words, Markov Chains can be used to generate text automatically based on a source text. For some reason, Simon’s slider only worked in the minimum stand (“least sense”, generating words from 2-letter combinations). When turned to maximum, it only returned the same one and a half words all the time. Simon gave up at that point:
The rest of the code comes from Daniel Shiffman’s Markov Chains Coding Challenge. This coding challenge is part of the Programming A to Z course, one of the courses that Daniel Shiffman has taught at the Interactive Telecommunications Program at NYU’s Tisch School of the Arts.
This is the chapter on Markov Chains: http://shiffman.net/a2z/markov/
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.
Simon has nearly completed the basic equations and inequalities course on Khan Academy.
Every time his math teacher comes they solve a couple of inequalities from the course and what happens next is that Simon goes over to his desktop to check his answers in the “Inequalities machine” he programmed! He often has to change the program to fit a new inequality format, so it takes some time. Luckily the math teacher understands how awesome this is. I also think it’s the first time Simon has really programmed something for practical use!
This is how Simon solves the inequalities, by typing them:
Testing the answer in the “Inequalities Machine”:
The original “Inequalities Machine” Simon programmed back in February:
Simon talking about the most dangerous place in the world:
Simon practicing Markdown with GitHub:
Simon has been following Flexbox Essentials tutorial with DevTips and built a website:
Simon says he has invented a way to center text vertically without Flexbox:
Another attempt with the Word Interactor Coding Challenge:
Here the results are placed in alphabetical order:
This was the formula (Simon doesn’t fully understand it yet but loves playing with it):