emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master 2667d5c: Add new functions for the root mean sq


From: David Kastrup
Subject: Re: [Emacs-diffs] master 2667d5c: Add new functions for the root mean square of a (Calc) vector
Date: Wed, 16 Sep 2015 16:52:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: Stefan Monnier <address@hidden>
>> Date: Wed, 16 Sep 2015 09:21:40 -0400
>> Cc: Jay Belanger <address@hidden>
>> 
>> -*- mode: nit-pick -*-
>> 
>> > +Another commonly used mean, the RMS (root-mean-square), can be computed
>> > +for a vector of numbers by using the @kbd{u R}
>> 
>> I must admit that I don't use Calc very often, and read its manual even
>> less often, so clearly I'm taking this out of context, but in any case:
>> 
>> To me a "vector" has a rather specific meaning, and taking the root mean
>> square of a vector doesn't make much sense.  Instead, I like to take the
>> rms of a *set* of numbers (which may be provided by packaging them in
>> a vector, of course).
>
> As long as we are nit-picking, the result of root-mean-square
> generally depends on the order of the values (due to finite precision
> of FP calculations).  So it's not really an unordered set.

Calc generally calculates exact expressions unless you tell it not to.
At any rate, the "squares" (for complex numbers, they should just be the
sum of squares of real and imaginary part rather than a complex square)
are actually all non-negative, so there is not a lot of cancellation
going on.  The precision of your result will be very slightly better if
you do the summation from smallest to large.

At any rate, given the amount of nits to be found by mailing list
members, it might be prudent to employ the services of a debugger.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]