nag_inteq_fredholm2_split (d05aac) (PDF version)
d05 Chapter Contents
d05 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_inteq_fredholm2_split (d05aac)

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_inteq_fredholm2_split (d05aac) solves a linear, nonsingular Fredholm equation of the second kind with a split kernel.

2  Specification

#include <nag.h>
#include <nagd05.h>
void  nag_inteq_fredholm2_split (double lambda, double a, double b, Integer n,
double (*k1)(double x, double s, Nag_Comm *comm),
double (*k2)(double x, double s, Nag_Comm *comm),
double (*g)(double x, Nag_Comm *comm),
Nag_KernelForm kform, double f[], double c[], Nag_Comm *comm, NagError *fail)

3  Description

nag_inteq_fredholm2_split (d05aac) solves an integral equation of the form
fx-λabkx,sfsds=gx  
for axb, when the kernel k is defined in two parts: k=k1 for asx and k=k2 for x<sb. The method used is that of El–Gendi (1969) for which, it is important to note, each of the functions k1 and k2 must be defined, smooth and nonsingular, for all x and s in the interval a,b.
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-acosi-1π/m,  i=1,2,,m+1.  
The values fi are obtained by solving simultaneous linear algebraic equations formed by applying a quadrature formula (equivalent to the scheme of Clenshaw and Curtis (1960)) to the integral equation at the above points.
In general m=n-1. However, if the kernel k is centro-symmetric in the interval a,b, i.e., if kx,s=ka+b-x,a+b-s, then the function is designed to take advantage of this fact in the formation and solution of the algebraic equations. In this case, symmetry in the function gx implies symmetry in the function fx. In particular, if gx is even about the mid-point of the range of integration, then so also is fx, which may be approximated by an even Chebyshev series with m=2n-1. Similarly, if gx is odd about the mid-point then fx may be approximated by an odd 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:     lambda doubleInput
On entry: the value of the parameter λ of the integral equation.
2:     a doubleInput
On entry: a, the lower limit of integration.
3:     b doubleInput
On entry: b, the upper limit of integration.
Constraint: b>a.
4:     n IntegerInput
On entry: the number of terms in the Chebyshev series required to approximate fx.
Constraint: n1.
5:     k1 function, supplied by the userExternal Function
k1 must evaluate the kernel kx,s=k1x,s of the integral equation for asx.
The specification of k1 is:
double  k1 (double x, double s, Nag_Comm *comm)
1:     x doubleInput
2:     s doubleInput
On entry: the values of x and s at which k1x,s is to be evaluated.
3:     comm Nag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to k1.
userdouble *
iuserInteger *
pPointer 
The type Pointer will be void *. Before calling nag_inteq_fredholm2_split (d05aac) you may allocate memory and initialize these pointers with various quantities for use by k1 when called from nag_inteq_fredholm2_split (d05aac) (see Section 3.2.1.1 in the Essential Introduction).
6:     k2 function, supplied by the userExternal Function
k2 must evaluate the kernel kx,s=k2x,s of the integral equation for x<sb.
The specification of k2 is:
double  k2 (double x, double s, Nag_Comm *comm)
1:     x doubleInput
2:     s doubleInput
On entry: the values of x and s at which k2x,s is to be evaluated.
3:     comm Nag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to k2.
userdouble *
iuserInteger *
pPointer 
The type Pointer will be void *. Before calling nag_inteq_fredholm2_split (d05aac) you may allocate memory and initialize these pointers with various quantities for use by k2 when called from nag_inteq_fredholm2_split (d05aac) (see Section 3.2.1.1 in the Essential Introduction).
Note that the functions k1 and k2 must be defined, smooth and nonsingular for all x and s in the interval [a,b].
7:     g function, supplied by the userExternal Function
g must evaluate the function gx for axb.
The specification of g is:
double  g (double x, Nag_Comm *comm)
1:     x doubleInput
On entry: the values of x at which gx is to be evaluated.
2:     comm Nag_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_split (d05aac) you may allocate memory and initialize these pointers with various quantities for use by g when called from nag_inteq_fredholm2_split (d05aac) (see Section 3.2.1.1 in the Essential Introduction).
8:     kform Nag_KernelFormInput
On entry: determines the forms of the kernel, kx,s, and the function gx.
kform=Nag_NoCentroSymm
kx,s is not centro-symmetric (or no account is to be taken of centro-symmetry).
kform=Nag_CentroSymmOdd
kx,s is centro-symmetric and gx is odd.
kform=Nag_CentroSymmEven
kx,s is centro-symmetric and gx is even.
kform=Nag_CentroSymmNeither
kx,s is centro-symmetric but gx is neither odd nor even.
Constraint: kform=Nag_NoCentroSymm, Nag_CentroSymmOdd, Nag_CentroSymmEven or Nag_CentroSymmNeither.
9:     f[n] doubleOutput
On exit: the approximate values fi, for i=1,2,,n, of fx evaluated at the first n of m+1 Chebyshev points xi, (see Section 3).
If kform=Nag_NoCentroSymm or Nag_CentroSymmNeither, m=n-1.
If kform=Nag_CentroSymmOdd, m=2×n.
If kform=Nag_CentroSymmEven, m=2×n-1.
10:   c[n] doubleOutput
On exit: the coefficients ci, for i=1,2,,n, of the Chebyshev series approximation to fx.
If kform=Nag_CentroSymmOdd this series contains polynomials of odd order only and if kform=Nag_CentroSymmEven the series contains even order polynomials only.
11:   comm Nag_Comm *
The NAG communication argument (see Section 3.2.1.1 in the Essential Introduction).
12:   fail NagError *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.
See Section 3.2.1.2 in the Essential Introduction for further information.
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.
An unexpected error has been triggered by this function. Please contact NAG.
See Section 3.6.6 in the Essential Introduction for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 3.6.5 in the Essential Introduction for further information.
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 usually 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  Parallelism and Performance

nag_inteq_fredholm2_split (d05aac) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_inteq_fredholm2_split (d05aac) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9  Further Comments

The time taken by nag_inteq_fredholm2_split (d05aac) increases with n.
This function may be used to solve an equation with a continuous kernel by defining k1 and k2 to be identical.
This function may also be used to solve a Volterra equation by defining k2 (or k1) to be identically zero.

10  Example

This example solves the equation
fx - 01 kx,s fs ds = 1 - 1 π2 sinπx  
where
kx,s = s1-x   for ​ 0sx , x1-s   for ​ x<s1 .  
Five terms of the Chebyshev series are sought, taking advantage of the centro-symmetry of the kx,s and even nature of gx about the mid-point of the range 0,1.
The approximate solution at the point x=0.1 is calculated by calling nag_sum_cheby_series (c06dcc).

10.1  Program Text

Program Text (d05aace.c)

10.2  Program Data

None.

10.3  Program Results

Program Results (d05aace.r)


nag_inteq_fredholm2_split (d05aac) (PDF version)
d05 Chapter Contents
d05 Chapter Introduction
NAG Library Manual

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