﻿ integrate – Algosim documentation
Algosim documentation: integrate

# integrate

Performs numerical integration.

## Syntax

• `integrate(expr, var, a, b[, Δ])`

• `expr` is an expression in one variable `var`

• `var` is the variable in `expr`

• `a` is the lower bound

• `b` is the upper bound

• `Δ` is the resolution of the integration (step size of `var`)

## Description

`integrate` performs numerical integration of a real-valued function of a single real variable on a finite interval.

## Notes

If the optional resolution argument `Δ` isn’t specified, the resolution is chosen so that the interval will be divided into 100 000 parts of the same width. Hence, the default value of `Δ` is `abs(b − a) / 100000`.

Decreasing `Δ` might improve the accuracy of the computed definite integral, but it will always make the computation take longer to complete.

## Examples

`integrate(x^2, x, 0, 1)`
`0.33333333335`
`integrate(sin(x), x, 0, π)`
`1.99999999984`
`integrate(sech(x), x, −100, 100)`
`3.14159265359	(=π)`
`integrate(e^−(x^2), x, −10, 10)`
`1.77245385091	(=√π)`
`2⋅integrate(√(1−x^2), x, −1, 1)`
`3.14159254841`
`integrate(x^2, x, 0, 1, 1/10000000)`
`0.333333333333`