Knowing Maths Has Killed My Simple Ways

Learning maths has killed my creative ways of solving problems, this is the conclusion to which I arrived the other day while working. The situation was the following

  1. I was running a piece of code that contained two nested for loops1 and wanted to get an estimate of the time that it would take to complete

    Imagine the code was something like this

    for i in range(1000):
        for j in range(i,1000):
            sleep(1)
    
  2. Then to calculate the estimate I thought, okay if each iteration is taking 1 second and I have 1000 iterations on the first run, 999 iterations on the second, 998 on the third, etc. Then this is the sum of an arithmetic progression! I unleashed the 8-year-old Gauß that lived within me and did

    $$ S_n = \frac{(f + l) \cdot n}{2} $$

    where $f$ is the first term, $l$ is the last term and $n/2$ is the number of pairs. Like this I knew the number of iterations that the code would do, and by multiplying by the time of a single iteration I got the total time that it would take for the code to run.

  3. Then I went slightly further, and as my code was going from $i$ to $999$ in the nested loop, and $i$ started from $0$ to $999$, I wanted to justify why it was going to take half the time than having both nested loops go from $0$ to $1000$, and the obvious2 way to go was:

    $$ \lim\limits_{n\to\infty} \frac{\left((1 + n)\cdot n\right)/2}{n^2} = \lim\limits_{n\to\infty} \frac{(n^2 + n)/2}{n^2} = \frac{1}{2} $$

    This is not normal. That is something some madman would do, but somehow it has become my default. I am not proud.


The solution was much simpler than that, one picture is worth a thousand words, behold

square


This is slightly sad, learning all this complex methods to tackle problems (okay, a limit is not very complex, but still) has made it the default in my life, and sometimes the solutions were much simpler, could be gotten quicker and with little to no effort.

But somehow the “right” way keeps intruding on our ways of solving these small challenges, sometimes hijacking the creativity or alternative methods that would lead to the same answer. I cannot do other than wonder, how many things, beliefs or conceptions are doing the same with my perception of life. Which “rules” are so deeply written within me that forbid me from experiencing an alternative (possibly better(?)) reality?


  1. Yes, it is bad practice and yes, it could have been avoided, but keep your judgaments to yourself, this is not the point now ↩︎

  2. Isn’t it fucked up that this is the new obvious? ↩︎