statistics tweaks
parent
2f8804ecdd
commit
1a59d2f44f
|
@ -12,7 +12,8 @@ Nice to have:
|
||||||
- infinite limits, sums, products
|
- infinite limits, sums, products
|
||||||
- finding roots with Newton's method
|
- finding roots with Newton's method
|
||||||
- solving ODEs with Runge-Kutta
|
- 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
|
- square root of a matrix, e^matrix
|
||||||
- finding roots of polynomials
|
- finding roots of polynomials
|
||||||
- Algebra:
|
- Algebra:
|
||||||
|
@ -32,7 +33,6 @@ Nice to have:
|
||||||
- minimal and characteristic polynomials of algebraic numbers
|
- minimal and characteristic polynomials of algebraic numbers
|
||||||
- norm and trace of algebraic numbers
|
- norm and trace of algebraic numbers
|
||||||
- minimal and characteristic polynomials of matrices
|
- minimal and characteristic polynomials of matrices
|
||||||
- eigenvalues of matrices
|
|
||||||
- Graphs:
|
- Graphs:
|
||||||
- minimum spanning trees
|
- minimum spanning trees
|
||||||
- Logic:
|
- Logic:
|
||||||
|
|
|
@ -5,10 +5,14 @@ USING: kernel math sequences ;
|
||||||
#! arithmetic mean, sum divided by length
|
#! arithmetic mean, sum divided by length
|
||||||
[ sum ] keep length / ;
|
[ sum ] keep length / ;
|
||||||
|
|
||||||
: geo-mean ( seq -- n )
|
: geometric-mean ( seq -- n )
|
||||||
#! geometric mean, nth root of product
|
#! geometric mean, nth root of product
|
||||||
[ product ] keep length swap nth-root ;
|
[ product ] keep length swap nth-root ;
|
||||||
|
|
||||||
|
: harmonic-mean ( seq -- n )
|
||||||
|
#! harmonic mean, reciprocal of sum of reciprocals.
|
||||||
|
[ recip ] map sum recip ;
|
||||||
|
|
||||||
: median ( seq -- n )
|
: median ( seq -- n )
|
||||||
#! middle number if odd, avg of two middle numbers if even
|
#! middle number if odd, avg of two middle numbers if even
|
||||||
number-sort dup length dup even? [
|
number-sort dup length dup even? [
|
||||||
|
@ -19,7 +23,7 @@ USING: kernel math sequences ;
|
||||||
|
|
||||||
: range ( seq -- n )
|
: range ( seq -- n )
|
||||||
#! max - min
|
#! max - min
|
||||||
number-sort [ first ] keep pop swap - ;
|
dup first 2dup [ min ] reduce >r [ max ] reduce r> - ;
|
||||||
|
|
||||||
: var ( seq -- )
|
: var ( seq -- )
|
||||||
#! variance, normalize by N-1
|
#! variance, normalize by N-1
|
||||||
|
|
Loading…
Reference in New Issue