Units and Numerical niceties.

The discussion of what programming will look like in 2020 is getting excessively long, so I'm starting a new topic for a tangent instead of discussing it there.

This is a response to this post, which I fear clicking on the link will not bring up for you because due to the aforementioned excessive length of that topic it's already off the first page.

In brief, I'm responding to the Frink data file that defines units and dimensions for calculation with units in the language Frink, which provides dimensioned calculations with units.

As a meta-issue, I maintain that people defining such things for a language should use definitions they consider correct regardless of what a standards body might say; standards bodies are there to document correct usage, IMO, not to decide it. The recommendations of standards bodies ought not be followed when they are obviously incorrect. In particular, I am concerned with the following definitions and their interactions.

Radians are dimensionless. Alan editorializing goes on to say, "The angle subtended at the center of a circle by an arc equal in length to the radius of the circle" and then asserts that it is correct to regard it as dimensionless. As far as I can see, these statements are contradictory. If a radian is "The angle ...." then it is a unit of angle.

Hertz are considered by the SI committee to be the inverse of seconds. Alan agrees with me that this definition of Hertz is broken, but I maintain that the correct definition has a subtlety not so far captured by any proposed SI definition. Clearly, 1 Hertz is not equal to one Radian per second, which would be true given dimensionless radians and Hertz being the inverse of seconds. The issue is that all periodic functions of interest defined on (Radians as a unit of) angle are periodic with a period of 2pi radians, not with a period of 1 radian.

The notion of periodicity, or periods per second, is fundamental to what we mean by Hertz, but periodicity is a different fundamental notion than one of whatever measurement unit we happen to use for something per second. When an object is moving at 90 meters per second, we do not speak of it as having a frequency, because there are no periodic functions defined on velocity. And if we were measuring its rate of movement in feet instead, it would be unsatisfying to then claim it has a different frequency. On the other hand, if a sequence of identical objects two meters apart are all moving in the same direction and on the same path at 90 meters per second, we can speak of them as having a frequency of 45 Hertz, because the positions of objects relative to some fixed point is then a periodic function defined on velocity.

I maintain that Hertz is (ought to be) defined in periods-per-second of some periodic function of time. Thus if angle alpha is increasing by one radian per second, then the cosine of alpha is periodic with a frequency of 1/2pi Hertz. Conversely, the cosine of twice alpha would be periodic with a frequency of 1/pi Hertz. But the angle alpha, itself, would have no periodicity, because although it is a function of time it is not a periodic function. The point is that one cannot define Hertz (a unit of frequency, or an inverse unit of period) without reference to a specific periodic function of time.

Thus, expressing any measurement in Hertz requires a specific periodic function (or set of functions having the same period) of time. This makes Hertz a higher-order function, in that a function to calculate the Hertz of anything requires a function as one of its arguments. And I gather the SI committee really dislikes requiring people to define higher-order functions, and the community of mathematicians and engineers is very much accustomed to talking about Hertz (in angles, etc) correctly with respect to my definition but usually without saying what function the frequency describes.

As an aside, this points out that a useful mathematical library in any language that provides units of measure should have a higher-order function that gives the periodicity of another function in units of that function's input, and also a higher-order function that tells the units (or the dimension) in which another function is defined.


(edited 9:25 Pacific time, Sun 1 Jan 2013: simplified discussion of Hertz definition)