Você está na página 1de 1

Calculation of definite integrals

SCILAB offers a function, called intg, that calculates the definite integral of a function. The general call to
function intg is

[I,err]=intg(a,b,f [,ea [,er])

where a,b = limits of integration, f = represents a function, list or string, ea = absolute error required on
the result (default value, ea = 0), er = relative error required on the result (default value, er = 1.d-8), I =
integral value, and err = estimated absolute error on the result. If f is function its definition must be as
follows: y = f(t). If f is a list the list must be as follows: list(f,x1,x2,...), where f is a function with calling
sequence: f(t,x1,x2,...). Finally, if f is a string it refers to the name of a Fortran subroutine. An application
of function intg follows:

-->deff('[y]=f(x)','y=cos(x)+0.5*cos(2*x)+1.5*cos(3*x)')

-->[I,err] = intg(0,1,f)

err =

1.668E-14

I=

1.13935531