examples/advanced/custom_argument_parsing.js
function integrate (f, start, end, step) {
  let total = 0
  step = step || 0.01
  for (let x = start; x < end; x += step) {
    total += f(x + step / 2) * step
  }
  return total
}
function integrate (f, start, end, step) {
  let total = 0
  step = step || 0.01
  for (let x = start; x < end; x += step) {
    total += f(x + step / 2) * step
  }
  return total
}
function integrate ( f , start , end , step ) { let total = 0 step = step || 0.01 for ( let x = start ; x < end ; x += step ) { total += f ( x + step / 2 ) * step } return total }
Calculate the numeric integration of a function
@param {Function} f
@param {number} start
@param {number} end
@param {number} [step=0.01]
Calculate the numeric integration of a function