summaryrefslogtreecommitdiff
path: root/lisp/calc/calc-stat.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/calc/calc-stat.el')
-rw-r--r--lisp/calc/calc-stat.el11
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