Ask HN: What math equations and properties should engineers be more aware of?

20 points by Brystephor ↗ HN
There must be some very helpful math formulas, properties, etc that would benefit software engineers in their day to day. Two potential areas of improvement is doing probability analysis and setting alarm thresholds.

Please share some math related things that you've found to be very helpful with work in the past.

10 comments

[ 2.9 ms ] story [ 33.3 ms ] thread
My most commonly used math functions are (in no particular order):

- Average

- Medium

- Max / Min

- Length/Count

- Add / Increment

- Subtract / Decrement

Same for me plus I use:

1. Weighted average 2. Percentage calculations 3. Absolute number

Thats it I can think of for doing financial software development for the past 10+ years.

It depends pretty much on your field. If your field is related to games, formulas related to quaternions, linear algebra and coordinates will be useful; if your field is related to data science or machine learning, then, statistics, linear algebra, tensors and optimization will be useful as well. Obviously some types of programming requires more math than others, a robotic-related programming certainly will require far more math than a vanilla crud application.
+1 to statistics and linear algebra.

Beyond practical uses, I'd say calculus is essential for having a robust understanding of rates of change in different contexts. I remember when my thesis supervisor gave me an intro to three-dimensional fluid flow so elegantly with calculus, then worked statistical mechanics into the equation without compromising its structure or elegance. All the snobbery in the world around mathematics being beautiful made sense in that moment.

Since then I've completely lost my ability to explain the del operator. I'd probably fuck up a lot of working techniques solving calculus problems (integration by parts with trig, etc). But the intuition for quantities changing and moving in different dimensions, and often in higher orders, sometimes randomly, has been immensely useful for understanding abstract systems and the world around me. Great carryover to grok office politics, the flow of football plays, networked systems, power transfer in biomechanics, etc.

Unfortunately it's a real pain in the ass to explain the intuition, so it tends to serve primarily as foundational knowledge. The key is though, the foundation is rock solid.

Basic stats and basic vocab/terms. The most basic stats related stuff is used pretty often and sometimes it's misunderstood (median vs mean). If you know basic terms, you can look up appropriate algorithms.
the area enclosed by a simple closed curve is the determinant of the co-ordinates in order (including the last pair being the same as the first pair to close it) divided by -2, the answer will be positive clockwise and negative anti-clockwise

the clockwise/anti clockwise is very handy as it allows an annulus to be excised from an area bounded by another simple closed curve

if, from the enclosing curve, you go into the annulus and out again on a co-incident line then this is zero area and you can take the determinant all in one hit and get areas of complex combinations of shapes.

this is extremely handy in so many ways, eg "is this point in side this shape?" - add the point into the co-ord list and see if the area increases or decreases

you need to be a little clever where you put the point in the order of the coord list, good start is to find two nearest consecutive neighbours

Apart from equations or properties, at the core you need understanding of mathematical induction and discrete maths.
I rarely do maths work but if I do it’s in rendering something for example a PDF and in that case matrix algebra familiarity is useful.
The most recent one I can think of that I've used is random sampling.

When I started thinking of potential customers I found a list of n potential users. I could have started by reaching out from #1 then worked down. But this would not have been representative of my potential user base.

So I picked a random number from 1 to n and reached out to that customer. Then picked another random number, and so on.

This ended up being more representative of my potential market.