vpaintegral

Numerical definite integral of a symbolic expression in variable-precision arithmetic.

Category: Mathematics > Calculus

Syntax

q = vpaintegral(f, x, a, b)

Integrates f with respect to x from a to b.

q = vpaintegral(f, a, b)

Integrates with respect to the default variable of f.

Description

Unlike int, which looks for a closed form, vpaintegral evaluates the integral numerically, so it works for integrands with no elementary antiderivative such as exp(-x^2). The result is a symbolic number, which can be converted with double.

Input arguments

f
Symbolic expression to integrate.
x
Integration variable.
a, b
Limits of integration, numbers or symbolic numbers.

Output arguments

q
Symbolic number holding the numerical value of the integral.

Example

Integral without a closed form

syms x
q = vpaintegral(exp(-x^2), x, 0, 1)
Output
q = 0.746824

Notes

The tolerance options of MATLAB are not covered.

See also

int integral vpa vpasum double