hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_inteq_fredholm2_smooth (d05ab)

Purpose

nag_inteq_fredholm2_smooth (d05ab) solves any linear nonsingular Fredholm integral equation of the second kind with a smooth kernel.

Syntax

[f, c, ifail] = d05ab(k, g, lambda, a, b, odorev, ev, n)
[f, c, ifail] = nag_inteq_fredholm2_smooth(k, g, lambda, a, b, odorev, ev, n)

Description

nag_inteq_fredholm2_smooth (d05ab) uses the method of El–Gendi (1969) to solve an integral equation of the form
b
f(x)λk(x,s)f(s)ds = g(x)
a
f(x)-λabk(x,s)f(s)ds=g(x)
for the function f(x)f(x) in the range axbaxb.
An approximation to the solution f(x)f(x) is found in the form of an nn term Chebyshev series i = 1nciTi(x)i=1nciTi(x), where  indicates that the first term is halved in the sum. The coefficients cici, for i = 1,2,,ni=1,2,,n, of this series are determined directly from approximate values fifi, for i = 1,2,,ni=1,2,,n, of the function f(x)f(x) at the first nn of a set of m + 1m+1 Chebyshev points
xi = (1/2)(a + b + (ba) × cos[(i1) × π / m]),  i = 1,2,,m + 1.
xi=12(a+b+(b-a)×cos[(i-1)×π/m]),  i=1,2,,m+1.
The values fifi are obtained by solving a set of simultaneous linear algebraic equations formed by applying a quadrature formula (equivalent to the scheme of Clenshaw and Curtis (1960)) to the integral equation at each of the above points.
In general m = n1m=n-1. However, advantage may be taken of any prior knowledge of the symmetry of f(x)f(x). Thus if f(x)f(x) is symmetric (i.e., even) about the mid-point of the range (a,b)(a,b), it may be approximated by an even Chebyshev series with m = 2n1m=2n-1. Similarly, if f(x)f(x) is anti-symmetric (i.e., odd) about the mid-point of the range of integration, it may be approximated by an odd Chebyshev series with m = 2nm=2n.

References

Clenshaw C W and Curtis A R (1960) A method for numerical integration on an automatic computer Numer. Math. 2 197–205
El–Gendi S E (1969) Chebyshev solution of differential, integral and integro-differential equations Comput. J. 12 282–287

Parameters

Compulsory Input Parameters

1:     k – function handle or string containing name of m-file
k must compute the value of the kernel k(x,s)k(x,s) of the integral equation over the square axbaxb, asbasb.
[result] = k(x, s)

Input Parameters

1:     x – double scalar
2:     s – double scalar
The values of xx and ss at which k(x,s)k(x,s) is to be calculated.

Output Parameters

1:     result – double scalar
The result of the function.
2:     g – function handle or string containing name of m-file
g must compute the value of the function g(x)g(x) of the integral equation in the interval axbaxb.
[result] = g(x)

Input Parameters

1:     x – double scalar
The value of xx at which g(x)g(x) is to be calculated.

Output Parameters

1:     result – double scalar
The result of the function.
3:     lambda – double scalar
The value of the parameter λλ of the integral equation.
4:     a – double scalar
aa, the lower limit of integration.
5:     b – double scalar
bb, the upper limit of integration.
Constraint: b > ab>a.
6:     odorev – logical scalar
Indicates whether it is known that the solution f(x)f(x) is odd or even about the mid-point of the range of integration. If odorev is true then an odd or even solution is sought depending upon the value of ev.
7:     ev – logical scalar
Is ignored if odorev is false. Otherwise, if ev is true, an even solution is sought, whilst if ev is false, an odd solution is sought.
8:     n – int64int32nag_int scalar
The number of terms in the Chebyshev series which approximates the solution f(x)f(x).
Constraint: n1n1.

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

cm f1 wk ldcm nt2p1

Output Parameters

1:     f(n) – double array
The approximate values fifi, for i = 1,2,,ni=1,2,,n, of the function f(x)f(x) at the first n of m + 1m+1 Chebyshev points (see Section [Description]), where
m = 2n1m=2n-1 if odorev = trueodorev=true and ev = trueev=true.
m = 2nm=2n if odorev = trueodorev=true and ev = falseev=false.
m = n1m=n-1 if odorev = falseodorev=false.
2:     c(n) – double array
The coefficients cici, for i = 1,2,,ni=1,2,,n, of the Chebyshev series approximation to f(x)f(x). When odorev is true, this series contains polynomials of even order only or of odd order only, according to ev being true or false respectively.
3:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,abab or n < 1n<1.
  ifail = 2ifail=2
A failure has occurred due to proximity to an eigenvalue. In general, if lambda is near an eigenvalue of the integral equation, the corresponding matrix will be nearly singular. In the special case, m = 1m=1, the matrix reduces to a zero-valued number.

Accuracy

No explicit error estimate is provided by the function but it is possible to obtain a good indication of the accuracy of the solution either
(i) by examining the size of the later Chebyshev coefficients cici, or
(ii) by comparing the coefficients cici or the function values fifi for two or more values of n.

Further Comments

The time taken by nag_inteq_fredholm2_smooth (d05ab) depends upon the value of n and upon the complexity of the kernel function k(x,s)k(x,s).

Example

function nag_inteq_fredholm2_smooth_example
k = @(x, s) 1/(1+(x-s)*(x-s));
g = @(x) 1;
lambda = -0.3183;
a = -1;
b = 1;
odorev = true;
ev = true;
n = int64(5);
[f, c, ifail] = nag_inteq_fredholm2_smooth(k, g, lambda, a, b, odorev, ev, n)
 

f =

    0.7557
    0.7453
    0.7173
    0.6832
    0.6605


c =

    1.4152
    0.0494
   -0.0010
   -0.0002
    0.0000


ifail =

                    0


function d05ab_example
k = @(x, s) 1/(1+(x-s)*(x-s));
g = @(x) 1;
lambda = -0.3183;
a = -1;
b = 1;
odorev = true;
ev = true;
n = int64(5);
[f, c, ifail] = d05ab(k, g, lambda, a, b, odorev, ev, n)
 

f =

    0.7557
    0.7453
    0.7173
    0.6832
    0.6605


c =

    1.4152
    0.0494
   -0.0010
   -0.0002
    0.0000


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

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