Calculating with Units

General discussion about calculators, SwissMicros or otherwise
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Calculating with Units

Post by Walter »

Every once and a while, the topic 'Dealing with Units on a Calculator' is discussed in the net.

I can understand this being an issue in the USA - it's the well-deserved revenge for not keeping its commitment of the Seventies and not joining SI.

For the rest of the world, OTOH, this shouldn't be an issue anymore: once you put SI data in a reasonable calculation, your calculator will always return reasonable SI data; so there's no need for pulling through any units whatsoever. Before stating this as a general law I want to ask for confirmation or contradicting examples. Do you know any?
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
thx1138
Posts: 24
Joined: Mon Jan 25, 2021 10:28 pm

Re: Calculating with Units

Post by thx1138 »

I have been in product development of heavy construction and mining products for many years. There are times when I have been at a customer site or on a test where I'm helping a technician troubleshoot an issue and may not get all the input data in the same system of units (and this isn't a U.S.-only thing, at least in my experience, because it's happened to me outside the U.S. as well). It's very convenient to have a tool that handles units internally and can spit out the answer in whatever form I need. This is why I never go anywhere for work without my 50g.
HP-15C(&LE), (2) HP-28S, HP-32Sii, HP-33S, HP-35S, HP-40gs (NewRPL), (3) HP-41CX, HP-42S, (2) HP-48SX, HP-48G+, HP-48GX, (2) HP-49g+, HP-50g (5 std,, 1 NewRPL), HP-71B, HP Prime G1/G2, WP-34S, DM15L, DM32, (3) DM42 (std, WP43S, C43), (2) DM41X
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Calculating with Units

Post by Thomas Okken »

The United States has joined the SI, it is a full paying member. And all the U.S. Customary units are officially defined in terms of SI units nowadays.

But the customary units do live on, and this is in no small part because the U.S. was actually one of the first large countries to adopt nationwide standards of measurement. They just happened to do so before SI... But the consequence of all this is that the great benefit that most countries derived from adopting SI, that is, having national standards where previously there were none, never applied in the U.S.

Of course dealing with powers of 10 is nicer than the weird and wonderful conversion factors that are involved when converting between cubic inches and gallons, between feet and miles, or between acres and square miles or whatever. But that hasn't been enough to convince people to switch, and update millions of cookbooks, retool countless factories, etc...
nlj
Posts: 15
Joined: Thu Oct 31, 2019 8:04 pm

Re: Calculating with Units

Post by nlj »

Walter wrote:
Mon Dec 20, 2021 12:47 pm
For the rest of the world, OTOH, this shouldn't be an issue anymore: once you put SI data in a reasonable calculation, your calculator will always return reasonable SI data; so there's no need for pulling through any units whatsoever. Before stating this as a general law I want to ask for confirmation or contradicting examples. Do you know any?
I don't think it's true that "rest of the world" (outside the U.S.) uses (just) SI units:
  • I haven't been to the UK for a while, but I believe they still use miles and pints (and maybe gallons for petrol?).
  • Here in Canada, while we mostly use SI, draft beer comes in pints (lightweight U.S. pints rather than real pints), and butter comes by the pound (although it says 454 g on it) [Whereas in a true SI country it would make more sense for a brick of butter to be 500 g or 400 g maybe?], and recipes are typically in cups and tablespoons etc..
  • I don't know of any countries where speed limits are posted in m/s, and I doubt any country uses Kelvin in everyday life.
Also here are some examples of where you can't just work in SI:
  • You do your calculation and get an astronomical number of metres and you want to know how many light years or AU that is.
  • You do your calculation and get an answer in m/s but you want to know how many kilometres per hour or knots that is.
  • You do your calculation and get an answer in radians but want that in decimal degrees or sexagesimal degrees.
  • You do your calculation and get an answer in Kelvin but you want that in terms you have an intuitive understanding of -- that is in Celsius (or maybe Fahrenheit).
  • Your answer is in Joules but you need electron volts.
  • Your answer is in Watts but you need dBm.
  • You're reading a history of polar exploration and you read that the temperature was 50 below zero and you want to know what that is in Celsius.
  • You're visiting a country where they use imperial or U.S. units and need to translate into SI.
In summary, even if one does mostly work in SI, the input data might not be in SI and one might not want an answer in SI base units (or even SI at all).
vgoudreault
Posts: 19
Joined: Sat Oct 17, 2020 2:32 am
Location: Greater Montreal, Canada

Re: Calculating with Units

Post by vgoudreault »

Walter wrote:
Mon Dec 20, 2021 12:47 pm
For the rest of the world, OTOH, this shouldn't be an issue anymore: once you put SI data in a reasonable calculation, your calculator will always return reasonable SI data; so there's no need for pulling through any units whatsoever. Before stating this as a general law I want to ask for confirmation or contradicting examples. Do you know any?
That could be any calculation that involves a constant, which are typically expressed in a combination of units that may not be the ones you want for your answer.

