
Matthias, Matthias Schabel wrote:
Engineering approximations are often derived by regression to empirical functional forms, which can result in all kinds of dimensional weirdness, including floating point powers. In principle these could be accommodated within a dimensional analysis framework. In practice, floating point powers are impossible for a compile-time library. On the other hand, we do support rational powers and, for engineering approximations, you might as well use a rational approximation to the powers since it is unlikely that they will be exactly equal to some irrational value...
I am still skeptical for the need of anything fancy here. In my experience, fractional powers of units/dimensions are needed only if you need to use such units in the interface. For example, in finance, volatility, which is in units of time raised to the negative 1/2 power, is a common input or output parameter. But if the fractional powers occur only within a calculation of a formula, then I don't see the need for fractional dimensions. The (appropriate) trick is to convert anything that is going to be raised to a weird power into a unitless quantity before you put it into the power function. Let me concoct an example: Suppose you have a funky force field F that depends on distance and velocity in some weird way. In particular, suppose that if distance is in meters and velocity is in meters per second, you've decided that the force in newtons is given (approximately) by F(d, v) = d^{1/3} / v^{sqrt(2)} - v^{-5/4} You want to code this formula up so that you can input each of the quantities in different units from the original ones. The trick is to rewrite it as: F(d, v) = [(d/d_0)^{1/3}/ (v/v_0)^{sqrt(2)} - (v/v_0)^(-5/4}] * F_0 where d_0 = 1 meter, v_0 = 1 meter/second, and F_0 = 1 newton. Then if your library has implicit unit conversions, then formula will be properly calculated, no matter what units the input values d and v are in. But surely I'm telling you anything new? I'm pretty sure I learned tricks like this from physicists. So I still need an example where this approach does not work or where the extra divisions cause a serious problem. Deane