NAG Library Function Document
nag_inteq_fredholm2_smooth (d05abc)
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
for the function
in the range
.
An approximation to the solution
is found in the form of an
term Chebyshev series
, where
indicates that the first term is halved in the sum. The coefficients
, for
, of this series are determined directly from approximate values
, for
, of the function
at the first
of a set of
Chebyshev points
The values
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 . However, advantage may be taken of any prior knowledge of the symmetry of . Thus if is symmetric (i.e., even) about the mid-point of the range , it may be approximated by an even Chebyshev series with . Similarly, if 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 .
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:
– doubleInput
-
On entry: the value of the parameter of the integral equation.
- 2:
– doubleInput
-
On entry: , the lower limit of integration.
- 3:
– doubleInput
-
On entry: , the upper limit of integration.
Constraint:
.
- 4:
– IntegerInput
-
On entry: the number of terms in the Chebyshev series which approximates the solution .
Constraint:
.
- 5:
– function, supplied by the userExternal Function
-
k must compute the value of the kernel
of the integral equation over the square
,
.
The specification of
k is:
double |
k (double x,
double s,
Nag_Comm *comm)
|
|
- 1:
– doubleInput
- 2:
– doubleInput
-
On entry: the values of and at which is to be calculated.
- 3:
– Nag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to
k.
- user – double *
- iuser – Integer *
- p – Pointer
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 2.3.1.1 in How to Use the NAG Library and its Documentation).
- 6:
– function, supplied by the userExternal Function
-
g must compute the value of the function
of the integral equation in the interval
.
The specification of
g is:
double |
g (double x,
Nag_Comm *comm)
|
|
- 1:
– doubleInput
-
On entry: the value of at which is to be calculated.
- 2:
– Nag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to
g.
- user – double *
- iuser – Integer *
- p – Pointer
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 2.3.1.1 in How to Use the NAG Library and its Documentation).
- 7:
– Nag_BooleanInput
-
On entry: indicates whether it is known that the solution
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:
– Nag_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:
– doubleOutput
-
On exit: the approximate values
, for
, of the function
at the first
n of
Chebyshev points (see
Section 3), where
|
if and . |
|
if and . |
|
if . |
- 10:
– doubleOutput
-
On exit: the coefficients
, for
, of the Chebyshev series approximation to
. 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:
– Nag_Comm *
-
The NAG communication argument (see
Section 2.3.1.1 in How to Use the NAG Library and its Documentation).
- 12:
– NagError *Input/Output
-
The NAG error argument (see
Section 2.7 in How to Use the NAG Library and its Documentation).
6 Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_EIGENVALUES
-
A failure has occurred due to proximity of an eigenvalue.
- NE_INT
-
On entry, .
Constraint: .
- 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 2.7.6 in How to Use the NAG Library and its Documentation for further information.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
- NE_REAL_2
-
On entry, and .
Constraint: .
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 , or |
(ii) |
by comparing the coefficients or the function values for two or more values of n. |
8 Parallelism and Performance
nag_inteq_fredholm2_smooth (d05abc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_inteq_fredholm2_smooth (d05abc) 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.
The time taken by nag_inteq_fredholm2_smooth (d05abc) depends upon the value of
n and upon the complexity of the kernel function
.
10 Example
This example solves Love's equation:
It will solve the slightly more general equation:
where
. The values
are used below.
It is evident from the symmetry of the given equation that
is an even function. Advantage is taken of this fact both in the application of nag_inteq_fredholm2_smooth (d05abc), to obtain the
and the
, and in subsequent applications of
nag_sum_cheby_series (c06dcc) to obtain
at selected points.
The program runs for and .
10.1 Program Text
Program Text (d05abce.c)
10.2 Program Data
None.
10.3 Program Results
Program Results (d05abce.r)