And then there are the calculations with a result that has units in the numerator and denominator. When a numerical result is shown, does one have the a pressure in the desired "Newton per square metre", or is one in presence of "square metre per Newton" that would require an extra "1/x" ? If the result is close to 1, then a wrong answer may appear close enough to be taken as valid.
DA74254
Posts: 193
Joined: Tue Oct 03, 2017 11:20 pm
Location: Norway/Latvia

Re: Calculating with Units

Post by DA74254 »

As a ships engineer (and European), I'm mostly a metric kind of guy.
Though I still don't know how fast (or slow) a ship moves unless I get it in knots.
Ships engines power is unrecognised if it's not in Kw or Mw, albeit I like the horsepowers in my car and motorcycle.

As the weird person I am, I also am weak for the alternative speed measures, such as shackles per bell toll (ship speed) and furlongs per fortnight (walking speed)
Distances made in "kaffekok" (an old Sami people measure of distance on how far one should walk before brewing coffee for a break and is approximately 9 kilometres) for walking.
"Mil" (Norwegian distance of 10 kilometres) for distances driven by car or motorcycle.

Speaking of "standards"; be lucky you do not have to maintain Caterpillar engines, as they are both metric and inches on the same engine. Normally bolts/nuts are M8, M10 and M16 plus 1/2", 5/8" and 3/4". Thus you still need to stock up on tools of both standards.
Esben
DM42 SN: 00245, WP43 Pilot SN:00002, DM32 SN: 00045 (Listed in obtained order).
nlj
Posts: 15
Joined: Thu Oct 31, 2019 8:04 pm

Re: Calculating with Units

Post by nlj »

Walter wrote:
Mon Dec 20, 2021 12:47 pm
once you put SI data in a reasonable calculation, your calculator will always return reasonable SI data; so there's no need for pulling through any units whatsoever.
Provided the calculator has a good system for converting units (which one could use at the beginning and end of a calculation), I agree that propagating units through the calculation is not essential -- if that is what you are saying/asking.

The ability to propagate units through a calculation is a nice feature and I use it sometimes on the 50g but if you're asking from the point of view of the WP43 then I don't know that it would be worth the expense of implementing it there because it seems non-essential and it is maybe better matched to an object-based system like the 50g.

The ability to propagate uncertainty/error through a calculation would, I think, be a more valuable feature.

A calculator in which one could attach both units and uncertainty/error to values and have them both propagate through calculations would be a very nice beast.
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: Calculating with Units

Post by Walter »

Thanks for your replies.

I think your wishes concerning units can be fulfilled with a three-step system:
  1. Convert your non-SI inputs, if applicable, to the respective SI units.
  2. Compute within SI. (No units needed: reasonable SI input results in reasonable SI output automatically.)
  3. Convert the (SI) output to non-SI units, if wanted.
Concerning error propagation, this will be certainly a useful extension of calculator functionality, though requiring a new data type. This is not included in the present 43S specs. I don't want to include it right now (feature creep, you know) but might pursue it in the future. Thanks for pointing to it.

Wishing you a happy, healthy, and prosperous 2022!
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
jwiede
Posts: 44
Joined: Mon Oct 18, 2021 11:17 pm
Location: San Jose, CA USA

Re: Calculating with Units

Post by jwiede »

Walter wrote:
Fri Dec 31, 2021 10:46 am
Concerning error propagation, this will be certainly a useful extension of calculator functionality, though requiring a new data type. This is not included in the present 43S specs. I don't want to include it right now (feature creep, you know) but might pursue it in the future.
It's a great idea, and would definitely be very welcome!

That said, I suspect it may well be one of those tasks where cost of integration after the fact winds up equal or greater than the cost of a "ground-up" system re-implementation. Just determining / calculating the "initial" error values for all constants and native formulae is likely a substantial task by itself, requiring careful analysis of each formula's implementation mechanism, and each constant's history. Plus, outputs of that process will almost certainly include a list of "error hogs" requiring mitigation and /or replacement (potentially a sizable list, at that).
DM42, DM16L, and a menagerie of HPs thanks to CAS (Calc Acq Syndrome)!
ljubo
Posts: 70
Joined: Sat Jun 20, 2020 1:46 pm
Location: Austria

Re: Calculating with Units

Post by ljubo »

Slightly off topic, but related and cool :D - RPN calculator with support for uncertainties using error-propagation formulas
https://www.hpmuseum.org/forum/thread-17017.html
https://github.com/apoluekt/OpenRPNCalc
HP-15C, DM15L, HP-35S, DM42
Post Reply