# HG changeset patch # User Jay Belanger # Date 1186118503 0 # Node ID 5dbe5cf5ad967b258e40c696fb65e3fd8a07d453 # Parent 36893fdf92ab8432a0f038711f352a46615c6dda (math-get-value,math-get-sdev,math-contains-sdev): New functions. diff -r 36893fdf92ab -r 5dbe5cf5ad96 lisp/calc/calc-ext.el --- a/lisp/calc/calc-ext.el Fri Aug 03 04:57:05 2007 +0000 +++ b/lisp/calc/calc-ext.el Fri Aug 03 05:21:43 2007 +0000 @@ -2213,6 +2213,25 @@ a (math-reject-arg a 'constp))) +;;; Some functions for working with error forms. +(defun math-get-value (x) + "Get the mean value of the error form X. +If X is not an error form, return X." + (if (eq (car-safe x) 'sdev) + (nth 1 x) + x)) + +(defun math-get-sdev (x &optional one) + "Get the standard deviation of the error form X. +If X is not an error form, return 1." + (if (eq (car-safe x) 'sdev) + (nth 2 x) + (if one 1 0))) + +(defun math-contains-sdev-p (ls) + "Non-nil if the list LS contains an error form." + (let ((ls (if (eq (car-safe ls) 'vec) (cdr ls) ls))) + (memq t (mapcar (lambda (x) (eq (car-safe x) 'sdev)) ls)))) ;;; Coerce integer A to be a small integer. [S I] (defun math-fixnum (a)