|
Boost : |
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2005-10-11 19:54:25
On 10/11/05, Deane Yang <deane_yang_at_[hidden]> wrote:
>
> What I'm more interested in learning is how you handle "composite
> quantities", which are obtained by multiplying and dividing existing
> units (like "meters/second"), as well as raising to a rational power
> (like the standard unit of volatility in finance, "1/square_root(years)".
>
>
Rational powers are handled with power functions and metafunctions, as I
showed in later replies. However, I would like much more information
regarding "volatility in finance." Up until now, I have seen absolutely no
cases where non-derived unit classifications raised to a non-integer powers
makes sense and have even talked about such situations with mathematicians.
Looking back to the archives, I see people talking about fractional-powered
base units being possible and speak of examples from other threads, but I
can't seem to find such examples. An exact link would be very helpful. Right
now I support fractional powers, but not when the operation yields
fractional-powered base units. For instance, I allow the expression
power< 1, 2 >( your_meters_quantity * your_meters_quantity )
// where power< 1,2 > denotes a power of 1/2
However, I have chosen to disallow:
power< 1, 2 >( your_meters )
since it does not seem to ever make sense -- for any base classification
type, not just length. In an attempt to rationalize why this was the case, I
noticed that a base classification raised to a power could be looked at as a
hyper-volume in N-dimensional space, where N is the value of the exponent.
Continuing with "length" as an example, your_meters^2 represents a
hyper-volume in 2 dimensional space (area), and your_meters^3 represents a
hyper-volume in 3 dimensional space (volume), and your_meters^-3 could be
looked at as units per volume, etc. This model makes sense for all integer
powers, yet not for rational powers for base units, as it would imply a
concept of fractions of a dimension, which intuitively I do not believe
exist, though I am admittedly not a mathematician and my model could be too
specific.
Keep in mind that rational powered derived-classifications are still
perfectly fine, just so long as the resultant unit type does not have
fractional powered base units in its make-up. Considering you apparently
have an example where fractional-powered years is used (years being a base
unit of time), I suppose my logic could be flawed, though I haven't heard of
your example and googling around doesn't appear to be helping either. If you
can, would you link to information regarding such fractional-powered base
classifications? It's easy to go back and allow them in my library, as my
restriction is mostly just superficial, but I won't do so until I see a
place in practice where such operations actually make sense.
Thanks in advance.
-- -Matt Calabrese
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk