Open Klortho opened 12 years ago
This would involve some way to encode systems of units. Something like this, maybe:
InitSystem (
'si', [ qw(m kg s newton square-meter cubic-meter watt joule
pascal m/s coulomb volt farad ohm siemens tesla weber henry)
],
'cgs', [ qw(cm gm s dyne square-centimeter cubic-centimeter watt
erg dynes-per-square-centimeter centimeters-per-second)
],
'english', [ qw(foot slug s pound square-foot cubic-foot horsepower
foot-pound pounds-per-square-inch feet-per-second)
],
);
A few things to note, your first system is not SI, but rather MKS. SI uses grams not kilograms. I think that if this was a goal, it would fit in with having loadable databases per instance. One would make a Physics::Unit
object, load a units database and set the units system. I think this is a worthy goal, but a major undertaking.
your first system is not SI, but rather MKS
According to Wikipedia, it is kilograms.
Another system that we'll definitely want support for is the Furlong/Firkin/Fortnight (FFF) system. :)
There are other very good ways to specify output serialization.
Here's how Math::Units::PhysicalValue does it:
print ($rate + "0 miles/hour"), "\n" # prints 103.07 miles/hour
Another would be a method to produce an output using the best SI prefix. Quoting jpierce on RT: "Since you already have prefix to exponent mapping, it would be mighty handy to have a method of taking a result like 1.055056e+18 (joules) and getting back: 1.055056, exa(joules)."
This is another to-do item from the vault.
Here's an example from a post by John Clyman on comp.languages.perl.modules (http://tinyurl.com/7hy6p4u):