- 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:
- 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:
#! 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? [
: 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