The Square-Sum Problem

Simon has become a full-blown Numberphile fan over the past couple of days. He had already watched two Matt Parker videos before, but it’s this week that he got seriously hooked on the channel, and it all started from the Square-Sum Problem video!

Simon recorded and edited two videos of his own (in OBS) trying to solve the Square-Sum Problem, manually and using JavaScript code:

 

 

Advertisements

Live Stream #6. (Mostly) Chapter 2 of Living Code: Forces.

Simon’s latest live stream on Thursday, January 11 was a blast! For the first time in his programming career he actually had quite a few viewers – largely thanks to Daniel Shiffman, who posted an announcement about Simon’s live session in his Twitter:

During the session, Simon recorded 6 tutorials:

  • a bonus video about vectors,
  • a video about forces in general,
  • a video about mass,
  • a video about the Friction Force,
  • a video about Air Resistance
  • and a video about Gravitational Attraction.

All as part of his “Living Code” Course. The lessons in the course are loosely based on Daniel Shiffman’s book “The Nature of Code“, but focus on JavaScript.

Simon was worried in the beginning, because he had forgotten to prepare for the stream and had no choice but do the theory (on physical forces) on the fly. It was wonderful to see how the competent viewers gave him a helping hand every now and then and generally encouraged him in the live chat. He even got a real Q&A session in the end, something he had always dreamed of:

Schermafbeelding 2018-01-11 om 20.38.49Schermafbeelding 2018-01-11 om 20.39.27Schermafbeelding 2018-01-11 om 20.39.42Schermafbeelding 2018-01-11 om 20.40.01Schermafbeelding 2018-01-11 om 20.40.20Schermafbeelding 2018-01-11 om 20.40.45Schermafbeelding 2018-01-11 om 20.41.01Schermafbeelding 2018-01-11 om 20.41.14Schermafbeelding 2018-01-11 om 20.41.24

Magic around New Year’s Eve

This magical time of the year, Simon’s craziest, most daring dreams come true! First, his guru from the New York University Daniel Shiffman sends Simon his book and the words he writes there are the most beautiful words anyone has ever told him. Then, on the last day of the awesome year 2017, Simon’s other hero, the glamorous knight of AI Siraj Raval materialises in our living room, directly from YouTube! Happy New Year full of miracles and discoveries everyone!

DSC_3314

Daniel Shiffman’s book “The Nature of Code” that Simon had already largely read online and now also reads before bed. It also comforted him recently when he was in pain, he cuddled up of the sofa with this big friendly tome on his lap.

dsc_33401897498871.jpg

Daniel Shiffman signed the book for Simon:

dsc_33441647117253.jpg

dsc_33421879896746.jpg

Siraj Raval stepped out of the YouTube screen straight into our Antwerp apartment on December 31. Simon has been following Siraj’s channel for months, learning about the types of neural networks and the math behind machine learning. It is thanks to Siraj’s explanations that Simon has been able to build his first neural nets :

DSC_3370

DSC_3364

Schermafbeelding 2018-01-05 om 02.07.56

Simon’s Fibonacci function and Fibonacci counter in p5.js

Simon came up with this Fibonacci function while taking a walk downtown:

Schermafbeelding 2017-12-23 om 02.41.53

f(0) = 0

f(1) = 1

f(n) = f(n-1)+f(n-2)

When we got home, he used the function to build a Fibonacci counter in p5.js:

You can play with Simon’s Fibonacci counter online at: https://alpha.editor.p5js.org/simontiger/sketches/Skhr3o8Gf

The idea about the Fibonacci function struck Simon when he was looking down at the cobbles under his feet. “Look, Mom! It’s a golden rectangle!”, he shouted:

DSC_3157

He had read that golden ratio has a direct connection to the Fibonacci sequence. The same evening, he took out his compasses to draw a golden rectangle (this time not his own invention, but following the steps from his Murderous Math book):

DSC_3168

DSC_3169

