
Hi, I am the mathematician here at Mindvalley.
Whenever we start on a new algorithm, I listen to all the non-mathematicians toss ideas on how to solve a problem (which I otherwise am paid to solve with some high-brow maths).
When they (and myself, in a non-mathematical capacity) are done with coming up with simple (but not simplistic) workarounds there are two areas where I get to apply my high-brow maths *wink*:
- How to quantify and automate the ideas.
- How to implement anything mathematically which otherwise is not possible heuristically (let’s not start on heuristic mathematics).
And while making the algorithm I take two things into considerations:
- How to eliminate as much if-then statements and for-loops as possible.
- How to use mathematics to save the computer the grunt work (although it is meant to do precisely that)- so that the application is lean (and mean).
I will give you a simple example from real life.
I was 10, or maybe 11 years old when I learnt programming (BASIC language) in my school. This is how I used mathematics (and minimalism) to solve my problem.
It was a simple program to print out the sum of first 100 numbers (the teacher wanted to test the for loop expertise of students in the exam,apparently). The standard method was to make a counter and add up each time inside the for loop which ran from 1 to 100. I was not very sure about the for loop syntax, so all I did was to use the formula (which I learned in self study because of my extra mathematical interests):
1+2+3+…+(n-1)+n=n*(n+1)/2.
And boom, to the chagrin of my examiner, I came up with a solution without having to use for loop (and hence saving computer the grunt work). Well, of course I got full marks because nowhere in the question it was stated that one has to use for loops. That was a very elementary concept which made me realize the power of mathematics, and I totally enjoy the experience.
ps: If you want to get fascinated even more, here is the derivation of the above formula. It is very elementary, but it still holds the charm of mathematics to me- as they say, first love never dies.
Let S=1+2+…+(n-1)+n …(*)
This can also be written as :
S=n+(n-1)+…+2+1 …(**)
Now we add equations (*) and (**), and we get:
2S=(1+n)+ (2+(n-1))+… ((n-1)+2)+(n+1)
hence, 2S=(n+1)+(n+1)…..n times.
hence, 2S=n*(n+1)
hence S=n*(n+1)/2
and voila… 1+2+…(n-1)+n=n*(n+1)/2 As a boy, it was a magic. And for me, it still is.
