comparison lisp/calc/calc-ext.el @ 82246:5dbe5cf5ad96

(math-get-value,math-get-sdev,math-contains-sdev): New functions.
author Jay Belanger <jay.p.belanger@gmail.com>
date Fri, 03 Aug 2007 05:21:43 +0000
parents b98604865ea0
children 01eedbaaac05 cd5e99697764
comparison
equal deleted inserted replaced
82245:36893fdf92ab 82246:5dbe5cf5ad96
2211 (if (or (math-constp a) 2211 (if (or (math-constp a)
2212 (and exp-ok math-expand-formulas)) 2212 (and exp-ok math-expand-formulas))
2213 a 2213 a
2214 (math-reject-arg a 'constp))) 2214 (math-reject-arg a 'constp)))
2215 2215
2216 ;;; Some functions for working with error forms.
2217 (defun math-get-value (x)
2218 "Get the mean value of the error form X.
2219 If X is not an error form, return X."
2220 (if (eq (car-safe x) 'sdev)
2221 (nth 1 x)
2222 x))
2223
2224 (defun math-get-sdev (x &optional one)
2225 "Get the standard deviation of the error form X.
2226 If X is not an error form, return 1."
2227 (if (eq (car-safe x) 'sdev)
2228 (nth 2 x)
2229 (if one 1 0)))
2230
2231 (defun math-contains-sdev-p (ls)
2232 "Non-nil if the list LS contains an error form."
2233 (let ((ls (if (eq (car-safe ls) 'vec) (cdr ls) ls)))
2234 (memq t (mapcar (lambda (x) (eq (car-safe x) 'sdev)) ls))))
2216 2235
2217 ;;; Coerce integer A to be a small integer. [S I] 2236 ;;; Coerce integer A to be a small integer. [S I]
2218 (defun math-fixnum (a) 2237 (defun math-fixnum (a)
2219 (if (consp a) 2238 (if (consp a)
2220 (if (cdr a) 2239 (if (cdr a)