During 2014 while I was writing the book “Machine Learning – Hands-On For Developers and Technical Professionals” it became very clear that I was going to have to tackle an issue that I’d done well to avoid most of my 27 year long career in computing…. In the UK the concept of mathematical notation was never really made clear, it was just put in the whole “algebra” camp and left at that. Things may have changed now (hopefully) but it’s left a bit of a gap when I actually needed it.

Scary Monsters

Writing the book I’d keep coming across mathematical notation that would prove concepts, they were everywhere. And to the ageing programmer that was well versed in experience but not so in academic training well it got a bit scary. 772b4701bbe6846f4e2ed0edb928809c Especially this big foreboding scary one…. sigma1

There’s Something About Sigma

Perhaps it’s because it’s big, it looks serious and it looks like it means business. It means “sum”, add it all up. That’s it. Something so foreboding to show something so simple. Let’s take a simple example: sigmademo What’s being said here is “add up every value of i *3 from 1 to 100” or (1*3) + (2*3) + (3*3)+……(99*3) + (100*3) From a programming perspective what I have here is a for loop. An iterator starting at one and finishing at 100. The iterator starts at the value below the sigma (1) and runs each time until the top value is reached. The action performed on each value of i is to the right of the sigma. In Java it would look like:

public class SigmaTest {
    public static void main(String[] args) {
        int total = 0;
        for(int i = 1; i <= 100; i++) {
            total = total + (i * 3);

Or Python (using the Python shell) it would look like:

>>> for i in range(1,101):
... total = total + (i*3)
>>> total

Ultimately sigma isn’t that scary after all, I should know, it’s all over the place in the book 🙂