hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_inteq_fredholm2_split (d05aa)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

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

Syntax

[f, c, ifail] = d05aa(lambda, a, b, k1, k2, g, n, ind)
[f, c, ifail] = nag_inteq_fredholm2_split(lambda, a, b, k1, k2, g, n, ind)

Description

nag_inteq_fredholm2_split (d05aa) 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.

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:     lambda – double scalar
The value of the parameter λ of the integral equation.
2:     a – double scalar
a, the lower limit of integration.
3:     b – double scalar
b, the upper limit of integration.
Constraint: b>a.
4:     k1 – function handle or string containing name of m-file
k1 must evaluate the kernel kx,s=k1x,s of the integral equation for asx.
[result] = k1(x, s)

Input Parameters

1:     x – double scalar
2:     s – double scalar
The values of x and s at which k1x,s is to be evaluated.

Output Parameters

1:     result – double scalar
The value of the kernel kx,s=k1x,s evaluated at x and s.
5:     k2 – function handle or string containing name of m-file
k2 must evaluate the kernel kx,s=k2x,s of the integral equation for x<sb.
[result] = k2(x, s)

Input Parameters

1:     x – double scalar
2:     s – double scalar
The values of x and s at which k2x,s is to be evaluated.

Output Parameters

1:     result – double scalar
The value of the kernel kx,s=k2x,s evaluated at x and s.
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 – function handle or string containing name of m-file
g must evaluate the function gx for axb.
[result] = g(x)

Input Parameters

1:     x – double scalar
The values of x at which gx is to be evaluated.

Output Parameters

1:     result – double scalar
The value of gx evaluated at x.
7:     n int64int32nag_int scalar
The number of terms in the Chebyshev series required to approximate fx.
Constraint: n1.
8:     ind int64int32nag_int scalar
Determines the forms of the kernel, kx,s, and the function gx.
ind=0
kx,s is not centro-symmetric (or no account is to be taken of centro-symmetry).
ind=1
kx,s is centro-symmetric and gx is odd.
ind=2
kx,s is centro-symmetric and gx is even.
ind=3
kx,s is centro-symmetric but gx is neither odd nor even.
Constraint: ind=0, 1, 2 or 3.

Optional Input Parameters

None.

Output Parameters

1:     fn – double array
The approximate values fi, for i=1,2,,n, of fx evaluated at the first n of m+1 Chebyshev points xi, (see Description).
If ind=0 or 3, m=n-1.
If ind=1, m=2×n.
If ind=2, m=2×n-1.
2:     cn – double array
The coefficients ci, for i=1,2,,n, of the Chebyshev series approximation to fx.
If ind=1 this series contains polynomials of odd order only and if ind=2 the series contains even order polynomials only.
3:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
On entry,ab or n<1.
   ifail=2
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, m=1, the matrix reduces to a zero-valued number.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

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.

Further Comments

The time taken by nag_inteq_fredholm2_split (d05aa) 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.

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_chebyshev (c06dc).
function d05aa_example


fprintf('d05aa example results\n\n');

lambda = 1;
a = 0;
b = 1;
g = @(x) sin(pi*x)*(1-1/(pi*pi));
k1 = @(x, s) s*(1-x);
k2 = @(x, s) x*(1-s);
n = int64(5);
ind = int64(2);
[f, c, ifail] = d05aa(lambda, a, b, k1, k2, g, n, ind);

xval = 0.1;

% evaluate Chebyshev series at xval
s = int64(2);
[res, ifail] = c06dc(xval, a, b, c, s);
fprintf('Kernel is centro-symmetric and G is even so the solution is even\n')
fprintf('\nChebyshev coefficients:\n');
fprintf('%14.4f',c);
fprintf('\n\n x = %5.2f    Ans = %7.4f\n',xval,res);


d05aa example results

Kernel is centro-symmetric and G is even so the solution is even

Chebyshev coefficients:
        0.9440       -0.4994        0.0280       -0.0006        0.0000

 x =  0.10    Ans =  0.3090

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

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