Harmonograph

Multi-pendulum Harmonograph simulator using numpy and matplotlib

22nd June 2017

This is a simple harmonograph simulator to generate random-ish harmonographs. It asks for the number of pendulums, and exits if the number is 0. It also asks for the frequency spread, which means roughly, how far from integer may the frequencies go. The nearer to integer they are, the ‘cleaner’ looking the harmonographs are, but […]

Sigmoid NN

A Neural Network in Python, Part 2: activation functions, bias, SGD, etc.

9th February 2017

This is Part 2 of A Neural Network in Python, which was a very simple neural network to learn the XOR function. This part builds on that example to demonstrate more activation functions, learning a simple math function, adding a bias, improvements to the initial random weights, stochastic gradient descent, mean square error loss function, […]

Artificial Neural Network

A Neural Network in Python, Part 1: sigmoid function, gradient descent & backpropagation

31st January 2017

In this article, I’ll show you a toy example to learn the XOR logical function. My¬†objective is to make it as easy as possible for you to to see how the basic ideas¬†work, and to provide a basis from which you can experiment further. In real applications, you would not write these programs from scratch […]

Tweetable Python Code Golf

9th June 2015

Code Golf is the amusement of writing as short as possible a program to perform a given task. So for example, if the task is to compute the average of a list of numbers (which could be changed at any moment), you might do this: 140 characters (just by coincidence!), or this: 42 characters. In […]

Easy Graph Plotting with Pyplot

7th May 2015

Graphs (also known as charts) are an indispensible visual aid for conveying a lot of data in an easy-to-digest form. Everyone is familiar with graphs in everyday life, such as those showing trends over time, e.g. world population, global warming, the cost of living, interest rates, etc. They are of fundamental importance in the STEM […]