Re: [boost] Interest in dimension/unit-checking library?

I'm no where close to the expert that you guys are, so I'll quickly toss in my two cents and get out of your way. On 10/13/05 Matt Calabrese <rivorus@gmail.com> wrote:
On 10/13/05, Deane Yang <deane_yang@yahoo.com> wrote:
Mathematically, I think Andy is entirely correct in what he says above. Once you take the ratio of two measurements of the same dimension (or quantity), you end up with a pure number that really can't be distinguished from other ratios or pure numbers.
I tend to disagree here. A ratio of two lengths, for example, is in fact a value in radians.
Um, careful there. Suppose I'm measuring the height of a shrub at various points in time. If I take one of those measurements and divide it by a measurement taken at a different time, then I get a ratio that expresses the shrub's change in height in a unitless way - I get the same value whether I made my measurements in meters, inches, or furlongs. This is an example of a common case where dividing two lengths doesn't give radians - it's just a ratio. The dimension/unit-checking library should solve the problems that it has enough information to solve. When it runs out of information it should ask for help. Would it make sense to have something like a unitless_cast<radians>? Scott Schurr

On 10/13/05, Scott Schurr <scott_schurr@credence.com> wrote:
I'm no where close to the expert that you guys are, so I'll quickly toss in my two cents and get out of your way.
On 10/13/05 Matt Calabrese <rivorus@gmail.com> wrote:
On 10/13/05, Deane Yang <deane_yang@yahoo.com> wrote:
Mathematically, I think Andy is entirely correct in what he says
above.
Once you take the ratio of two measurements of the same dimension (or quantity), you end up with a pure number that really can't be distinguished from other ratios or pure numbers.
I tend to disagree here. A ratio of two lengths, for example, is in fact a value in radians.
Um, careful there. Suppose I'm measuring the height of a shrub at various points in time. If I take one of those measurements and divide it by a measurement taken at a different time, then I get a ratio that expresses the shrub's change in height in a unitless way - I get the same value whether I made my measurements in meters, inches, or furlongs. This is an example of a common case where dividing two lengths doesn't give radians - it's just a ratio.
This is where I disagree. Radians ARE just ratios. More specifically, radians are ratios, degrees are ratios after a transformation, as are decibels and other similar units. Any quantity of one classification divided by a quantity of the same classification results in an untransformed ratio, which is what radians are. I gave the example with arc length and radius length since that's the easiest case for people to see the radian result, however the same holds true for energy divided by energy, or time divided by time. Results are radians. The arc example wasn't a specific case, just one that people would recognize. A lot of you here are under the assumption that radians are just "angles," which is not the case. They are just ways of representing a relationship between two quantities of the same classification directly, just like decibels and several other quantities of empty classification. It just so happens that we usually only explicitly attach the name "radians" to angles, since in other areas where ratios are used, it's understood that we aren't working under a transformation. Any length divided by any other length results in a value in radians regardless of whether you decide to interpret that result as an angle. A persons height divided by another persons height gives you a value in radians. A velocity divided by another velocity yields a value in radians. A radian is merely an untransformed ratio. I hate to use wikipedia as a source, but after searching, their description agrees with mine http://en.wikipedia.org/wiki/Radian . Note their definition "The radian is useful to distinguish between quantities of different nature but the same dimension." Note that radians aren't always angles. They are simply just untransformed ratios relating two quantities of the same dimension, just as I also described. They serve the same purpose as decibels do -- they describe a relationship between two quantities of the same dimension. Most people only think of radians as angle measures and not simply ratios because the only time they would usually need to explicitly state it is with angles, since we have other common ways of representing angles through transformations of simple ratios. Any quantity divided by a quantity of the same dimension is an untransformed ratio, which is precisely what radians are. Storing it as a raw value without units associated with it is a mistake and ambiguous. -- -Matt Calabrese

