NAG FL Interface
d05aaf (fredholm2_​split)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

d05aaf solves a linear, nonsingular Fredholm equation of the second kind with a split kernel.

2 Specification

Fortran Interface
Subroutine d05aaf ( lambda, a, b, k1, k2, g, f, c, n, ind, w1, w2, wd, ldw1, ldw2, ifail)
Integer, Intent (In) :: n, ind, ldw1, ldw2
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), External :: k1, k2, g
Real (Kind=nag_wp), Intent (In) :: lambda, a, b
Real (Kind=nag_wp), Intent (Inout) :: w1(ldw1,ldw2), w2(ldw2,4)
Real (Kind=nag_wp), Intent (Out) :: f(n), c(n), wd(ldw2)
C Header Interface
#include <nag.h>
void  d05aaf_ (const double *lambda, const double *a, const double *b,
double (NAG_CALL *k1)(const double *x, const double *s),
double (NAG_CALL *k2)(const double *x, const double *s),
double (NAG_CALL *g)(const double *x),
double f[], double c[], const Integer *n, const Integer *ind, double w1[], double w2[], double wd[], const Integer *ldw1, const Integer *ldw2, Integer *ifail)
The routine may be called by the names d05aaf or nagf_inteq_fredholm2_split.

3 Description

d05aaf solves an integral equation of the form
f(x)-λabk(x,s)f(s)ds=g(x)  
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 f(x) is found in the form of an n term Chebyshev series i=1nciTi(x), 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 f(x) at the first n of a set of m+1 Chebyshev points:
xi=12(a+b+(b-a)cos[(i-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 k(x,s)=k(a+b-x,a+b-s), then the routine is designed to take advantage of this fact in the formation and solution of the algebraic equations. In this case, symmetry in the function g(x) implies symmetry in the function f(x). In particular, if g(x) is even about the mid-point of the range of integration, then so also is f(x), which may be approximated by an even Chebyshev series with m=2n-1. Similarly, if g(x) is odd about the mid-point then f(x) 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 Real (Kind=nag_wp) Input
On entry: the value of the parameter λ of the integral equation.
2: a Real (Kind=nag_wp) Input
On entry: a, the lower limit of integration.
3: b Real (Kind=nag_wp) Input
On entry: b, the upper limit of integration.
Constraint: b>a.
4: k1 real (Kind=nag_wp) Function, supplied by the user. External Procedure
k1 must evaluate the kernel k(x,s)=k1(x,s) of the integral equation for asx.
The specification of k1 is:
Fortran Interface
Function k1 ( x, s)
Real (Kind=nag_wp) :: k1
Real (Kind=nag_wp), Intent (In) :: x, s
C Header Interface
double  k1 (const double *x, const double *s)
1: x Real (Kind=nag_wp) Input
2: s Real (Kind=nag_wp) Input
On entry: the values of x and s at which k1(x,s) is to be evaluated.
k1 must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which d05aaf is called. Arguments denoted as Input must not be changed by this procedure.
Note: k1 should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by d05aaf. If your code inadvertently does return any NaNs or infinities, d05aaf is likely to produce unexpected results.
5: k2 real (Kind=nag_wp) Function, supplied by the user. External Procedure
k2 must evaluate the kernel k(x,s)=k2(x,s) of the integral equation for x<sb.
The specification of k2 is:
Fortran Interface
Function k2 ( x, s)
Real (Kind=nag_wp) :: k2
Real (Kind=nag_wp), Intent (In) :: x, s
C Header Interface
double  k2 (const double *x, const double *s)
1: x Real (Kind=nag_wp) Input
2: s Real (Kind=nag_wp) Input
On entry: the values of x and s at which k2(x,s) is to be evaluated.
k2 must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which d05aaf is called. Arguments denoted as Input must not be changed by this procedure.
Note: k2 should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by d05aaf. If your code inadvertently does return any NaNs or infinities, d05aaf is likely to produce unexpected results.
Note that the functions k1 and k2 must be defined, smooth and nonsingular for all x and s in the interval [a,b].
6: g real (Kind=nag_wp) Function, supplied by the user. External Procedure
g must evaluate the function g(x) for axb.
The specification of g is:
Fortran Interface
Function g ( x)
Real (Kind=nag_wp) :: g
Real (Kind=nag_wp), Intent (In) :: x
C Header Interface
double  g (const double *x)
1: x Real (Kind=nag_wp) Input
On entry: the values of x at which g(x) is to be evaluated.
g must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which d05aaf is called. Arguments denoted as Input must not be changed by this procedure.
Note: g should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by d05aaf. If your code inadvertently does return any NaNs or infinities, d05aaf is likely to produce unexpected results.
7: f(n) Real (Kind=nag_wp) array Output
On exit: the approximate values fi, for i=1,2,,n, of f(x) evaluated at the first n of m+1 Chebyshev points xi, (see Section 3).
If ind=0 or 3, m=n-1.
If ind=1, m=2×n.
If ind=2, m=2×n-1.
8: c(n) Real (Kind=nag_wp) array Output
On exit: the coefficients ci, for i=1,2,,n, of the Chebyshev series approximation to f(x).
If ind=1 this series contains polynomials of odd order only and if ind=2 the series contains even order polynomials only.
9: n Integer Input
On entry: the number of terms in the Chebyshev series required to approximate f(x).
Constraint: n1.
10: ind Integer Input
On entry: determines the forms of the kernel, k(x,s), and the function g(x).
ind=0
k(x,s) is not centro-symmetric (or no account is to be taken of centro-symmetry).
ind=1
k(x,s) is centro-symmetric and g(x) is odd.
ind=2
k(x,s) is centro-symmetric and g(x) is even.
ind=3
k(x,s) is centro-symmetric but g(x) is neither odd nor even.
Constraint: ind=0, 1, 2 or 3.
11: w1(ldw1,ldw2) Real (Kind=nag_wp) array Workspace
12: w2(ldw2,4) Real (Kind=nag_wp) array Workspace
13: wd(ldw2) Real (Kind=nag_wp) array Workspace
14: ldw1 Integer Input
On entry: the first dimension of the array w1 as declared in the (sub)program from which d05aaf is called.
Constraint: ldw1n.
15: ldw2 Integer Input
On entry: the second dimension of the array w1 and the first dimension of the array w2 and the dimension of the array wd as declared in the (sub)program from which d05aaf is called.
Constraint: ldw22×n+2.
16: ifail Integer Input/Output
On entry: ifail must be set to 0, -1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of -1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value -1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
On entry, a=value and b=value.
Constraint: b>a.
On entry, n=value.
Constraint: n1.
ifail=2
A failure has occurred due to proximity of 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=1, the matrix reduces to a zero-valued number.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

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

8 Parallelism and Performance

d05aaf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
d05aaf 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 routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments

The time taken by d05aaf increases with n.
This routine may be used to solve an equation with a continuous kernel by defining k1 and k2 to be identical.
This routine 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
f(x) - 01 k(x,s) f(s) ds = (1- 1 π2 ) sin(πx)  
where
k(x,s) = { s(1-x)   for ​ 0sx , x(1-s)   for ​ x<s1 .  
Five terms of the Chebyshev series are sought, taking advantage of the centro-symmetry of the k(x,s) and even nature of g(x) about the mid-point of the range [0,1].
The approximate solution at the point x=0.1 is calculated by calling c06dcf.

10.1 Program Text

Program Text (d05aafe.f90)

10.2 Program Data

None.

10.3 Program Results

Program Results (d05aafe.r)