function ar = isenAAs(Ma,k)
% isenAAs  Area ratio A/Astar for isentropic compressible flow
%
% Synopsis:  ar = isenAAs(Ma)
%            ar = isenAAs(Ma,k)
%
% Input:  Ma = Mach number
%         k  = (optional) specific heat ratio;  Default:  k = 1.4
%
% Output: ar = A/Astar, area ratio for isentropic compressible flow

if nargin<2,  k = 1.4;  end   %  default material is air

tol = 5e-6;
i = find(Ma<5e-6);
if isempty(i)        %  no small Ma values
   ar = (1./Ma).*((1 + 0.5*(k-1)*Ma.^2)/(1 + 0.5*(k-1))).^(0.5*(k+1)/(k-1));
else
   ar = zeros(size(Ma));
   j = find(Ma>5e-6);
   ar(j) = isenAAs(Ma(j),k);    %  recursive call for those Ma > tol
   ar(i) = Inf;                 %  separate assignment for Ma < tol
end

