]> code.delx.au - gnu-emacs/blobdiff - lisp/calc/calc-stat.el
Merge from origin/emacs-25
[gnu-emacs] / lisp / calc / calc-stat.el
index 83ce71a23769ab1b009285365ed2ac8e9d3ed976..48e4bf506d4a769a6339841f11091e35af4936c4 100644 (file)
@@ -1,9 +1,8 @@
 ;;; calc-stat.el --- statistical functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2016 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
 
 ;; This file is part of GNU Emacs.
 
         (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)
                          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