Newsgroups: comp.edu,comp.lang.fortran
Subject: Re: scientists as programmers (was: Small Language Wanted)
From: ecmtwhk@ccu1.aukuni.ac.nz (Thomas Koenig)
Date: Thu, 27 Aug 1992 06:05:24 GMT
Organization: University of Auckland, New Zealand.

mcdonald@aries.scs.uiuc.edu (J. D. McDonald) writes:

>In article <1992Aug26.113215.20137@ccu1.aukuni.ac.nz> ecmtwhk@ccu1.aukuni.ac.nz (Thomas Koenig) writes:

[without being aware that he was writing flamebait, btw]

>>Oh yes, and make the people use either straight SI units (without any
>>multiplicators) or dimensionless numbers. 

>That is **TERRIBLE** advice for many cases. It would be OK to use
>pure SI for a program to be used to teach freshman. But it would be wrong
>fro most other purposes, certainly in my field. A good programmer (well,
>a really topnotch one) would know better than that!!

Gee, thanks, but all I claim to be is to a good enough to get my 
projects done:-)

>Units are very important, not only for understanding, but, even more
>important, for numerical accuracy. SI units are amost never the best ones 
>except for trivial codes. 

I have some trouble understanding that. How could one unit system be
more or less accurate than another? The only problem I can see is over-
and/or underflow. If your calculations involve squaring the charge of an
electron, for example, then SI units are certainly the wrong choice.

Characterizing problems where SI units give results which fall within
ten or fifteen orders of magnitute of unity (which all floating point
representations that I'm aware of can hold without problems) as trivial
seems to be somewhat of an understatement, however.

>Some sort of natural units are probably best for large calculations.
>I personally loathe dimensionless units -- as, for example, are
>traditional in quantum structure calculations or general relativity.

I find dimensionless numbers and dimensional analysis to be quite
valuable tools, especially in heat transfer and flow calculations (I'm a
chemical engineer, btw). Granted, dimensionless numbers are often not
easy to visualize. For a lot of problems, however, dimensional analysis
cuts down the parameter space to be investigated either with experiments
or by computation so dramatically that I am willing to put up with the
extra level of abstraction. Of course, many problems cannot be reduced,
such as describing a stirred chemical reactor.

>But that is amatter of taste, as they are often of a size that makes the
>numbers close to one (i.e. quantum structure calculations).

That is one of their nicer features, certainly.

>Also, SI units are often not the units normally used when discussing
>certain topics. For example, in my field, dynamics of chemical reactions,
>SI units are essentially **never** used. Oh, people may quote heats of
>formation in them, or laser pulse energies, but the pressures in reaction 
>chambers are never ever actually discussed in them - people usually use 
>torr. Energies are usually quoted in electron volts or, very common, 
>wavenumbers.

Discussing 'heat of formation' with my thermodynamics professor would
have brought him close to apoplexy - are you talking energy or enthalpy
of formation there? I thought these old, inexact terms had long since
died the death they deserved...

If you look at single atoms, then SI units are indeed so far off unity
as to cause grave problems.

As far as giving the pressure in torr goes, that is fine as long as
you don't want to plug it into the ideal gas equation of state, for
example.

[comment about "loathsome" electromagnetic SI units and European purists
deteted]

Let me rephrase my piece of advice, then: In the sections of a program
which do the actual computation, choose either dimensionless numbers or
a consistent set of units, so that you can do the calculations
themselves with no conversion factors at all. All that conversion
factors do is introduce inefficiency and bugs. Conversion to other,
maybe more familiar units should be restricted to sections of code
dealing immediately with I/O. One consistent system in wide use is SI.

Can we agree on that? :-)
-- 
Thomas Koenig, ecmtwhk@ccu1.aukuni.ac.nz, ib09@rz.uni-karlsruhe.de
The joy of engineering is to find a straight line on a double logarithmic
diagram.
Newsgroups: comp.edu,comp.lang.fortran,comp.lang.misc,comp.arch,sci.math