diff options
| author | Jay Belanger <jay.p.belanger@gmail.com> | 2015-09-15 19:53:06 -0500 |
|---|---|---|
| committer | Jay Belanger <jay.p.belanger@gmail.com> | 2015-09-15 19:53:06 -0500 |
| commit | 2667d5c7fbaa3de8103488c7e3779eb768f9d15c (patch) | |
| tree | 664c1b4571ea9cd67cb7b5ab50d7f73fadc82746 /lisp/calc/calc-stat.el | |
| parent | fa856144b7b6b4d90f48f862f88ed7cc8b40ca6f (diff) | |
| download | emacs-2667d5c7fbaa3de8103488c7e3779eb768f9d15c.tar.gz | |
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'.
* lisp/calc/calc-menu.el (calc-vectors-menu): Add entry for
`calc-vector-rms'.
* doc/misc/calc.texi (Single-Variable Statistics): Document the rms
command.
Diffstat (limited to 'lisp/calc/calc-stat.el')
| -rw-r--r-- | lisp/calc/calc-stat.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/calc/calc-stat.el b/lisp/calc/calc-stat.el index cf0b3ea4a12..a797db2e67d 100644 --- a/lisp/calc/calc-stat.el +++ b/lisp/calc/calc-stat.el @@ -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 |
