Javascript Numerical Integration