before computing the averages.
+2010-05-17 Jay Belanger <jay.p.belanger@gmail.com>
+
+ * calc/calc-vec.el (math-vector-avg): Put the vector elements in
+ order before computing the averages.
+
2010-05-16 Jay Belanger <jay.p.belanger@gmail.com>
* calc/calc-vec.el (calc-histogram):
;;; Replace a vector [a b c ...] with a vector of averages
;;; [(a+b)/2 (b+c)/2 ...]
(defun math-vector-avg (vec)
- (let ((vp (cdr vec))
+ (let ((vp (sort (copy-sequence (cdr vec)) 'math-beforep))
(res nil))
(while (and vp (cdr vp))
(setq res (cons (math-div (math-add (car vp) (cadr vp)) 2) res)