statistics tweaks

cvs
Slava Pestov 2005-10-31 05:41:17 +00:00
parent 2f8804ecdd
commit 1a59d2f44f
2 changed files with 8 additions and 4 deletions

View File

@ -12,7 +12,8 @@ Nice to have:
- infinite limits, sums, products
- finding roots with Newton's method
- solving ODEs with Runge-Kutta
- matrices: singular value decomposition, eigenvalues, LU decomposition
- matrices: singular value decomposition, eigenvalues, LU decomposition,
polar decomposition
- square root of a matrix, e^matrix
- finding roots of polynomials
- Algebra:
@ -32,7 +33,6 @@ Nice to have:
- minimal and characteristic polynomials of algebraic numbers
- norm and trace of algebraic numbers
- minimal and characteristic polynomials of matrices
- eigenvalues of matrices
- Graphs:
- minimum spanning trees
- Logic:

View File

@ -5,10 +5,14 @@ USING: kernel math sequences ;
#! arithmetic mean, sum divided by length
[ sum ] keep length / ;
: geo-mean ( seq -- n )
: geometric-mean ( seq -- n )
#! geometric mean, nth root of product
[ product ] keep length swap nth-root ;
: harmonic-mean ( seq -- n )
#! harmonic mean, reciprocal of sum of reciprocals.
[ recip ] map sum recip ;
: median ( seq -- n )
#! middle number if odd, avg of two middle numbers if even
number-sort dup length dup even? [
@ -19,7 +23,7 @@ USING: kernel math sequences ;
: range ( seq -- n )
#! max - min
number-sort [ first ] keep pop swap - ;
dup first 2dup [ min ] reduce >r [ max ] reduce r> - ;
: var ( seq -- )
#! variance, normalize by N-1