%
% Automatic translation of TaylorAi.mpl 
% which was written by RMC 2011, using
% CodeGeneration[Matlab] in Maple
% plus fixups GAMMA --> gamma
%             vectorized multiplications
%             added "end" to function
function TaylorAireturn = TaylorAi( z, N )
  Ai0 = ((3 ^ (0.1e1 / 0.3e1) / gamma(0.2e1 / 0.3e1)) / 0.3e1);
  Aip0 = (-(3 ^ (0.1e1 / 0.6e1)) * gamma(0.2e1 / 0.3e1) / pi / 0.2e1);
  z3 = (z .* z .* z);
  n = max( floor(N / 0.3e1 - 0.2e1 / 0.3e1), 0 );
  f1 = 1;
  f2 = 1;
  for k = n:-1:1
    f1 = (0.1e1 + z3 .* f1 / k / (3 * k - 1) / 0.3e1);
    f2 = (0.1e1 + z3 .* f2 / (3 * k + 1) / k / 0.3e1);
  end
  TaylorAireturn = Ai0 * f1 + Aip0 * z .* f2;
end
