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_sum_invlaplace_weeks_eval (c06lc)

Purpose

nag_sum_invlaplace_weeks_eval (c06lc) evaluates an inverse Laplace transform at a given point, using the expansion coefficients computed by nag_sum_invlaplace_weeks (c06lb).

Syntax

[finv, ifail] = c06lc(t, sigma, b, acoef, errvec, 'm', m)
[finv, ifail] = nag_sum_invlaplace_weeks_eval(t, sigma, b, acoef, errvec, 'm', m)

Description

nag_sum_invlaplace_weeks_eval (c06lc) is designed to be used following a call to nag_sum_invlaplace_weeks (c06lb), which computes an inverse Laplace transform by representing it as a Laguerre expansion of the form:
m1
(t) = eσtaiebt / 2Li(bt),  σ > σO,  b > 0
i = 0
f~ (t) = eσt i=0 m-1 ai e -bt/2 Li (bt) ,   σ > σO ,   b > 0
where Li(x) Li(x)  is the Laguerre polynomial of degree ii.
This function simply evaluates the above expansion for a specified value of tt.
nag_sum_invlaplace_weeks_eval (c06lc) is derived from the function MODUL2 in Garbow et al. (1988)

References

Garbow B S, Giunta G, Lyness J N and Murli A (1988) Algorithm 662: A Fortran software package for the numerical inversion of the Laplace transform based on Weeks' method ACM Trans. Math. Software 14 171–176

Parameters

Compulsory Input Parameters

1:     t – double scalar
The value tt for which the inverse Laplace transform f(t)f(t) must be evaluated.
2:     sigma – double scalar
3:     b – double scalar
4:     acoef(m) – double array
5:     errvec(88) – double array
sigma, b, m, acoef and errvec must be unchanged from the previous call of nag_sum_invlaplace_weeks (c06lb).

Optional Input Parameters

1:     m – int64int32nag_int scalar
Default: The dimension of the array acoef.
sigma, b, m, acoef and errvec must be unchanged from the previous call of nag_sum_invlaplace_weeks (c06lb).

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     finv – double scalar
The approximation to the inverse Laplace transform at tt.
2:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

W ifail = 1ifail=1
The approximation to f(t) f(t)  is too large to be representable: finv is set to 0.00.0.
W ifail = 2ifail=2
The approximation to f(t) f(t)  is too small to be representable: finv is set to 0.00.0.

Accuracy

The error estimate returned by nag_sum_invlaplace_weeks (c06lb) in errvec(1) errvec1  has been found in practice to be a highly reliable bound on the pseudo-error |f(t)(t)| eσt | f (t) - f~ (t) | e-σt .

Further Comments

nag_sum_invlaplace_weeks_eval (c06lc) is primarily designed to evaluate (t) f~(t)  when t > 0 t>0 . When t0 t0 , the result approximates the analytic continuation of f(t) f(t) ; the approximation becomes progressively poorer as tt becomes more negative.

Example

function nag_sum_invlaplace_weeks_eval_example
sigma0 = 3;
sigma = 0;
b = 0;
epstol = 1e-05;
[sigmaOut, bOut, m, acoef, errvec, ifail] = ...
    nag_sum_invlaplace_weeks(@f, sigma0, sigma, b, epstol, 'mmax', int64(512));

fprintf('\nNo. of coefficients returned by nag_sum_invlaplace_weeks = %d\n\n', m);
fprintf('                   Computed           Exact       Pseudo\n');
fprintf('        t              f(t)            f(t)        error\n');
for j = 0:5
  [finv, ifail] = nag_sum_invlaplace_weeks_eval(j, sigmaOut, bOut, acoef, errvec);
  exact = sinh(3*j);
  pserr = abs(finv-exact)/exp(sigmaOut*j);
  fprintf(' %10.2f %15.4f %15.4f %12.1g\n',j, finv, exact, pserr);
end


function [f] = f(s)
% Evaluate the Laplace transform function.
f=3.0/(s^2-9.0);
if isreal(f)
    f=complex(f);
end
 

No. of coefficients returned by nag_sum_invlaplace_weeks = 64

                   Computed           Exact       Pseudo
        t              f(t)            f(t)        error
       0.00          0.0000          0.0000        2e-09
       1.00         10.0179         10.0179        2e-09
       2.00        201.7132        201.7132        1e-10
       3.00       4051.5420       4051.5419        1e-09
       4.00      81377.3949      81377.3957        3e-10
       5.00    1634508.5023    1634508.6862        2e-09

function c06lc_example
sigma0 = 3;
sigma = 0;
b = 0;
epstol = 1e-05;
[sigmaOut, bOut, m, acoef, errvec, ifail] = ...
    c06lb(@f, sigma0, sigma, b, epstol, 'mmax', int64(512));

fprintf('\nNo. of coefficients returned by c06lb = %d\n\n', m);
fprintf('                   Computed           Exact       Pseudo\n');
fprintf('        t              f(t)            f(t)        error\n');
for j = 0:5
  [finv, ifail] = c06lc(j, sigmaOut, bOut, acoef, errvec);
  exact = sinh(3*j);
  pserr = abs(finv-exact)/exp(sigmaOut*j);
  fprintf(' %10.2f %15.4f %15.4f %12.1g\n',j, finv, exact, pserr);
end


function [f] = f(s)
% Evaluate the Laplace transform function.
f=3.0/(s^2-9.0);
if isreal(f)
    f=complex(f);
end
 

No. of coefficients returned by c06lb = 64

                   Computed           Exact       Pseudo
        t              f(t)            f(t)        error
       0.00          0.0000          0.0000        2e-09
       1.00         10.0179         10.0179        2e-09
       2.00        201.7132        201.7132        1e-10
       3.00       4051.5420       4051.5419        1e-09
       4.00      81377.3949      81377.3957        3e-10
       5.00    1634508.5023    1634508.6862        2e-09


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–2013