Macaulay2 » Documentation
Packages » Macaulay2Doc » analytic functions » integrate
next | previous | forward | backward | up | index | toc

# integrate -- numerical integration

- Usage:
    `integrate(f, a, b)`
- Inputs:
  - f, a function,
  - a, a number or an infinite number,
  - b, a number or an infinite number,
- Outputs:
  - a real number,

## Description

Integrate f from a to b numerically, using Gaussian quadrature.

    i1 : integrate(sin, 0, pi)

    o1 = 2

    o1 : RR (of precision 53)

For half-infinite intervals, 20-point Gauss-Laguerre quadrature is used.

    i2 : integrate(x -> exp(-x), 0, infinity)

    o2 = .9999999999999998

    o2 : RR (of precision 53)

For infinite intervals, 20-point Gauss-Hermite quadrature is used.

    i3 : integrate(x -> exp(-x^2), -infinity, infinity)

    o3 = 1.772453850905516

    o3 : RR (of precision 53)

## Ways to use integrate:

- `integrate(Function,InfiniteNumber,InfiniteNumber)`
- `integrate(Function,InfiniteNumber,Number)`
- `integrate(Function,Number,InfiniteNumber)`
- `integrate(Function,Number,Number)`

## For the programmer

The object integrate is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/functions/integrate-doc.m2:35:0.