Physical Units

Richard B. Kreckel kreckel at thep.physik.uni-mainz.de
Thu Jan 22 23:36:57 CET 2004


Hi,

On Thu, 22 Jan 2004, Lee Harding wrote:
> I've created a few programs for optimizing things, doing simple FEA
> (finite element analysis) and other sorts of calculations. Invariably, I
> end up restricting the domain to a consistent set of physical units
> (e.g. metric meter, kg, sec) or writing a lot of code to compensate for
> varying units across the input.  For general-purpose tools, it can be a
> real pain in the shorts to get right.

This is not just laborious.  Coming up with a good design is nontrivial
and in this case it's worth studying other approaches.  Because, you know,
"A few weeks of developing and testing can save a whole afternoon in the
library".  Over at Fermilab, Walt Brown had to start from scratch at least
four times till he came up with something elegant and rather bulletproof
[0].

> I haven't thought a great deal about why math libraries so consistently
> ignore the problem of unit consistency and conversion.  But, I have
> failed to do it successfully with other libraries.  For example, the Gnu
> project citrus[1] is a unit conversion library that implements it's own
> expression concept.  Units and expressions are inextricably tied, I
> can't do my job without the old reliable kg/s/m^2 (aka. Newtons, aka.
> energy) after all.
>
> And, what is sin(pi)?  Is that degrees or radians?

Radians of course!  How can it possibly be a temperature?

> It seems worthwhile to explore integrating physical units to GiNaC, if
> only to make like easier on poor engineers like myself.  Is that a
> reasonable possibility?

Have a look at the already mentioned SIunits [0], and maybe also at
Qalculate [1].  If this sparks some ideas, please do let us know!

Regards
    -richy.

[0] <http://www.fnal.gov/docs/working-groups/fpcltf/html/SIunits-summary.html>
[1] <http://qalculate.sourceforge.net/>
-- 
Richard B. Kreckel
<Richard.Kreckel at GiNaC.DE>
<http://www.ginac.de/~kreckel/>




More information about the GiNaC-list mailing list