Numerical analysis in Javascript