Steven Watanabe wrote:
AMDG
On 12/30/2015 05:49 AM, Itzik wrote:
Eventually it turned out that I was mistaken with the formula, and subtraction was required instead, so there's no problem there. Alas, there's also a much simpler use case: What if I want to average the temperature of the last N readouts? Shouldn't boost::units support this simple operation?
There's actually an alternate formula that does work:
M = 0 For i = 1..N M += (X_i - M)/i
The normal M = \sum X_i / N fails because of two operators, + and /, not just +. If you support that, I'm not sure what the point of using absolute in the first place is.
I have no formal physics education, but intuitively, adding two absolute temperatures doesn't seem really like a mistake to me, even if it's an odd thing to do.
In the case of the average, the addition gives an intermediate result which has no meaning by itself. This is forbidden by design. If this isn't what you need, don't use absolute.
In Christ, Steven Watanabe
Thank you Steven for the clarifications and guidance. I am well aware of this alternate form for calculating a mean. The matter is - eventually, when a user is confronted with such a barrier, I find it more likely that he/she will choose the easy way out: take the .value()s, sum, divide by N, and recreate the quantity (::fromValue()). All the checks and validations go down the drain. So I was hoping to get the reasoning behind the exclusion of the operators '+' and '/' for absolute quantities. In my eyes there's not much difference between summing two absolute quantities of mass density and two absolute temperatures. Surely, with most units the absolute and relative roles are implicitly interchanged without a hassle. My concern is whether denying the use of '+' and '/' on absolute temperatures justified and desirable, in light of it's probable effect. Additionally, here is a use case for absolute temperature ratios, for your consideration: https://www.grc.nasa.gov/www/K-12/airplane/etr.html Thanks again for your time.