Integer type:** int32**** int64**** nag_int** show int32 show int32 show int64 show int64 show nag_int show nag_int

nag_quad_1d_fin_smooth (d01bd) calculates an approximation to the integral of a function over a finite interval [a,b]$[a,b]$:

It is non-adaptive and as such is recommended for the integration of ‘smooth’ functions. These **exclude** integrands with singularities, derivative singularities or high peaks on [a,b]$[a,b]$, or which oscillate too strongly on [a,b]$[a,b]$.

$$I=\underset{a}{\overset{b}{\int}}f\left(x\right)dx\text{.}$$ |

nag_quad_1d_fin_smooth (d01bd) is based on the QUADPACK routine QNG (see Piessens et al. (1983)). It is a non-adaptive function which uses as its basic rules, the Gauss 10$10$-point and 21$21$-point formulae. If the accuracy criterion is not met, formulae using 43$43$ and 87$87$ points are used successively, stopping whenever the accuracy criterion is satisfied.

This function is designed for smooth integrands only.

Patterson T N L (1968) The Optimum addition of points to quadrature formulae *Math. Comput.* **22** 847–856

Piessens R, de Doncker–Kapenga E, Überhuber C and Kahaner D (1983) *QUADPACK, A Subroutine Package for Automatic Integration* Springer–Verlag

- 1: f – function handle or string containing name of m-file
- 2: a – double scalar
- a$a$, the lower limit of integration.
- 3: b – double scalar
- b$b$, the upper limit of integration. It is not necessary that a < b$a<b$.
- 4: epsabs – double scalar
- The absolute accuracy required. If epsabs is negative, the absolute value is used. See Section [Accuracy].
- 5: epsrel – double scalar
- The relative accuracy required. If epsrel is negative, the absolute value is used. See Section [Accuracy].

None.

None.

- 1: result – double scalar
- The approximation to the integral I$I$.
- 2: abserr – double scalar
- An estimate of the modulus of the absolute error, which should be an upper bound for |I − result|$|I-{\mathbf{result}}|$.

There are no specific errors detected by nag_quad_1d_fin_smooth (d01bd). However, if abserr is greater than

this indicates that the function has probably failed to achieve the requested accuracy within 87$87$ function evaluations.

$$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\{{\mathbf{epsabs}},{\mathbf{epsrel}}\times \left|{\mathbf{result}}\right|\}$$ |

nag_quad_1d_fin_smooth (d01bd) attempts to compute an approximation, result, such that:

where

and epsabs and epsrel are user-specified absolute and relative error tolerances. There can be no guarantee that this is achieved, and you are advised to subdivide the interval if you have any doubts about the accuracy obtained. Note that abserr contains an estimated bound on |I − result|$|I-{\mathbf{result}}|$.

$$|I-{\mathbf{result}}|\le \mathit{tol}\text{,}$$ |

$$\mathit{tol}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\{\left|{\mathbf{epsabs}}\right|,\left|{\mathbf{epsrel}}\right|\times \left|I\right|\}\text{,}$$ |

The time taken by nag_quad_1d_fin_smooth (d01bd) depends on the integrand and the accuracy required.

Open in the MATLAB editor: nag_quad_1d_fin_smooth_example

function nag_quad_1d_fin_smooth_examplef = @(x) x^2*sin(10*pi*x); a = 0; b = 1; epsabs = 0; epsrel = 0.0001; [result, abserr] = nag_quad_1d_fin_smooth(f, a, b, epsabs, epsrel)

result = -0.0318 abserr = 1.3443e-11

Open in the MATLAB editor: d01bd_example

function d01bd_examplef = @(x) x^2*sin(10*pi*x); a = 0; b = 1; epsabs = 0; epsrel = 0.0001; [result, abserr] = d01bd(f, a, b, epsabs, epsrel)

result = -0.0318 abserr = 1.3443e-11

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013