nag_inteq_fredholm2_smooth (d05abc) (PDF version)
d05 Chapter Contents
d05 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_inteq_fredholm2_smooth (d05abc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

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

2  Specification

#include <nag.h>
#include <nagd05.h>
void  nag_inteq_fredholm2_smooth (double lambda, double a, double b, Integer n,
double (*k)(double x, double s, Nag_Comm *comm),
double (*g)(double x, Nag_Comm *comm),
Nag_Boolean odorev, Nag_Boolean ev, double f[], double c[], Nag_Comm *comm, NagError *fail)

3  Description

nag_inteq_fredholm2_smooth (d05abc) uses the method of El–Gendi (1969) to solve an integral equation of the form
fx-λabkx,sfsds=gx
for the function fx in the range axb.
An approximation to the solution fx is found in the form of an n term Chebyshev series i=1nciTix, where  indicates that the first term is halved in the sum. The coefficients ci, for i=1,2,,n, of this series are determined directly from approximate values fi, for i=1,2,,n, of the function fx at the first n of a set of m+1 Chebyshev points
xi=12a+b+b-a×cosi-1×π/m,  i=1,2,,m+1.
The values fi 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=n-1. However, advantage may be taken of any prior knowledge of the symmetry of fx. Thus if fx is symmetric (i.e., even) about the mid-point of the range a,b, it may be approximated by an even Chebyshev series with m=2n-1. Similarly, if fx 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=2n.

4  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

5  Arguments

1:     lambdadoubleInput
On entry: the value of the parameter λ of the integral equation.
2:     adoubleInput
On entry: a, the lower limit of integration.
3:     bdoubleInput
On entry: b, the upper limit of integration.
Constraint: b>a.
4:     nIntegerInput
On entry: the number of terms in the Chebyshev series which approximates the solution fx.
Constraint: n1.
5:     kfunction, supplied by the userExternal Function
k must compute the value of the kernel kx,s of the integral equation over the square axb, asb.
The specification of k is:
double  k (double x, double s, Nag_Comm *comm)
1:     xdoubleInput
2:     sdoubleInput
On entry: the values of x and s at which kx,s is to be calculated.
3:     commNag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to k.
userdouble *
iuserInteger *
pPointer 
The type Pointer will be void *. Before calling nag_inteq_fredholm2_smooth (d05abc) you may allocate memory and initialize these pointers with various quantities for use by k when called from nag_inteq_fredholm2_smooth (d05abc) (see Section 3.2.1 in the Essential Introduction).
6:     gfunction, supplied by the userExternal Function
g must compute the value of the function gx of the integral equation in the interval axb.
The specification of g is:
double  g (double x, Nag_Comm *comm)
1:     xdoubleInput
On entry: the value of x at which gx is to be calculated.
2:     commNag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to g.
userdouble *
iuserInteger *
pPointer 
The type Pointer will be void *. Before calling nag_inteq_fredholm2_smooth (d05abc) you may allocate memory and initialize these pointers with various quantities for use by g when called from nag_inteq_fredholm2_smooth (d05abc) (see Section 3.2.1 in the Essential Introduction).
7:     odorevNag_BooleanInput
On entry: indicates whether it is known that the solution fx is odd or even about the mid-point of the range of integration. If odorev is Nag_TRUE then an odd or even solution is sought depending upon the value of ev.
8:     evNag_BooleanInput
On entry: is ignored if odorev is Nag_FALSE. Otherwise, if ev is Nag_TRUE, an even solution is sought, whilst if ev is Nag_FALSE, an odd solution is sought.
9:     f[n]doubleOutput
On exit: the approximate values fi, for i=1,2,,n, of the function fx at the first n of m+1 Chebyshev points (see Section 3), where
m=2n-1 if odorev=Nag_TRUE and ev=Nag_TRUE.
m=2n if odorev=Nag_TRUE and ev=Nag_FALSE.
m=n-1 if odorev=Nag_FALSE.
10:   c[n]doubleOutput
On exit: the coefficients ci, for i=1,2,,n, of the Chebyshev series approximation to fx. When odorev is Nag_TRUE, this series contains polynomials of even order only or of odd order only, according to ev being Nag_TRUE or Nag_FALSE respectively.
11:   commNag_Comm *Communication Structure
The NAG communication argument (see Section 3.2.1.1 in the Essential Introduction).
12:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_EIGENVALUES
A failure has occurred due to proximity of an eigenvalue.
NE_INT
On entry, n=value.
Constraint: n1.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
NE_REAL_2
On entry, a=value and b=value.
Constraint: b>a.

7  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 ci, or
(ii) by comparing the coefficients ci or the function values fi for two or more values of n.

8  Further Comments

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

9  Example

This example solves Love's equation:
fx+1π -11fs 1+ x-s 2 ds=1 .
It will solve the slightly more general equation:
fx-λ ab kx,sfs ds=1
where kx,s=α/α2+ x-s 2. The values λ=-1/π,a=-1,b=1,α=1 are used below.
It is evident from the symmetry of the given equation that fx is an even function. Advantage is taken of this fact both in the application of nag_inteq_fredholm2_smooth (d05abc), to obtain the fifxi and the ci, and in subsequent applications of nag_sum_cheby_series (c06dcc) to obtain fx at selected points.
The program runs for n=5 and n=10.

9.1  Program Text

Program Text (d05abce.c)

9.2  Program Data

None.

9.3  Program Results

Program Results (d05abce.r)


nag_inteq_fredholm2_smooth (d05abc) (PDF version)
d05 Chapter Contents
d05 Chapter Introduction
NAG C Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012