function z = cosint(x)
%COSINT Cosine integral function.
%  COSINT(x) = Gamma + log(x) + int((cos(t)-1)/t,t,0,x)
%  where Gamma is Euler's constant, .57721566490153286060651209...
%  Euler's constant can be evaluated with vpa('eulergamma').
%
%   See also SININT.

%   Copyright (c) 1993-98 by The MathWorks, Inc.
%   $Revision: 1.6 $  $Date: 1998/06/05 21:36:03 $

if findstr(char(x),'Inf')
   z = sym(0);
   stat = 0;
else
   [z,stat] = maple('map','cosint',x);
end

if stat
   % Singularities
   z = x;
   for k = 1:prod(size(x))
      [z(k),stat] = maple('cosint',x(k));
      if stat
         z(k) = Inf;
      end
   end
end
