Permalink
Browse files

Correct error in statistics loops.

Also miscellaneous edits and copyright update.
  • Loading branch information...
1 parent da115b2 commit 08c0f625873724aea790f59dbd1f33ab51144a09 Thomas M. Hermann committed Aug 9, 2012
Showing with 34 additions and 29 deletions.
  1. +1 −1 curve-fit.lisp
  2. +13 −12 defpackage.lisp
  3. +1 −1 error-analysis.lisp
  4. +1 −1 floating-point.asd
  5. +1 −1 predicates.lisp
  6. +17 −13 statistics.lisp
View
2 curve-fit.lisp
@@ -3,7 +3,7 @@
Floating Point Functions
- Copyright (c) 2009-2011, Thomas M. Hermann
+ Copyright (c) 2009-2012, Thomas M. Hermann
All rights reserved.
Redistribution and use in source and binary forms, with or without
View
25 defpackage.lisp
@@ -3,7 +3,7 @@
Floating Point Functions
- Copyright (c) 2009,2010, Thomas M. Hermann
+ Copyright (c) 2009-2012, Thomas M. Hermann
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -39,19 +39,20 @@
(defpackage :floating-point
(:use :common-lisp)
(:nicknames :fp)
- (:export :*measure* :*epsilon* :*significant-figures*
- ;; Error analysis
- :default-epsilon
+ ;; Control parameters
+ (:export :*measure* :*epsilon* :*significant-figures*)
+ ;; Error analysis
+ (:export :default-epsilon
:relative-error
- :relative-error-norm
- ;; Floating point predicates
- :float-equal
+ :relative-error-norm)
+ ;; Floating point predicates
+ (:export :float-equal
:sigfig-equal
- :norm-equal
- ;; Curve fitting
- :linear-least-squares
- ;; Statistics
- :arithmetic-mean
+ :norm-equal)
+ ;; Curve fitting
+ (:export :linear-least-squares)
+ ;; Statistics
+ (:export :arithmetic-mean
:standard-deviation
:sample-standard-deviation
:mean-and-standard-deviation))
View
2 error-analysis.lisp
@@ -3,7 +3,7 @@
Floating Point Functions
- Copyright (c) 2009,2010, Thomas M. Hermann
+ Copyright (c) 2009-2012, Thomas M. Hermann
All rights reserved.
Redistribution and use in source and binary forms, with or without
View
2 floating-point.asd
@@ -38,7 +38,7 @@
(defsystem :floating-point
:description "Floating point functions."
- :version "0.0.0"
+ :version "0.0.1"
:author "Thomas M. Hermann <thomas.m.hermann@odonata-research.com>"
:license "BSD"
:components
View
2 predicates.lisp
@@ -3,7 +3,7 @@
Floating Point Functions
- Copyright (c) 2009,2010, Thomas M. Hermann
+ Copyright (c) 2009-2012, Thomas M. Hermann
All rights reserved.
Redistribution and use in source and binary forms, with or without
View
30 statistics.lisp
@@ -3,7 +3,7 @@
Floating Point Functions
- Copyright (c) 2009-2011, Thomas M. Hermann
+ Copyright (c) 2009-2012, Thomas M. Hermann
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -40,9 +40,10 @@
"Return the arithmetic mean of the data."
(if data
(loop for item in data sum item into sumdata
- finally return
- (/ (+ data1 data2 sumdata)
- (+ 2 (length data))))
+ finally
+ (return
+ (/ (+ data1 data2 sumdata)
+ (+ 2 (length data)))))
(* 1/2 (+ data1 data2))))
(defun standard-deviation (data1 data2 &rest data)
@@ -54,9 +55,10 @@
for item in data
as diff = (- item mean)
sum (* diff diff) into sumdiff
- finally return
- (sqrt (/ (+ diff1 diff2 sumdiff)
- (+ 2 (length data)))))
+ finally
+ (return
+ (sqrt (/ (+ diff1 diff2 sumdiff)
+ (+ 2 (length data))))))
(let* ((mean (arithmetic-mean data1 data2))
(diff1 (* (- data1 mean) (- data1 mean)))
(diff2 (* (- data2 mean) (- data2 mean))))
@@ -71,9 +73,10 @@
for item in data
as diff = (- item mean)
sum (* diff diff) into sumdiff
- finally return
- (sqrt (/ (+ diff1 diff2 sumdiff)
- (+ 1 (length data)))))
+ finally
+ (return
+ (sqrt (/ (+ diff1 diff2 sumdiff)
+ (+ 1 (length data))))))
(let* ((mean (arithmetic-mean data1 data2))
(diff1 (* (- data1 mean) (- data1 mean)))
(diff2 (* (- data2 mean) (- data2 mean))))
@@ -88,9 +91,10 @@
for item in data
as diff = (- item mean)
sum (* diff diff) into sumdiff
- finally return
- (values mean (sqrt (/ (+ diff1 diff2 sumdiff)
- (+ 1 (length data))))))
+ finally
+ (return
+ (values mean (sqrt (/ (+ diff1 diff2 sumdiff)
+ (+ 1 (length data)))))))
(let* ((mean (arithmetic-mean data1 data2))
(diff1 (* (- data1 mean) (- data1 mean)))
(diff2 (* (- data2 mean) (- data2 mean))))

0 comments on commit 08c0f62

Please sign in to comment.