

Ask HN: What math principles are much easier to grok as code?]]] - jawns


======
ianamartin
I don't know if this qualifies as "Math" per se, but I just read a book on
Bayesian statistical analysis that demonstrated in Python code how to
accomplish certain things while also explaining the rationale.

It was very good and helped me "grok" Bayesian stuff in a way that I hadn't
been able to purely by reading academic material.

I also learned a few things about Python from that book. It is called Think
Bayes.

Disclosure: I am in no way affiliated with this book, its author, or its
publisher. I'm just a guy who wanted what it had to offer and found it very
useful as an addition to my formal training.

As a sidenote, I would say that, while a lot of statistics is easier to
understand with code than it is with the math; the math is very important.

Understanding the math is key to understanding the limitations of any given
statistical procedure and to understanding the needed assumptions about a data
set before any approach can be decided on.

We have a lot of issues in modern scientific thought that are based in people
understanding code and not understanding math where people figure out how to
run a statistical procedure on a dataset, but don't bother to understand if
that procedure should be run on that particular data.

These kinds of errors happen from Climatology to Neuroscience. It's
widespread.

I think they are fundamentally math principles, but I think it's fair if
people disagree with me.

My tl;dr respsone is this: always take the hard way. You will benefit in the
long run. Find a teacher or a website that will take you down the hard path.
It will be good for you. Once you understand the concept, the code will be
obvious.

------
bjourne
Abstract algebra and group theory. For example strings under concatenation
(append) forms a semigroup. Another example is addition of durations (say you
are writing scheduling software and want to calculate: 2 days and 3 hours + 4
hours) which I believe forms an abelian group. Finding examples of rings and
more complex algebraic structures in programming is left as an exercise for
the reader. :)

------
dennybritz
I think many Machine Learning algorithms (and optimization techniques) become
clearer when you actually implement them. Writing out the for loops instead of
looking at 6 nested summations helped me to understand the runtime complexity
of algorithms, and why some things are and aren't feasible to compute.

Often it's useful to go start from the "stupidest" implementation and then
optimize it. At the end you'll arrive at the formulas that were given to you
;)

