Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - English


integrate

integration of an expression by quadrature

Syntax

y = integrate(expr, v, x0, x1)
y = integrate(expr, v, x0, x1, atol)
y = integrate(expr, v, x0, x1, atol, rtol)

Arguments

expr
a character string defining a Scilab expression.

v
a character string, the integration variable name.

x0
a real number, the lower bound of integration.

x1
a vector of real numbers, upper bounds of integration.

atol
a real number (absolute error bound). Default value: 1e-13.

rtol
a real number, (relative error bound). Default value: 1e-8.

y
a vector of real numbers, the integral value for each x1(i).

Description

y = integrate(expr, v, x0, x1 [,atol [,rtol]]) computes y(i) = integral_{x_0}^{x_1(i)} f(v).dv for i=1:size(x1,'*'), where f(v) is given by the expression expr.

The evaluation hopefully satisfies following claim for accuracy: abs(I - y) <= max(atol, rtol*abs(I)) where I stands for the exact value of the integral.

Restriction: The given expression must not use variable names with a leading %.

Examples

x1 = 0:0.1:2*%pi;
Y = integrate('sin(x)', 'x', 0, x1);
norm(cos(x1)-(1-Y))

x1 = -10:0.1:10;
Y = integrate(['if x==0 then 1,';
               'else sin(x)/x,end'], 'x', 0, x1)

See also

  • intg — definite integral
  • inttrap — integration of experimental data by trapezoidal interpolation
  • intsplin — integration of experimental data by spline interpolation
  • ode — ordinary differential equation solver

History

VersionDescription
6.1.0 Default atol value increased from 10-14 to 10-13.
Report an issue
<< intc Differential Equations intg >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:13:08 CEST 2024