If you turn the page, the smaller rectangle is a golden rectangle as well, and if you slice a square off of it, the remaining rectangle will also have the golden proportions. You can continue doing this infinitely. The sizes of the rectangles will exactly correspond to the numbers in the Fibonacci sequence, which makes these drawings an illustration to the sequence.

DSC_3170

The next day, Simon showed his function to his math teacher. Below are the Fibonacci sequence numbers he got through his selfmade JavaScript program. After a certain number, the computer started taking too long to compute the following number in the sequence (several seconds per number), but didn’t crash.

DSC_3164

Live Stream #4 on December 14. Living Code > Vectors.

Simon debuted with his own coding course last week! The course is called “Living Code” and Simon has already planned all its sessions for the year ahead. He is going to teach the course as part of his live streams (once in two weeks on Thursday evenings at 17 CET), although not every live stream will include Living Code sessions.

In the first Living Code session (that was live on December 14), Simon introduced the course and its Chapter 1: Vectors. He talked about mathematical operations with vectors, their magnitude, acceleration and normalisation.

There were no crashes or technical issues this time and Simon remained amazingly focused and organised during the stream, he had actually created a schedule for himself beforehand (without any incentive on my behalf):

Timestamps for this live session (new):
0:00:00 – 0:05:00: Announcements
0:05:00 – 0:15:00: Starting Question & Answer
0:15:00 – 0:20:00: Intro to Living Code
0:20:00 – 0:30:00: What is a Vector?
0:30:00 – 0:40:00: Vector math: subtract, multiply, divide
0:40:00 – 0:50:00: Vector math: magnitude, heading, normalize
0:50:00 – 1:00:00: Physics: acceleration, (maybe) jerk
1:00:00 – 1:10:00: Ending Question & Answer

Please subscribe to our YouTube channel  and you won’t miss a video or a live session!

Below is the archived version of Simon’s first Living Code course lessons:

The Neural Nets are here!

Simon has started building neural networks in Python! For the moment, he has succeeded in making two working neural nets (a Perceptron and a Feed Forward neural net). He used the sigmoid activation function for both. The code partially derived from Siraj Raval’s “The Math of Intelligence” tutorials.

ML Perceptron 10 Dec 2017

The FF was tougher to build:

Simon’s nets run locally (on our home pc), but he will need more computational power for the more complex future projects, so he signed up to this wonderful online resource called FloydHub! FloydHub is sort of a heroku for deep learning, a Platform-as-a-Service for training and deploying deep learning models in the cloud. It uses Amazon, which Simon could, too, but it would have been a lot more expensive and tedious work to set up.

Simon’s next step will be another supervised learning project, a Recurrent Neural Net that will generate text. He has already started building it and fed it one book to read! In this video he explains how character-based text generators work:

Simon explains K Means Clustering

Simon has prepared this implementation of “K-Means Clustering” in Processing as a gift for Daniel Shiffman, who is plainning to talk about this Machine Learning model in one of his upcoming live sessions on the Coding Train channel.

Simon writes: K-Means Clustering is a type of Machine Learning Model. It’s for “Unsupervised Learning” (meaning you have data with no labels).

Link to Simon’s code on GitHub: https://github.com/simon-tiger/k-means-clustering

Link to pseudocode by Siraj Raval: https://www.youtube.com/watch?v=9991JlKnFmk&spfreload=1

 

 

The Genetic Algorithm Game Bug Solved!

Simon’s version of the Citius Invaders game in Processing is finally working! The big bug that seemed so unsolvable (enemies endlessly crossing over) has been defeated!

Siraj Raval presented this game in Python during Week 9 of his “Math of Intelligence” course. Simon’s is a simplified version that still incorporates a genetic algorithm.

Link to code on github at: https://github.com/simon-tiger/citius-invaders/

Link to our previous post on this project: https://antwerpenhomeschooling.wordpress.com/2017/11/23/problem-with-a-genetic-algorithm-game/

Link to Simon’s archived Live Stream about the project: https://antwerpenhomeschooling.wordpress.com/2017/12/01/live-stream-30-november-speechjs-and-citius-invaders/