Hacker News new | ask | show | jobs
by ollyfg 3707 days ago
If there is one thing I've learned from university, it's this. Keeping units makes your writing messier and longer, but when it comes to checking they are absolutely invaluable. Your equation to give you volumetric flow gave you (kg/s)? Well density is (kg/m^3) so just divide your answer by density! (this is a problem my friend was having just yesterday)
3 comments

I think the problem is they don't teach the same units everywhere in the world.

I grew up in Australia with SI units I do a lot of work with Fluid/Thermodynamic calcs. I have a bunch of reference values in my head. I know 1 Atmosphere is ~101.3 kPa, I know speed of sound in dry air is ~330 m/s I know how much energy it takes to raise the temperature of various substances. I know the densities of common materials in my head. All of that helps me sanity check calculations - at a glance I can see things 'this fan is producing too much suction, not possible' or 'There is not enough input energy to see a temperature rise that high' things like that.

I have no idea about any of the non SI units. I couldn't tell you how long a "yard" is or how heavy a "pound" is usually it is fine but occasionally I come across numbers in technical papers or datasheets or similar with stuff in wacky units - PSI, BTU and Fahrenheit are the worst offenders when I have to deal with them it just blue screens my mental models. I see those units so infrequently I have no concept of what a 'reasonable' value expressed in those units looks like. I imagine people who don't work in SI units everyday hit the same difficulties in reverse.

This is interesting because there's actually a unit-agnostic way of doing units more generally... it's "dimensional" rather than unit-based. So regardless of the base units you'll do "length" (which works for all three axes: length, depth, breadth) and "mass" (which works for kg, pounds, whatever) and "acceleration", "force", etc.

Obviously this is slightly more lax and perhaps error-prone than your standard m/s or m/(s^2), etc., but it's one of the lamentably few things computers can do well!

EDIT: ... and I should elaborate: In some sub-fields of Physics they usually go even further and just re-normalize everything to units of 1, so that e.g. the speed of light is c is 1. At that point it's really just about convenience since sqrt(1) = 1, and 1^x = 1, etc. (Lorentz Transformation.)

I believe that bigger_cheese is lamenting his or her inability to do numerical sanity checking in other units. (This loss of numerical information is, perhaps, what you meant by saying that the unit-agnostic approach is 'more lax'.)

For example, if I am looking for a force and I get an answer of 1000 lbs, then dimensional analysis tells me that at least I got a force; but, if my intuition tells me only that the actual force is on the order of magnitude of 1000 N, then I don't know whether my actual answer is way too big, way too small, or about right, unless I know how to convert between Newtons and pounds.

Incidentally, while "units of 1" make correct calculations easy, I think that they are a bad idea precisely because they subvert unit checking; it's hard to know just by looking that 1 + 1 is 1 speed of light + 1 light-year, and hence dimensionally inconsistent.

(Even keeping all SI units can miss some important distinctions; for example, nothing about their SI units (inverse time) allows us to distinguish angular frequency (https://en.wikipedia.org/wiki/Angular_frequency) from temporal frequency (https://en.wikipedia.org/wiki/Frequency), and yet much woe accrues to he or she who does not distinguish radians/time from cycles/time!)

Oh, yes, re-read it and right you are.
> PSI, BTU and Fahrenheit are the worst offenders

With Fahrenheit perhaps the worst of the worst (scum de la scum?), because at least you have an intuitive idea of the meaning of 0 PSI and 0 BTU.

To automate this process, check out Frink[0], which takes unit calculations to the obsessive limit.

[0] https://futureboy.us/frinkdocs/

My middle school physics teacher taught us to build those formulas by reverse-engineering the units. This was before we had done enough algebra to know what we're doing so we used triangle diagrams, but boy was it the best thing I ever learned.

Don't understand what something is? Just look at the unit. It tells you!

What’s a triangle diagram?

     a
    b c
encodes

  a = b * c
  c = a / b
  b = a / c