function [f, est] = weekse(F, t, N, sig, b)

%  The function f = weekse(F,t,N,sig,b) computes the inverse Laplace
%  transform f(t) of the transform F(s) by the method of Weeks.

%  Input:
%  F -- symbolic function of s.
%  t -- ordinate(s) where f(t) are to be computed (scalar or vector).
%  N -- number of terms in the Laguerre expansion.
%  sig, b -- free parameters in Weeks method.  b > 0, sig > sig_0.
%  Note: sig, b may be estimated by wpar1.m and wpar2.m.

%  Output:
%  f   -- function values at t.
%  est -- estimate for the absolute error at t.

%  Example of usage: >>F = '1./sqrt(s.^2+1)'; t = [0 1 2]; 
%                    >>[f, est] = weekse(F, t, 16, 1, 1)

M   = 2*N;                                                   
a   = real(wcoef(F,M,sig,b));             % Compute the coefficients.
a1  = a(2*N+1:3*N); sa1 = sum(abs(a1));   % Compute sum of |a_n|, n=0..N-1.
a2  = a(3*N+1:4*N); sa2 = sum(abs(a2));   % Compute sum of |a_n|, n=N..2*N-1.
t   = t(:);                               % Make sure t is a column vector.
L   = laguer(a1,2*b*t);                   % Evaluate the Laguerre series. 
f   = L.*exp((sig-b)*t);                  % Evaluate Weeks expansion.
est = exp(sig*t)*(sa2+eps*sa1);           % Compute error estimate.




