### Navigation

- index
- modules |
- next |
- previous |
- SciPy v0.7 Reference Guide (DRAFT) »
- Integration and ODEs (`scipy.integrate`) »

# scipy.integrate.simps

`scipy.integrate.``simps`(y, x=None, dx=1, axis=-1, even='avg')

  Integrate y(x) using samples along the given axis and the composite Simpson’s rule. If x is None, spacing of dx is assumed.

  If there are an even number of samples, N, then there are an odd number of intervals (N-1), but Simpson’s rule requires an even number of intervals. The parameter ‘even’ controls how this is handled as follows:

  even=’avg’: Average two results: 1) use the first N-2 intervals with
    a trapezoidal rule on the last interval and 2) use the last N-2 intervals with a trapezoidal rule on the first interval
  even=’first’: Use Simpson’s rule for the first N-2 intervals with
    a trapezoidal rule on the last interval.
  even=’last’: Use Simpson’s rule for the last N-2 intervals with a
    trapezoidal rule on the first interval.
  For an odd number of samples that are equally spaced the result is
    exact if the function is a polynomial of order 3 or less. If the samples are not equally spaced, then the result is exact only if the function is a polynomial of order 2 or less.

  See also:

  > quad - adaptive quadrature using QUADPACK romberg - adaptive Romberg quadrature quadrature - adaptive Gaussian quadrature fixed_quad - fixed-order Gaussian quadrature dblquad, tplquad - double and triple integrals romb, trapz - integrators for sampled data cumtrapz - cumulative integration for sampled data ode, odeint - ODE integrators

### Navigation

- index
- modules |
- next |
- previous |
- SciPy v0.7 Reference Guide (DRAFT) »
- Integration and ODEs (`scipy.integrate`) »