Matt Calabrese wrote:
This is where I disagree. Radians ARE just ratios. More specifically, radians are ratios, degrees are ratios after a transformation, as are decibels and other similar units. Any quantity of one classification divided by a quantity of the same classification results in an untransformed ratio, which is what radians are. I gave the example with arc length and radius length since that's the easiest case for people to see the radian result, however the same holds true for energy divided by energy, or time divided by time. Results are radians. The arc example wasn't a specific case, just one that people would recognize.
A lot of you here are under the assumption that radians are just "angles," which is not the case. They are just ways of representing a relationship between two quantities of the same classification directly, just like decibels and several other quantities of empty classification. It just so happens that we usually only explicitly attach the name "radians" to angles, since in other areas where ratios are used, it's understood that we aren't working under a transformation. Any length divided by any other length results in a value in radians regardless of whether you decide to interpret that result as an angle. A persons height divided by another persons height gives you a value in radians. A velocity divided by another velocity yields a value in radians. A radian is merely an untransformed ratio.
I hate to use wikipedia as a source, but after searching, their description agrees with mine http://en.wikipedia.org/wiki/Radian . Note their definition "The radian is useful to distinguish between quantities of different nature but the same dimension." Note that radians aren't always angles. They are simply just untransformed ratios relating two quantities of the same dimension, just as I also described. They serve the same purpose as decibels do -- they describe a relationship between two quantities of the same dimension. Most people only think of radians as angle measures and not simply ratios because the only time they would usually need to explicitly state it is with angles, since we have other common ways of representing angles through transformations of simple ratios.
I personally have never seen radian used as merely a synonym for ratio. Your reference to the wikipedia seems less than authoritarian on the matter. Your quote is mentioned at the start of the article. In the remainder of the article, substantially larger than the single sentence you quoted, radians are only described in their traditional usage regarding angles. Assuming your reference does stand on its own in the article, I still have issue with the reference. Given the large amount of literature in regard to the accuracy of the wikipedia, I looked up other references on the net. Mathworld only makes mention of angles (http://mathworld.wolfram.com/Radian.html ). A search on dictionary.com ( http://dictionary.reference.com/search?q=radian ) returned definitions from 4 different dictionaries that mention only angular measure. One of them makes specific reference to its definition in SI. On the US National Institute of Standards and Technology SI units web page, radian is listed as a derived unit (m * m^-1) of plane angle (http://physics.nist.gov/cuu/Units/units.html ). If you read a footnote, it would appear your quote from the wikipedia is actually, since it is unattributed, a plagiarism from the NIST web page. In a further derived quantity table, radians are only used in the context of angles. I can only conclude that radians are specifically related to angles. Thus the example of a ratio of one shrub to another, although also a derived unit of (m * m^-1), is not, by definition, a radian.
Any quantity divided by a quantity of the same dimension is an untransformed ratio, which is precisely what radians are. Storing it as a raw value without units associated with it is a mistake and ambiguous.
Although I obviously disagree with the first part, I agree with the second, with some reservations. Radian is the perfect example of a situation where there is a clear semantic "dimension" even though there is no unit dimension. In this case, tracking that semantic dimension would be just as helpful as tracking regular unit dimensions. And if I'm doing something in radians, I'd like it to be restricted to those computations that are semantically correct. In addition, I can also have the compiler enforce radian-degree interaction in my handling of angles. On the other hand, sometimes a dimensionless quantity is just a ratio, no more and no less. Sometimes I want to compare two quantities and use that ratio for scaling another quantity that is linked to it. Going back to the shrub, if I run a nursery and I price shrubs based on height, I might figure out the price of any given shrub based on scaling the value of a reference shrub. It's a little contrived, but I think you get the point. -- Noah

Noah Stein wrote:
Although I obviously disagree with the first part, I agree with the second, with some reservations. Radian is the perfect example of a situation where there is a clear semantic "dimension" even though there is no unit dimension. In this case, tracking that semantic dimension would be just as helpful as tracking regular unit dimensions. And if I'm doing something in radians, I'd like it to be restricted to those computations that are semantically correct. That's impossible, because it's possible to get a correct radian value by simplification of expressions. For example:
1/2*pi = -i * ln(i) (that's the value of arcsine(1) ). It's not possible to derive the "meaning" of the left part of this equation from meanings of the right part. Situation like this very often occur when you work with complex equations. -- With respect, Alex Besogonov(cyberax@elewise.com)

"Matt Calabrese" wrote
This is where I disagree. Radians ARE just ratios. More specifically,
[cut] The definition of a radian in Appendix A (A.9) of the Guide for the Use of the International System of Units is: "The radian is the plane angle between two radii of a circle that cut off on the circumference an arc equal to the radius." You need to accept that definition if you are to have any chance of writing a credible Units library I'm afraid. regards Andy Little

Andy Little wrote:
"Matt Calabrese" wrote
This is where I disagree. Radians ARE just ratios. More specifically,
[cut]
The definition of a radian in Appendix A (A.9) of the Guide for the Use of the International System of Units is:
"The radian is the plane angle between two radii of a circle that cut off on the circumference an arc equal to the radius."
You need to accept that definition if you are to have any chance of writing a credible Units library I'm afraid.
I'm afraid I agree with Andy and others who have posted on this. I don't know of a single mathematician who views "radians" as a synonym for "ratios", and although wikipedia is not bad for many mathematical concepts, it is definitely not authoritative. But it's more than that. I don't know how to define a clear set of semantic rules (what operations are allowed or are not allowed) for pure ratios, and I have not been able to follow what Matt has in mind here. You (Matt) might have a case, but you haven't convinced us yet. I would suggest that for the moment you represent ratios of the same quantity by a pure number type (I hope this will be a template parameter, because I want to use something besides float or double), but you should feel free to keep making your case. A short summary of what the allowable operations are, analogous to point + vector = point point - point = vector vector * scalar = vector vector +/- vector = vector would be helpful. To be honest, the "rules" that you've tried to come up with so far seem ad hoc to me and therefore unlikely to work in general. Here's an example: it is useful to feed decibels into the "10^x" function and radians into the sine function, but it is not useful to feed decibels into the sine function or radians into the "10^x" function. How do you propose to handle that kind of situation?
participants (6)
-
Alex Besogonov
-
Andy Little
-
Deane Yang
-
Matt Calabrese
-
Noah Stein
-
Scott Schurr