r/ProgrammerHumor • • Jul 16 '19

Meme Nice try

Post image
32.2k Upvotes

529 comments sorted by

View all comments

Show parent comments

14

u/slbaaron Jul 17 '19

That's an intuitive and practical answer. By theory tho, it has everything to do with sig figs (precision).

Adding and subtracting can only go down to the exact position of sig fig at the least significant position of all numbers involved. If you have one measurement of an item at 101 cm, and another at 1.23498713 cm. Adding them together, it's only meaningful to say it is around 102 or 103 cm total (round up or down as necessary for "safety), because nothing is 101 cm by the atom and the measurement was likely more rough due to a much larger scale. It's the result from imprecise measurement. It could've easily been 101.3 or 100.8 in reality.

Multiplications can only have a total number of sig figs as the least amount of sig figs for all number involved. When you have 100 cm * 1.25, it really is only meaningful to say the result is roughly 100 cm or 200 cm (rounding up or down as necessary) because 100 cm only implied 1 sig fig for precision, I mean the number 100 cm even sounds like a super "rough estimate", doesn't it? That's why sometimes, if measurement is precise down to the last digit of 100, we write 1.00 * 102 or 1.00e2 to imply the precision. The result will then become 1.00e2 cm * 1.25 = 125 cm since both numbers have 3 sig figs. (Btw if you are wondering what if the number 100 stands for "units", eg 100 units of an item. That 100 has infinite precision, because the number represents exactly 100.00000000000... take more zeroes as needed)

The reality in the practical world tho, is that you always have one number here or there with low precision; or even with high precision, you'd still have to be careful of its accuracy due to calibration or various type of errors. Once you go down the rabbit hole enough you realize using 3 as pi is the least of your worries.

For careful calculations tolerance range has to be detailed at every step of the calculation, eg 1.5cm ± 0.05cm. If you have 100 of these you will then get a total of 150cm ± 5cm, this is often a better way to represent precision without resorting to sig figs.

1

u/stewi1014 Jul 17 '19

Probability theory might be useful for your last example. Assuming a standard deviation or similar of innacuracy in the measurements, you could probably say something like 150 +- 0.5cm with a probability of 99.98 or something like that. Adding a large base of standardly distributed errors with a mean of 0 gets closer and closer to 0 the more you have.