Scilab Numerical Integration Methods
intg
CALLING SEQUENCE
[v,err]=intg(a,b,f [,ea [,er])
PARAMETERS
a,b : real numbers
f : external (function or list or string)
ea, er : real numbers
ea : absolute error required on the result. Default value: 0
er : relative error required on the result. Default value: 1.d-8
err : estimated absolute error on the result.
DESCRIPTION
intg(a,b,f) evaluates the definite integral from a to b of f(t)dt. The
evaluation hopefully satisfies following claim for accuracy: abs(I-v)<=
max(ea,er*abs(I)) where I stands for the exact value of the integral. f
is an external :
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,...).
If f is a string it refers to a the name of a Fortran subroutine (see
source code of fintg.f)
EXAMPLE
deff('[y]=f(x)','y=x*sin(30*x)/sqrt(1-((x/(2*%pi))^2))')
exact=-2.5432596188;
abs(exact-intg(0,2*%pi,f))
// See file routines/default/Ex-intg.f
abs(exact-intg(0,2*%pi,'intgex'))
integrate
CALLING SEQUENCE
[x]=integrate(expr,v,x0,x1 [,ea [,er]])
PARAMETERS
expr : external Scilab
v : string (integration variable)
x0,x1 : real numbers (bounds of integration)
ea,er : real numbers (absolute error bound) Default value: 0
er : real number, (relative error bound) Default value: 1.d-8
DESCRIPTION
computes :
/x1
[
x = I f(v)dv
]
/x0
The evaluation hopefully satisfies following claim for accuracy:
abs(I-x)<= max(ea,er*abs(I)) where I stands for the exact value of the
integral.
EXAMPLE
integrate('sin(x)','x',0,%pi)
integrate(['if x==0 then 1,';
'else sin(x)/x,end'],'x',0,%pi)
Return to course home page