function Result = Function15_01_Delta(u,lambda,PAR,EXO); 
% This function computes general Delta function
% with parameter lambda and age u

eta_0 = PAR.eta_0;
eta_1 = PAR.eta_1;
Dbar  = PAR.Dbar;

Result      = zeros(1,length(u));

if lambda == 0
    Result    =  (1 ./ (eta_0 - exp(eta_1 * u))) ...
    .* ( eta_0*(Dbar - u ) ...
    + (1/eta_1) *(exp(eta_1 * u) - exp(eta_1* Dbar) ));
    
else    
    Result    =  (exp(lambda * u) ./ (eta_0 - exp(eta_1 * u))) ...
    .* ( (eta_0/lambda)*(exp(-lambda * u) - exp(-lambda * Dbar) ) ...
    + (1/(eta_1-lambda)) *(exp((eta_1-lambda) * u) - exp((eta_1-lambda) * Dbar) ));

end
end

