PDF version (NAG web site
, 64-bit version, 64-bit version)
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
Description
nag_inteq_fredholm2_smooth (d05ab) 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 .
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:
– function handle or string containing name of m-file
-
k must compute the value of the kernel
of the integral equation over the square
,
.
[result] = k(x, s)
Input Parameters
- 1:
– double scalar
- 2:
– double scalar
-
The values of and at which is to be calculated.
Output Parameters
- 1:
– double scalar
-
The value of the kernel
evaluated at
x and
s.
- 2:
– function handle or string containing name of m-file
-
g must compute the value of the function
of the integral equation in the interval
.
[result] = g(x)
Input Parameters
- 1:
– double scalar
-
The value of at which is to be calculated.
Output Parameters
- 1:
– double scalar
-
The value of
evaluated at
x.
- 3:
– double scalar
-
The value of the parameter of the integral equation.
- 4:
– double scalar
-
, the lower limit of integration.
- 5:
– double scalar
-
, the upper limit of integration.
Constraint:
.
- 6:
– logical scalar
-
Indicates whether it is known that the solution
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:
– 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:
– int64int32nag_int scalar
-
The number of terms in the Chebyshev series which approximates the solution .
Constraint:
.
Optional Input Parameters
None.
Output Parameters
- 1:
– double array
-
The approximate values
, for
, of the function
at the first
n of
Chebyshev points (see
Description), where
|
if and . |
|
if and . |
|
if . |
- 2:
– double array
-
The coefficients
, for
, of the Chebyshev series approximation to
. 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:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
-
-
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,
, the matrix reduces to a zero-valued number.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
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. |
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
.
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 (d05ab), to obtain the
and the
, and in subsequent applications of
nag_sum_chebyshev (c06dc) to obtain
at selected points.
The program runs for and .
Open in the MATLAB editor:
d05ab_example
function d05ab_example
fprintf('d05ab example results\n\n');
k = @(x, s) 1/(1+(x-s)*(x-s));
g = @(x) 1;
lambda = -0.3183;
a = -1;
b = 1;
odorev = true;
ev = true;
xval = [0:0.25:1];
ss = int64(2);
for n = 5:5:10;
in = int64(n);
[f, c, ifail] = d05ab(k, g, lambda, a, b, odorev, ev, in);
fprintf('\nResults for N = %2d\n\n', n);
fprintf('Solution and coefficients on first %2d Chebyshev points\n',n);
fprintf(' i x f(i) c(i)\n');
cheb(1:n,1) = cos(pi*(1:n)/(2*n-1));
fprintf('%3d%15.5f%15.5f%15.5e\n', [[1:n]' cheb f c]');
[chebr, ifail] = c06dc(xval, a, b, c, ss);
fprintf('\nSolution on evenly spaced grid\n');
fprintf(' x f(x)\n');
fprintf('%8.4f%15.5f\n',[xval' chebr]')
end
d05ab example results
Results for N = 5
Solution and coefficients on first 5 Chebyshev points
i x f(i) c(i)
1 0.93969 0.75572 1.41520e+00
2 0.76604 0.74534 4.93840e-02
3 0.50000 0.71729 -1.04758e-03
4 0.17365 0.68319 -2.32817e-04
5 -0.17365 0.66051 2.08903e-05
Solution on evenly spaced grid
x f(x)
0.0000 0.65742
0.2500 0.66383
0.5000 0.68319
0.7500 0.71489
1.0000 0.75572
Results for N = 10
Solution and coefficients on first 10 Chebyshev points
i x f(i) c(i)
1 0.98636 0.75572 1.41520e+00
2 0.94582 0.75336 4.93840e-02
3 0.87947 0.74639 -1.04751e-03
4 0.78914 0.73525 -2.32749e-04
5 0.67728 0.72081 1.99856e-05
6 0.54695 0.70452 9.86754e-07
7 0.40170 0.68825 -2.37956e-07
8 0.24549 0.67404 1.85810e-09
9 0.08258 0.66361 2.44829e-09
10 -0.08258 0.65812 -1.65268e-10
Solution on evenly spaced grid
x f(x)
0.0000 0.65742
0.2500 0.66384
0.5000 0.68319
0.7500 0.71489
1.0000 0.75572
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015