Commit 2667d5c7 by Jay Belanger

### Add new functions for the root mean square of a (Calc) vector

* lisp/calc/calc-stats.el (calcFunc-rms, calc-vector-rms):
New functions.
* lisp/calc/calc-ext.el (calc-init-extensions): Add keybinding for
calc-vector-rms', add autoloads for calc-vector-rms' and
calcFunc-rms'.
* lisp/calc/calc-map.el (calc-u-oper-keys):  Add entry for
calcFunc-rms'.
calc-vector-rms'.
* doc/misc/calc.texi (Single-Variable Statistics): Document the rms
command.`
parent fa856144
 ... ... @@ -20738,9 +20738,12 @@ mean, then repeating until the two values converge. $$a_{i+1} = { a_i + b_i \over 2 } , \qquad b_{i+1} = \sqrt{a_i b_i}$$ @end tex @c @cindex Root-mean-square @c Another commonly used mean, the RMS (root-mean-square), can be computed @c for a vector of numbers simply by using the @kbd{A} command. @kindex u R @cindex Root-mean-square @tindex rms Another commonly used mean, the RMS (root-mean-square), can be computed for a vector of numbers by using the @kbd{u R} (@code{calc-vector-rms}) [@code{rms}]command. @kindex u S @pindex calc-vector-sdev ... ... @@ -36503,6 +36506,7 @@ keystrokes are not listed in this summary. @r{ v@: H u M @: @: 19 @:vmedian@:(v)} @r{ v@: I H u M @: @: 19 @:vhmean@:(v)} @r{ v@: u N @: @: 19 @:vmin@:(v)} @r{ v@: u R @: @: @:rms@:(v)} @r{ v@: u S @: @: 19 @:vsdev@:(v)} @r{ v@: I u S @: @: 19 @:vpsdev@:(v)} @r{ v@: H u S @: @: 19 @:vvar@:(v)}
 ... ... @@ -574,6 +574,7 @@ (define-key calc-mode-map "uG" 'calc-vector-geometric-mean) (define-key calc-mode-map "uM" 'calc-vector-mean) (define-key calc-mode-map "uN" 'calc-vector-min) (define-key calc-mode-map "uR" 'calc-vector-rms) (define-key calc-mode-map "uS" 'calc-vector-sdev) (define-key calc-mode-map "uU" 'calc-undo) (define-key calc-mode-map "uX" 'calc-vector-max) ... ... @@ -932,7 +933,7 @@ calc-preserve-point calc-replace-selections calc-replace-sub-formula calc-roll-down-with-selections calc-roll-up-with-selections calc-sel-error) ("calc-stat" calc-vector-op calcFunc-agmean ("calc-stat" calc-vector-op calcFunc-agmean calcFunc-rms calcFunc-vcorr calcFunc-vcount calcFunc-vcov calcFunc-vflat calcFunc-vgmean calcFunc-vhmean calcFunc-vmax calcFunc-vmean calcFunc-vmeane calcFunc-vmedian calcFunc-vmin calcFunc-vpcov ... ... @@ -1147,8 +1148,8 @@ calc-vector-covariance calc-vector-geometric-mean calc-vector-harmonic-mean calc-vector-max calc-vector-mean calc-vector-mean-error calc-vector-median calc-vector-min calc-vector-pop-covariance calc-vector-pop-sdev calc-vector-pop-variance calc-vector-product calc-vector-sdev calc-vector-sum calc-vector-variance) calc-vector-pop-variance calc-vector-product calc-vector-rms calc-vector-sdev calc-vector-sum calc-vector-variance) ("calc-store" calc-assign calc-copy-special-constant calc-copy-variable calc-declare-variable ... ...
 ... ... @@ -417,6 +417,7 @@ ( ?G 1 calcFunc-vgmean ) ( ?M 1 calcFunc-vmean ) ( ?N 1 calcFunc-vmin ) ( ?R 1 calcFunc-rms ) ( ?S 1 calcFunc-vsdev ) ( ?X 1 calcFunc-vmax ) ) ( ( ?C 2 calcFunc-vpcov ) ... ...
 ... ... @@ -863,6 +863,13 @@ :keys "I u M" :active (>= (calc-stack-size) 1) :help "The average (arithmetic mean) of the data values as an error form"] ["rms(1:)" (progn (require 'calc-stat) (call-interactively 'calc-vector-rms)) :keys "u R" :active (>= (calc-stack-size) 1) :help "The root mean square of the data values"] ["sdev(1:)" (progn (require 'calc-stat) ... ...
 ... ... @@ -71,6 +71,11 @@ (calc-vector-op "meae" 'calcFunc-vmeane arg) (calc-vector-op "mean" 'calcFunc-vmean arg))))) (defun calc-vector-rms (arg) (interactive "P") (calc-slow-wrapper (calc-vector-op "rms" 'calcFunc-rms arg))) (defun calc-vector-mean-error (arg) (interactive "P") (calc-invert-func) ... ... @@ -318,6 +323,12 @@ suminvsqrwts)) (math-div (calcFunc-reduce '(var add var-add) means) len))))))) (defun calcFunc-rms (a) "Return the root-mean-square of the vector A." (math-sqrt (calcFunc-vmean (calcFunc-map '(var abssqr var-abssqr) a)))) (defun math-fix-int-intv (x) (if (math-floatp x) x ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!