#===============================================================================
#                          Program TRANS
#===============================================================================
#
#             A Maple package for transforming sequences, series
#                                and functions
#
#
#    Copyright (C) 1990 by J. Grotendorst, all rights reserved.
#
#    Error reports please to: J. Grotendorst
#                             Zentralinstitut fuer Angewandte Mathematik
#                             Forschungszentrum Juelich GmbH
#                             D-5170 Juelich
#                             Federal Republic of Germany
#                  Internet:  j.grotendorst@kfa-juelich.de
#                  Bitnet:    zdv071@djukfa11
#
#
#        modifications: 24 July 90: - generation of FORTRAN functions
#                                     with parameters
#                        8 Aug  90: - numerical evaluation of Maple
#                                     constants (Pi, E, ...) when
#                                     generating a FORTRAN function
#                                   - check the type `+` of the generalized
#                                     series
#                          Mar  91  - neccesary changes to use the
#                                     fortran function in MapleV
#                                   - rename and restructure of procedures
#                                     tay (now ratser) and asy (now ratgen)
#                                   - ratser applies to expansions with
#                                     data type series
#                                   - ratgen applies to generalized expansions
#                                     with data type `+`, e.g. asymptotic
#                                     expansions
#                          Oct 91   - changes due to the Maple package concept
#                          Sep 92   - special versions of the transformation
#                                     algorithms for use with evalhf
#
#===============================================================================
#  MapleV is assumed
#===============================================================================
#
trans := 
table ([ratser    = proc () `trans/ratser` (args) end,
        ratgen    = proc () `trans/ratgen` (args) end,
        aitken    = proc () `trans/aitken` (args) end,
        eps       = proc () `trans/eps` (args) end,
        gb        = proc () `trans/gb` (args) end,
        lev       = proc (s_n, a_n, n, arr1, arr2, typ) local typ1;
                    if typ = 'u' then
                       typ1 := 1
                    elif typ = 't' then
                       typ1 := 2
                    elif typ = 'd' then
                       typ1 := 3
                    elif typ = 'v' then
                       typ1 := 4 
                    fi;
                    `trans/lev` (s_n, a_n, n, arr1, arr2, typ1)
                    end,
        rho       = proc () `trans/rho` (args) end,
        rhoit     = proc () `trans/rhoit` (args) end,
        rich      = proc () `trans/rich` (args) end,
        sidi      = proc (s_n, a_n, n, arr1, arr2, typ) local typ1;
                    if typ = 'u' then
                       typ1 := 1
                    elif typ = 't' then
                       typ1 := 2
                    elif typ = 'd' then
                       typ1 := 3
                    elif typ = 'v' then
                       typ1 := 4 
                    fi;
                    `trans/sidi` (s_n, a_n, n, arr1, arr2, typ1)
                    end,
        theta     = proc () `trans/theta` (args) end,
        thetait   = proc () `trans/thetait`  (args) end,
        aitkenhf  = proc (s_n, n, arr1) evalhf (`trans/aitken`
                         (s_n, n, var(arr1))) end,
        epshf     = proc (s_n, n, arr1) evalhf (`trans/eps`
                         (s_n, n, var(arr1))) end,
        gbhf      = proc (s_n, a_n, n, arr1, arr2) evalhf (`trans/gb`
                         (s_n, a_n, n, var(arr1), var(arr2))) end, 
        levhf     = proc (s_n, a_n, n, arr1, arr2, typ) local typ1;
                    if typ = 'u' then
                       typ1 := 1
                    elif typ = 't' then
                       typ1 := 2
                    elif typ = 'd' then
                       typ1 := 3
                    elif typ = 'v' then
                       typ1 := 4 
                    fi;
                    evalhf (`trans/lev` (s_n, a_n, n, var(arr1), var(arr2), typ1))
                    end,
        rhohf     = proc (s_n, x_n, n, arr1, arr2) evalhf (`trans/rho`
                         (s_n, x_n, n, var(arr1), var(arr2))) end, 
        rhoithf   = proc (s_n, x_n, n, arr1, arr2) evalhf (`trans/rhoit`
                         (s_n, x_n, n, var(arr1), var(arr2))) end, 
        richhf    = proc (s_n, x_n, n, arr1, arr2) evalhf (`trans/rich`
                         (s_n, x_n, n, var(arr1), var(arr2))) end,
        sidihf    = proc (s_n, a_n, n, arr1, arr2, typ) local typ1;
                    if typ = 'u' then
                       typ1 := 1
                    elif typ = 't' then
                       typ1 := 2
                    elif typ = 'd' then
                       typ1 := 3
                    elif typ = 'v' then
                       typ1 := 4 
                    fi;
                    evalhf (`trans/sidi` (s_n, a_n, n, var(arr1), var(arr2), typ1))
                    end,
        thetahf   = proc (s_n, n, arr1, arr2) evalhf (`trans/theta`
                         (s_n, n, var(arr1), var(arr2))) end,
        thetaithf = proc (s_n, n, arr1) evalhf (`trans/thetait`
                         (s_n, n, var(arr1))) end
        ]): 
`trans/ratser` := proc (s)
#*******************************************************************************
#
#  procedure:   ratser
#
#  Description:
#
#  ratser transforms series expansions with data type "series" via
#  well-known linear as well as nonlinear sequence (series) transformations.
#  Generation of optimized FORTRAN code (functions) is supported.
#
#  Input parameters :
#
#  obligatory:
#
#  s           : series expansion of data type "series"
#
#  optional:
#
#  <typ>       : type of transformation: u, t, d, v, sh, gb, rh, r, at,
#                rhit, th, thit, su, st, sd, sv;
#                in case of Richardson extrapolation (r) or
#                rho transformation (rh) or
#                iterated rho_2 transformation (rhit)
#                a list of auxiliary parameters x_n can be specified.
#                (Default : x_n = 1/(n+1) for Richardson extrapolation
#                and x_n = n+1 for rho and rho_2 transformation).
#                Then the first element of the list characterizes
#                the type of transformation, i.e. it must be equal to
#                r, rh or rhit (Default: u)
#  <norder>    : order of transformation  (Default: number of terms of the
#                                          series expansion)
#  <expts>     : list of real expansion points for the rational approximations
#                                         (Default: [ ] )
#  <switch>    : switch for generation of a FORTRAN function: fort or nofort
#                                         (Default: nofort)
#  <precision> : type of the FORTRAN function: single or double
#                                         (Default : single)
#  <evalorder> : computational scheme: horner or confrac (Default : horner)
#
#  <fn>        : filename for the FORTRAN function (Default: `` =  terminal)
#
#*******************************************************************************
#
local norder ,typ, i, floats, x, s1, ndim1, ndim, app, resnum, resden,
      x0, x1, x2, expts, resarb, nexp, a, na, fn, exp1, expn, expk1,
      expk2, j, k, head, head1, head2, ndig, exp1m, exp1e, expnm, expne,
      expk1m, expk1e, expk2m, expk2e, echar, switch, evalorder, boolist, nd1,
      nlist, laux, typ1, indarg, indarg1, l, lcoeden,
      degnum, degden, appnum, appden, y, tra, old_precision;
global precision;
#
#  initializations
#
expts     := [ ];
laux      := [ ];
norder    := 0;
typ       := 'u'; 
fn        := ``;
switch    := 'nofort';
evalorder := ``;
ndig      := 10;
echar     := `.E`;
a         := array ('sparse', 1 .. 8, []);
if assigned (precision) then
  old_precision := precision
else
  old_precision := 'precision'
fi;
precision := 'single';
#
#  check the input parameters
#
if not type (s, series) then
   ERROR (`expecting a series expansion of data type "series"`,
          `try ratgen() for generalized series with dataype ``+`` `)
elif nargs < 1 or 8 < nargs then
   ERROR (`wrong number of arguments`)
elif nargs > 1 then
   for i from 2 to nargs do
      if (args [ i ] = 'u') or (args [ i ]  = 't')
         or (args [ i ] = 'v') or (args [ i ] = 'd')
         or (args [ i ] = 'su') or (args [ i ] = 'st')
         or (args [ i ] = 'sd') or (args [ i ] = 'sv')
         or (args [ i ] = 'sh')
         or (args [ i ] = 'gb') or (args [ i ] = 'rh')
         or (args [ i ] = 'r') or (args [ i ] = 'at')
         or (args [ i ] = 'rhit') or (args [ i ] = 'th')
         or (args [ i ] = 'thit')
         and type (args [ i ], name) then
         if a[3] = 0 then
            a[1] := 1;
         fi;
         typ  := args [ i ];
      elif type (args [ i ], integer) and args [ i ] > 0 then
         a[2] := 1;
         norder := args [ i ];
      elif type (args [ i ], list) then
         nlist := nops (args [ i ]);
         if nlist > 0 then
            typ1 := op (1, args [ i ]);
            if typ1 = 'r' or typ1 = 'rh' or typ1 = 'rhit' then
               typ  := op (1, args [ i ]);
               if a[1] = 0 then
                  a[3] := 1;
               fi;
               laux := [seq(op (j, args [ i ]), j = 2 .. nlist)];
            else
               a[4]    := 1;
               boolist := map (type, args [ i ], realcons);
               x  := op (0, s);
               x1 := op (1, x);
               x2 := solve (x, x1);
               if type (x2, realcons) then
                  ERROR (`expansion point of the series must be indeterminate`)
               elif has (boolist, false) then
                  ERROR (`expansion points have to be of type real constant`)
               fi;
               expts := args [ i ];
            fi;
         fi;
      elif (args [ i ] = 'fort') or (args [ i ] = 'nofort')
         and type (args [ i ], name) then
         a[5]   := 1;
         switch := args [ i ];
      elif (args [ i ] = 'single') or (args [ i ] = 'double')
         and type (args [ i ], name) then
         a[6]      := 1;
         precision := args [ i ];
         if (precision = 'double') then
            ndig      := 20;
            echar     := `.D`;
         fi;
      elif (args [ i ] = `horner`) or (args [ i ] = `confrac`)
         and type (args [ i ], name) then
         a[7]      := 1;
         evalorder := args [ i ];
      elif type (args [ i ], name) then
         a[8] := 1;
         fn   := args [ i ];
      else
         ERROR (`invalid argument found`)
      fi;
   od;
#
#  check the number of input arguments
#
   na := sum (a ['i'], 'i' = 1 .. 8) + 1;
#
   if na <> nargs then
      ERROR (`invalid argument found`)
   fi;
fi;
#
# end of input check
#
# eliminate the order symbol
#
s1 := subs (O(1) = 0, s);
#
# determination of the expansion point
#
x := op (0, s1);
#
# check whether the series contains coefficients with data type "float"
#
if hastype (s1, float) or type (x, float) then
   x0 := x;
   x  := map (convert, x, rational);
   s1 := subs (x0 = x, s1);
   s1 := map (convert, s1, rational);
   floats := true;
else
   floats := false;
fi;
#
# determination of the independent variable
#
x1 := op (1, x);
x2 := solve (x, x1);
#
# determination of the series order
#
ndim1 := nops (s1) / 2 - 1;
#
if norder = 0 then
   ndim := ndim1;
else
   if norder <= ndim1 then
      ndim := norder
   else
      ERROR (`series order too small for specified transformation order`)
   fi;
fi;
#
# check the transformation order and parameters
#
if typ = 'gb' and ndim < ndim1 then
   nd1 := ndim + 1
else
   nd1 := ndim
fi;
#
if typ = 'rh' or typ = 'rhit' or typ = 'r' then
   if nops (laux) = 0 then
      if typ = 'rh' or typ = 'rhit' then
         laux := [seq (k + 1, k = 0 .. nd1)]
      elif typ = 'r' then
         laux := [seq (1 / (k + 1), k = 0 .. nd1)]
      fi
   elif nops (laux) > 0 and nops (laux) <= nd1 then
      if typ = 'rh' then
         ERROR (`too few parameters for the rho transformation`)
      elif typ = 'rhit' then
         ERROR (`too few parameters for the iterated rho_2 transformation`)
      elif typ = 'r' then
         ERROR (`too few parameters for the Richardson exptrapolation`)
      fi
   fi
fi;
#
# perform the specific series transformation
#
app := frontend (`trans/series_transform`, [s1, y, ndim, typ, laux],
                 [{`+`, `*`, list, series},{}]);
#
# normalization of the rational approximation
#
appnum  := expand (numer (app));
appden  := expand (denom (app));
degnum  := degree (appnum, y);
degden  := degree (appden, y);
lcoeden := tcoeff (appden, y);
#
if type (lcoeden, numeric) then
   resnum  := series (appnum / lcoeden, y, degnum + 1);
   resden  := series (appden / lcoeden, y, degden + 1)
else
   resnum  := series (appnum, y, degnum + 1);
   resden  := series (appden, y, degden + 1)
fi;
#
# indeterminants for the output expression
#
nexp := nops (expts);
if type (x2, name) and nexp > 0 then
   indarg  := indets (app, string) minus {constants, y, x2}
else
   indarg  := indets (app, string) minus {constants, y}
fi;
#
indarg1 := [x1, seq (l, l = indarg minus {x1})];
#
resnum := convert (subs (op (0, resnum) = x, resnum), polynom);
resden := convert (subs (op (0, resden) = x, resden), polynom);
#
if evalorder = `horner` then
   resnum  := convert (resnum, horner, indarg1);
   resden  := convert (resden, horner, indarg1);
   resarb  := resnum / resden
elif evalorder = `confrac` then
   resarb  := convert (resnum / resden, confrac, x1)
else
   resarb  := resnum / resden
fi;
#
# return the result
#
if switch = 'nofort' then
#
#  check whether the result contains a floating point number
#
   if floats then
      resarb := evalf (resarb)
   fi;
#  return a sequence of approximations
#
   if nexp > 0 then
      resarb := seq (subs (x2 = expts [ k ], resarb), k = 1 .. nexp)
   fi;
#
#  insert the actual arguments as table index and the result as
#  table value into the remember table
#
   `trans/ratser` (args) := resarb;
#
   precision := old_precision;
#
   RETURN (resarb)
else
#
#  determination of the fortran function header
#
   `trans/fortran_header` (typ, indarg1, precision, 'head', 'tra');
   head1 := head [1];
   head2 := head [2];
#
#  write the fortran function
#
   if nexp = 1 then
      if (fn <> ``) then writeto(fn) fi;
      lprint(`      `.head1);
      lprint(`      `.head2);
      `trans/my_fort`([tra = evalf (subs (x2 = expts [ 1 ], resarb), ndig)]);
      lprint(`      end`);
      if (fn <> ``) then writeto('terminal') fi;
   elif nexp > 1 then
      exp1  := evalf (expts [ 1 ] + (expts [ 2 ] -
               expts [ 1 ]) / 2, 3);
      expn  := evalf (expts [ nexp - 1 ] + (expts [ nexp ] -\
               expts [ nexp - 1 ]) / 2, 3);
      exp1m := op (1, exp1);
      expnm := op (1, expn);
#
      if exp1 = 0 then
         exp1e := 0
      else
         exp1e := op (2, exp1)
      fi;
#
      if expn = 0 then
         expne := 0
      else
         expne := op (2, expn)
      fi;
#
      if nexp = 2 then
         if (fn <> ``) then writeto(fn) fi;
         lprint(`      `.head1);
         lprint(`      `.head2);
         lprint(`      if (`.x1.` .le. `.exp1m.echar.exp1e.`) then `);
         `trans/my_fort`([tra = evalf (subs (x2 = expts [ 1 ], resarb), ndig)]);
         lprint(`      elseif (`.x1.` .gt. `.expnm.echar.expne.`) then `);
         `trans/my_fort`([tra = evalf (subs (x2 = expts [ nexp ], resarb),
                          ndig)]);
         lprint(`      end if`);
         lprint(`      end`);
         if (fn <> ``) then writeto('terminal') fi;
      elif nexp > 2 then
         if (fn <> ``) then writeto(fn) fi;
         lprint(`      `.head1);
         lprint(`      `.head2);
         lprint(`      if (`.x1.` .le. `.exp1m.echar.exp1e.`) then `);
         `trans/my_fort`([tra = evalf (subs (x2 = expts [ 1 ], resarb), ndig)]);
         for k from 2 to (nexp - 1) do
            expk1  := evalf (expts [ k - 1 ] + (expts [ k ] -\
                      expts [ k - 1 ]) / 2, 3):
            expk2  := evalf (expts [ k ] + (expts [ k + 1 ] -\
                      expts [ k ]) / 2, 3):
            expk1m := op (1, expk1):
            expk2m := op (1, expk2):
#
            if expk1 = 0 then
               expk1e := 0
            else
               expk1e := op (2, expk1)
            fi:
#
            if expk2 = 0 then
               expk2e := 0
            else
               expk2e := op (2, expk2)
            fi:
#
            lprint(`      elseif (`.x1.` .gt. `.expk1m.echar.
            expk1e.` .and. `.x1.` .le. `.expk2m.echar.expk2e.`) then`);
            `trans/my_fort`([tra = evalf (subs (x2 = expts [ k ], resarb),
                           ndig)])
         od;
         lprint(`      elseif (`.x1.` .gt. `.expnm.echar. expne.`) then `);
         `trans/my_fort`([tra = evalf (subs (x2 = expts [ nexp ], resarb),
                 ndig)]);
         lprint(`      end if`);
         lprint(`      end`);
         if (fn <> ``) then writeto('terminal') fi;
      fi
   else
      if (fn <> ``) then writeto(fn) fi;
      lprint(`      `.head1);
      lprint(`      `.head2);
      `trans/my_fort`([tra = evalf (resarb, ndig)]);
      lprint(`      end`);
      if (fn <> ``) then writeto('terminal') fi
   fi;
#
   precision := old_precision;
#
   RETURN ()
fi
end:
`trans/fortran_header` := proc (typ, parlist, prec, head12, nam)
#******************************************************************************
#
#  description:
#
#  This procedure evaluates the FORTRAN function header
#
#  input parameters:
#
#  typ     : type of transformation
#  parlist : list with the formal parameters for the fortran function
#  prec    : precision type of the fortran function
#  head12  : line 1 and 2 of the fortran function
#  nam     : name of the fortran function
#
#******************************************************************************
#
local parg, j, nam1, namtr;
global precision;
#
# function name
#
namtr :='tr';
nam1  := typ.namtr;
#
parg   := ``;
for j from 1 to nops (parlist)
do
   b.j := op (j, parlist);
   if j = nops (parlist) then
      parg := cat (parg, b.j)
   else
      parg := cat (parg, b.j, `, `)
   fi;
od;
#
head12 [1] := `function `.nam1.` (`.parg.`)`;
#
# declaration for the parameters
#
if prec = 'single' then
   head12 [2] := `real `.nam1.`, `.parg
elif prec = 'double' then
   head12 [2] := `double precision `.nam1.`, `.parg
fi;
#
nam := nam1;
#
end:
`trans/series_transform` := proc (s, ep, nterm, typ, param)
#******************************************************************************
#
# description:
#
# This procedure performs the sequence transformation by calling
# the specific transformation procedure seccessively.
#
# input parameters:
#
# s    :  series expansion of type "series" or `+`
# ep   :  variable for "x - x0"
# nterm:  number of series terms
# type :  type of transformation
# param:  list with parameters for the rho, rhoit or r transformation
#
#******************************************************************************
#
local s_n, a_n, x_n, n, arr, xarr, ratapp;
global precision;
#
# initialization of the first partial sum
#
s_n := 0;
#
#  loop over the sequence of partial sums
#
for n from 0 to nterm do
   if type (s, series) then
      a_n := op (2 * n + 1, s) * ep ** op (2 * n + 2, s)
   elif type (s, `+`) then
      a_n := op (n + 1, s)
   else
      ERROR (`series type is wrong`)
   fi;
#
   s_n := s_n + a_n;
#
#  call the algorithm to perform the specified transformation
#
   if typ = 'rh' then
      x_n := op (n + 1, param);
      ratapp  := `trans/rho_sym` (s_n, x_n, n, arr, xarr)
   elif typ = 'sh' then
      ratapp  := `trans/eps_sym` (s_n, n, arr)
   elif typ = 'u' or typ = 't' or typ = 'd' or typ = 'v' then
      ratapp  := `trans/lev_sym` (s_n, a_n, n, arr, xarr, typ)
   elif typ = 'su' or typ = 'st' or typ = 'sd' or typ = 'sv' then
      ratapp  := `trans/sidi_sym` (s_n, a_n, n, arr, xarr, typ)
   elif typ = 'r' then
      x_n := op (n + 1, param);
      ratapp  := `trans/rich_sym` (s_n, x_n, n, arr, xarr)
   elif typ = 'gb' then
      ratapp := `trans/gb_sym` (s_n, a_n, n, arr, xarr)
   elif typ = 'at' then
      ratapp  := `trans/aitken_sym` (s_n, n, arr)
   elif typ = 'rhit' then
      x_n := op (n + 1, param);
      ratapp  := `trans/rhoit_sym` (s_n, x_n, n, arr, xarr)
   elif typ = 'th' then
      ratapp  := `trans/theta_sym` (s_n, n, arr, xarr)
   elif typ = 'thit' then
      ratapp  := `trans/thetait_sym` (s_n, n, arr)
   fi;
od;
#
RETURN (ratapp);
end:
`trans/ratgen` := proc (s)
#*******************************************************************************
#
#  procedure:   ratgen
#
#  Description:
#
#  ratgen transforms generalized series expansions, e.g. asymptotic
#  expansions, with data type `+` via well-known linear as well as
#  nonlinear sequence (series) transformations. Generation of
#  optimized FORTRAN code (functions) is supported.
#
#  Input parameters :
#
#  obligatory:
#
#  s           : generalized series of dataype `+`
#
#  optional:
#
#  <typ>       : type of transformation: u, t, d, v, sh, gb, rh, r, at,
#                rhit, th ,thit, su, st, sd, sv;
#                in case of Richardson extrapolation (r) or
#                rho transformation (rh) or
#                iterated rho_2 transformation (rhit)
#                a list of auxiliary parameters x_n can be specified.
#                (Default : x_n = 1/(n+1) for Richardson extrapolation
#                and x_n = n+1 for rho and rho_2 transformation).
#                Then the first element of the list characterizes
#                the type of transformation, i.e. it must be equal to
#                r, rh or rhit (Default: u)
#  <norder>    : order of transformation  (Default: number of terms of the
#                                         generalized series)
#  <switch>    : switch for generation of a FORTRAN function: fort or nofort
#                                         (Default: nofort)
#  <precision> : type of the FORTRAN function: single or double
#                                         (Default: single)
#  <evalorder> : computational scheme: horner (Default: ``)
#
#  <fn>        : filename for FORTRAN function (Default: `` = terminal)
#
#*******************************************************************************
#
local s1, norder ,typ, typ1, i, j, k, floats, ndim1, ndim, app, resnum, resden,
      resarb, a, na, fn, ndig, switch, evalorder, lterm, nd1, nlist, laux,
      indarg, y, head, head1, head2, tra, old_precision;
global precision;
#
# initializations
#
laux      := [ ];
norder    := 0;
typ       := 'u';
fn        := ``;
switch    := 'nofort';
evalorder := ``;
ndig      := 10;
a         := array ('sparse', 1 .. 7, []);
if assigned (precision) then
  old_precision := precision
else
  old_precision := 'precision'
fi;
precision := 'single';
#
#  check the number of the arguments and the type `+` (sum-of-products form)
#  of the generalized series
#
if not type (s, `+`) then
   ERROR (`expecting a series expansion of data type ``+`` `,
          `try ratser() for series expansions of data type series`)
elif nargs < 1 or 7 < nargs then
   ERROR (`wrong number of arguments`)
fi;
#
# eliminate the order symbol
#
lterm := op (nops(s),s);
if type(lterm, function) then
   if op(0, lterm) = O then
      s1 := subs (lterm = 0, s)
   fi;
else
   s1 := s
fi;
#
# check the other input parameters
#
if nargs > 1 then
   for i from 2 to nargs do
      if (args [ i ] = 'u') or (args [ i ]  = 't')
         or (args [ i ] = 'd') or (args [ i ] = 'v')
         or (args [ i ] = 'su') or (args [ i ] = 'st')
         or (args [ i ] = 'sd') or (args [ i ] = 'sv')
         or (args [ i ] = 'sh')
         or (args [ i ] = 'gb') or (args [ i ] = 'rh')
         or (args [ i ] = 'r') or (args [ i ] = 'at')
         or (args [ i ] = 'rhit') or (args [ i ] = 'th')
         or (args [ i ] = 'thit')
         and type (args [ i ], name) then
         if a[3] = 0 then
            a[1] := 1;
         fi;
         typ  := args [ i ];
      elif type (args [ i ], integer) and args [ i ] > 0 then
         a[2] := 1;
         norder := args [ i ];
      elif type (args [ i ], list) then
         nlist := nops (args [ i ]);
         if nlist > 0 then
            typ1 := op (1, args [ i ]);
            if typ1 = 'r' or typ1 = 'rh' or typ1 = 'rhit' then
               typ  := op (1, args [ i ]);
               if a[1] = 0 then
                  a[3] := 1;
               fi;
               laux := [seq (op (j, args [ i ]), j = 2 .. nlist)];
            fi;
         fi;
      elif (args [ i ] = 'fort') or (args [ i ] = 'nofort')
         and type (args [ i ], name) then
         a[4]   := 1;
         switch := args [ i ];
      elif (args [ i ] = 'single') or (args [ i ] = 'double')
         and type (args [ i ], name) then
         a[5]   := 1;
         precision := args [ i ];
         if (precision = 'double') then
            ndig      := 20;
         fi;
      elif (args [ i ] = `horner`)
         and type (args [ i ], name) then
         a[6]        := 1;
         evalorder   := args [ i ];
      elif type (args [ i ], name) then
         a[7] := 1;
         fn   := args [ i ];
      else
         ERROR (`invalid argument found`)
      fi;
   od;
#
   na := sum (a ['i'] ,'i' = 1 .. 7) + 1;
#
#  check the number of input parameters
#
   if na <> nargs then
      ERROR (`invalid argument found`)
   fi;
fi;
#
# check whether the series contains coefficients with data type float
#
if hastype (s1, float) then
   s1     := map (convert, s1, rational);
   floats := true;
else
   floats := false;
fi;
#
ndim1 := nops (s1) - 1;
#
if norder = 0 then
   ndim := ndim1;
else
   if norder <= ndim1 then
      ndim := norder;
   else
      ERROR (`series order too small for specified transformation order`)
   fi;
fi;
#
# check the transformation order and parameters
#
if typ = 'gb' and ndim < ndim1 then
   nd1 := ndim + 1
else
   nd1 := ndim
fi;
#
if typ = 'rh' or typ = 'rhit' or typ = 'r' then
   if nops (laux) = 0 then
      if typ = 'rh' or typ = 'rhit' then
         laux := [seq (k + 1, k = 0 .. nd1)]
      elif typ = 'r' then
         laux := [seq (1 / (k + 1), k = 0 .. nd1)]
      fi
   elif nops (laux) > 0 and nops (laux) <= nd1 then
      if typ = 'rh' then
         ERROR (`too few parameters for the rho transformation`)
      elif typ = 'rhit' then
         ERROR (`too few parameters for the iterated rho_2 transformation`)
      elif typ = 'r' then
         ERROR (`too few parameters for the Richardson exptrapolation`)
      fi
   fi
fi;
#
#  perform the specific series transformation
#
app := frontend (`trans/series_transform`, [s1, y, ndim, typ, laux],
                 [{`+`, `*`, list, series},{}]);
#
#  determination of the output form
#
resnum := expand (numer (app));
resden := expand (denom (app));
#
#  determination of the indeterminats for the output expresssion
#
indarg  := indets (app, string) minus {constants};
#
#  convert into Horner scheme
#
if evalorder = `horner` then
   resnum  := convert (resnum, horner, indarg);
   resden  := convert (resden, horner, indarg);
   resarb  := resnum / resden
else
   resarb := resnum / resden
fi;
#
# return the result
#
if switch = 'nofort' then
#
#  check whether the result contains a floating-point number
#
   if floats then
      resarb := evalf (resarb)
   fi;
#
#  insert the actual arguments as table index and the result as
#  table value into the remember table
#
   `trans/ratgen` (args) := resarb;
#
   precision := old_precision;
#
   RETURN (resarb)
else
#
#  determination of the FORTRAN function header
#
   `trans/fortran_header` (typ, indarg, precision, 'head', 'tra');
   head1 := head [1];
   head2 := head [2];
#
#  write the fortran function
#
   if (fn <> ``) then writeto(fn) fi;
   lprint(`      `.head1);
   lprint(`      `.head2);
   `trans/my_fort`([tra = evalf (resarb, ndig)]);
   lprint(`      end`);
   if (fn <> ``) then writeto('terminal') fi;
#
   precision := old_precision;
#
   RETURN()
fi
end:
`trans/eps_sym` := proc (s_k, k, arr)
#***********************************************************************
#
#  Procedure  : eps
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 18 june 1990
#  Update     : 1 july 1990
#               normalize intermetiate expressions
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  The epsilon algorithm due to Wynn is used to perform Shanks'
#  series transformation.
#
#  Input parameters :
#
#  s_k  : sequence element s_k of the sequence to be accelerated
#  k    : number of the last element
#  arr  : 1-dimensional array to store the actual counterdiagonal of
#         the epsilon table
#
#***********************************************************************
#
local j, aux1, aux2, diff1;
global precision;
#
# initialization
#
arr [ k ]    := s_k;
#
# recursive computation of the epsilon table
#
if k = 0 then
   RETURN (s_k)
else
   aux2 := 0;
   for j from k by -1 to 1
   do
      aux1          := aux2;
      aux2          := arr [ j - 1 ];
      diff1         := normal (arr [ j ] - aux2);
      arr [ j - 1 ] := normal (aux1 + 1 / diff1)
   od
fi;
#
if modp (k, 2) = 0 then
   RETURN (arr [ 0 ])
else
   RETURN (arr [ 1 ])
fi
end:
`trans/eps` := proc (s_k, k, arr)
#***********************************************************************
#
#  Procedure  : eps
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 24 september 1992
#               version of eps for use with evalhf
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  The epsilon algorithm due to Wynn is used to perform Shanks'
#  series transformation.
#
#  Input parameters :
#
#  s_k  : sequence element s_k of the sequence to be accelerated
#  k    : number of the last element
#  arr  : 1-dimensional array to store the actual counterdiagonal of
#         the epsilon table
#
#***********************************************************************
#
local j, aux1, aux2, diff1;
#
# initialization
#
arr [ k ]    := s_k;
#
# recursive computation of the epsilon table
#
if k = 0 then
   RETURN (s_k)
else
   aux2 := 0;
   for j from k by -1 to 1
   do
      aux1          := aux2;
      aux2          := arr [ j - 1 ];
      diff1         := arr [ j ] - aux2;
      if evalf (abs (diff1)) < evalhf (DBL_MIN) then
         arr [j - 1] := evalhf (DBL_MAX)
      else
         arr [j - 1] := aux1 + 1 / diff1
      fi
   od
fi;
#
if modp (k, 2) = 0 then
   RETURN (arr [0])
else
   RETURN (arr [1])
fi
end:
`trans/rho_sym` := proc (s_k, x_k, k, arr, xarr)
#***********************************************************************
#
#  Procedure  : rho
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 18 june 1990
#  Update     : 1 july 1990
#               normalize intermetiate expressions
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  The rho algorithm due to Wynn is used to perform the rho
#  transformation.
#
#  Input parameters :
#
#  s_k  : sequence element s_k of the sequence to be accelerated
#  x_k  : element x_k of the auxiliary sequence
#  k    : number of the last element
#  arr  : 1-dimensional array to store the actual counterdiagonal of
#         the rho table
#  xarr : 1-dimensional array containing the auxiliary sequence x_k
#         required in the generalized version of the rho algorithm
#
#***********************************************************************
#
local j, aux1, aux2, diff1;
#
# initializations
#
arr  [ k ] := s_k;
xarr [ k ] := x_k;
#
# recursive computation of the rho table.
#
if k = 0 then
   RETURN (s_k)
else
   aux2 := 0;
   for j from k by -1 to 1
   do
      aux1          := aux2;
      aux2          := arr [ j - 1 ];
      diff1         := normal (arr [ j ] - aux2);
      arr [ j - 1 ] := normal (aux1 + (xarr [ k ] - xarr [ j - 1 ]) / diff1)
   od;
   if modp (k, 2) = 0 then
      RETURN (arr [ 0 ])
   else
      RETURN (arr [ 1 ])
   fi
fi
end:
`trans/rho` := proc (s_k, x_k, k, arr, xarr)
#***********************************************************************
#
#  Procedure  : rho
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 24 september 1992
#               version of rho for use with evalhf
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  The rho algorithm due to Wynn is used to perform the rho
#  transformation.
#
#  Input parameters :
#
#  s_k  : sequence element s_k of the sequence to be accelerated
#  x_k  : element x_k of the auxiliary sequence
#  k    : number of the last element
#  arr  : 1-dimensional array to store the actual counterdiagonal of
#         the rho table
#  xarr : 1-dimensional array containing the auxiliary sequence x_k
#         required in the generalized version of the rho algorithm
#
#***********************************************************************
#
local j, aux1, aux2, diff1;
#
# initializations
#
arr  [ k ] := s_k;
xarr [ k ] := x_k;
#
# recursive computation of the rho table.
#
if k = 0 then
   RETURN (s_k)
else
   aux2 := 0;
   for j from k by -1 to 1
   do
      aux1          := aux2;
      aux2          := arr [ j - 1 ];
      diff1         := arr [ j ] - aux2;
      if evalf (abs (diff1)) < evalhf (DBL_MIN) then
         arr [j - 1] := evalhf (DBL_MAX)
      else
         arr [j - 1] := aux1 + (xarr [ k ] - xarr [ j - 1 ]) / diff1
      fi
   od;
   if modp (k, 2) = 0 then
      RETURN (arr [0])
   else
      RETURN (arr [1])
   fi
fi
end:
`trans/rhoit_sym` := proc (s_k, x_k, k, arr, xarr)
#***********************************************************************
#
#  Procedure  : rhoit
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 18 june 1990
#  Update     : 1 july 1990
#               normalize intermetiate expressions
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  The iterated rho_2 algorithm is used to perform the series
#  transformation.
#
#  Input parameters :
#
#  s_k  : sequence element s_k of the sequence to be accelerated
#  x_k  : element x_k of the auxiliary sequence
#  k    : number of the last element
#  arr  : 1-dimensional array to store the actual counterdiagonal of
#         the table for the iterated rho_2 transformation
#  xar  : 1-dimensional array containing the auxiliary sequence x_k
#
#***********************************************************************
#
local j , diff1, diff2, m, dnom;
#
# initializations
#
arr  [ k ] := s_k;
xarr [ k ] := x_k;
#
# perform the iterated rho_2 algorithm
#
if k < 2 then
   RETURN (s_k)
else
   m := k;
   for j from 1 to iquo (k, 2)
   do
      m         := m - 2;
      diff1     := normal (arr [ m + 1 ] - arr [ m ]);
      diff2     := normal (arr [ m + 2 ] - arr [ m + 1 ]);
      dnom      := normal ((xarr [ k ] - xarr [ m + 1 ]) * diff1 -
                   (xarr [ k - 1 ] - xarr [ m ]) * diff2);
      arr [ m ] := normal (arr [ m + 1 ] + (xarr [ k ] - xarr [ m ]) *
                   diff1 * diff2 / dnom)
   od;
   if modp (k, 2) = 0 then
      RETURN (arr [ 0 ])
   else
      RETURN (arr [ 1 ])
   fi
fi
end:
`trans/rhoit` := proc (s_k, x_k, k, arr, xarr)
#***********************************************************************
#
#  Procedure  : rhoit
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 24 september 1992
#               version of rhoit for use with evalhf
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  The iterated rho_2 algorithm is used to perform the series
#  transformation.
#
#  Input parameters :
#
#  s_k  : sequence element s_k of the sequence to be accelerated
#  x_k  : element x_k of the auxiliary sequence
#  k    : number of the last element
#  arr  : 1-dimensional array to store the actual counterdiagonal of
#         the table for the iterated rho_2 transformation
#  xar  : 1-dimensional array containing the auxiliary sequence x_k
#
#***********************************************************************
#
local j , diff1, diff2, m, dnom;
#
# initializations
#
arr  [ k ] := s_k;
xarr [ k ] := x_k;
#
# perform the iterated rho_2 algorithm
#
if k < 2 then
   RETURN (s_k)
else
   m := k;
   for j from 1 to iquo (k, 2)
   do
      m         := m - 2;
      diff1     := arr [ m + 1 ] - arr [ m ];
      diff2     := arr [ m + 2 ] - arr [ m + 1 ];
      dnom      := (xarr [ k ] - xarr [ m + 1 ]) * diff1 -
                   (xarr [ k - 1 ] - xarr [ m ]) * diff2;
      if evalf (abs (dnom)) < evalhf (DBL_MIN) then
         arr [m] := evalhf (DBL_MAX)
      else
         arr [m] := arr [ m + 1 ] + (xarr [ k ] - xarr [ m ]) *
                    diff1 * diff2 / dnom
      fi
   od;
   if modp (k, 2) = 0 then
      RETURN (arr [0])
   else
      RETURN (arr [1])
   fi
fi
end:
`trans/theta_sym` := proc (s_k, k, arr, xarr)
#***********************************************************************
#
#  Procedure  : theta
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 18 june 1990
#  Update     : 1 july 1990
#               normalize intermetiate expressions
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  The theta algorithm due to Brezinski is used to perform the theta
#  transformation.
#
#  Input parameters :
#
#  s_k  : sequence element s_k of the sequence to be accelerated
#  k    : number of the last element
#  arr  : 1-dimensional array
#  xarr : 1-dimensional array
#
#***********************************************************************
#
local j, aux1, aux2, aux3, dnom, diff1, jmax;
#
# recursive computation of the theta table
#
if k = 0 then
   arr [ k ] := s_k;
   RETURN (s_k)
elif k > 0 then
   jmax := iquo (2 * k + 1, 3);
   if (modp (k, 2) = 0) then
      aux2      := 0;
      aux1      := arr [ 0 ];
      arr [ 0 ] := s_k;
      for j from 1 to jmax
      do
         aux3 := aux2;
         aux2 := aux1;
         if j < jmax then
            aux1 := arr [ j ]
         fi;
         if (modp (j, 2) = 0) then
            dnom        := normal (arr [ j - 1 ] - 2 *
                           xarr [ j - 1 ] + aux2);
            arr [ j ] := normal (aux3 + (xarr [ j - 2 ] - aux3) *
                         (arr [ j - 1 ] - xarr [ j - 1 ]) / dnom)
         else
            diff1     := normal (arr [ j - 1 ] - xarr [ j - 1 ]);
            arr [ j ] := normal (aux3 + 1 / diff1)
         fi
      od;
#
      if (modp (jmax, 2) = 0) then
         RETURN (arr [ jmax ])
      else
         RETURN (arr [ jmax - 1 ])
      fi
   else
      aux2       := 0;
      aux1       := xarr [ 0 ];
      xarr [ 0 ] := s_k;
      for j from 1 to jmax
      do
         aux3 := aux2;
         aux2 := aux1;
         if j < jmax then
            aux1 := xarr [ j ]
         fi;
         if (modp (j, 2) = 0) then
            dnom         := normal (xarr [ j - 1 ] - 2 *
                            arr [ j - 1 ] + aux2);
            xarr [ j ] := normal (aux3 + (arr [ j - 2 ] - aux3) *
                          (xarr [ j - 1 ] - arr [ j - 1 ]) / dnom)
         else
            diff1      := normal (xarr [ j - 1 ] - arr [ j - 1 ]);
            xarr [ j ] := normal (aux3 + 1 / diff1)
         fi
      od;
#
      if (modp (jmax, 2) = 0) then
         RETURN (xarr [ jmax ])
      else
         RETURN (xarr [ jmax - 1 ])
      fi
   fi
fi
end:
`trans/theta` := proc (s_k, k, arr, xarr)
#***********************************************************************
#
#  Procedure  : theta
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 21 september 1992
#               version of theta for use with evalhf 
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  The theta algorithm due to Brezinski is used to perform the theta
#  transformation.
#
#  Input parameters :
#
#  s_k  : sequence element s_k of the sequence to be accelerated
#  k    : number of the last element
#  arr  : 1-dimensional array
#  xarr : 1-dimensional array
#
#***********************************************************************
#
local j, aux1, aux2, aux3, dnom, diff1, jmax;
#
# recursive computation of the theta table
#
if k = 0 then
   arr [ k ] := s_k;
   RETURN (s_k)
elif k > 0 then
   jmax := iquo (2 * k + 1, 3);
   if (modp (k, 2) = 0) then
      aux2      := 0;
      aux1      := arr [ 0 ];
      arr [ 0 ] := s_k;
      for j from 1 to jmax
      do
         aux3 := aux2;
         aux2 := aux1;
         if j < jmax then
            aux1 := arr [ j ]
         fi;
         if (modp (j, 2) = 0) then
            dnom      := arr [ j - 1 ] - 2 * xarr [ j - 1 ] + aux2;
            if evalf (abs (dnom)) < evalhf (DBL_MIN) then
               arr [j] := evalhf (DBL_MAX)
            else
               arr [j] := aux3 + (xarr [ j - 2 ] - aux3) *
                          (arr [ j - 1 ] - xarr [ j - 1 ]) / dnom
            fi
         else
            diff1     := arr [ j - 1 ] - xarr [ j - 1 ];
            if evalf (abs (diff1)) < evalhf (DBL_MIN) then
               arr [j] := evalhf (DBL_MAX)
            else 
               arr [j] := aux3 + 1 / diff1
            fi
         fi
      od;
#
      if (modp (jmax, 2) = 0) then
         RETURN (arr [ jmax ])
      else
         RETURN (arr [ jmax - 1 ])
      fi
   else
      aux2       := 0;
      aux1       := xarr [ 0 ];
      xarr [ 0 ] := s_k;
      for j from 1 to jmax
      do
         aux3 := aux2;
         aux2 := aux1;
         if j < jmax then
            aux1 := xarr [ j ]
         fi;
         if (modp (j, 2) = 0) then
            dnom       := xarr [ j - 1 ] - 2 * arr [ j - 1 ] + aux2;
            if evalf (abs (dnom)) < evalhf (DBL_MIN) then
               xarr [j] := evalhf (DBL_MAX)
            else
               xarr [j] := aux3 + (arr [ j - 2 ] - aux3) *
                           (xarr [ j - 1 ] - arr [ j - 1 ]) / dnom
            fi
         else
            diff1      := xarr [ j - 1 ] - arr [ j - 1 ];
            if evalf (abs (diff1)) < evalhf (DBL_MIN) then
               xarr [j] := evalhf (DBL_MAX)
            else
               xarr [ j ] := aux3 + 1 / diff1
            fi
         fi
      od;
#
      if (modp (jmax, 2) = 0) then
         RETURN (xarr [ jmax ])
      else
         RETURN (xarr [ jmax - 1 ])
      fi
   fi
fi
end:
`trans/thetait_sym` := proc (s_k, k, arr)
#***********************************************************************
#
#  Procedure  : thetait
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 18 june 1990
#  Update     : 1 july 1990
#               normalize intermetiate expressions
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  The iterated theta_2 algorithm is used to perform the sequence
#  (series) transformation.
#
#  Input parameters :
#
#  s_k  : sequence element s_k of the sequence to be accelerated
#  k    : number of the last element
#  arr  : 1-dimensional array to store the actual counterdiagonal of
#         theta_2 table
#
#***********************************************************************
#
local j, m, dnom, diff0, diff1, diff2;
#
# initialization
#
arr [ k ] := s_k;
#
# recursive computation of the theta_2 table
#
if k < 3 then
   RETURN (s_k);
else
   m := k;
   for j from 1 to iquo (k, 3)
   do
      m         := m - 3;
      diff0     := normal (arr [ m + 1 ] - arr [ m ]);
      diff1     := normal (arr [ m + 2 ] - arr [ m + 1 ]);
      diff2     := normal (arr [ m + 3 ] - arr [ m + 2 ]);
      dnom      := normal (diff2 * (diff1 - diff0) -
                   diff0 * (diff2 - diff1));
      arr [ m ] := normal (arr [ m + 1 ] - diff0 * diff1 *
                   (diff2 - diff1) / dnom)
   od;
#
   RETURN (arr [modp (k, 3) ])
fi
end:
`trans/thetait` := proc (s_k, k, arr)
#***********************************************************************
#
#  Procedure  : thetait
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 24 september 1992
#               version of thetait for use with evalhf 
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  The iterated theta_2 algorithm is used to perform the sequence
#  (series) transformation.
#
#  Input parameters :
#
#  s_k  : sequence element s_k of the sequence to be accelerated
#  k    : number of the last element
#  arr  : 1-dimensional array to store the actual counterdiagonal of
#         theta_2 table
#
#***********************************************************************
#
local j, m, dnom, diff0, diff1, diff2;
#
# initialization
#
arr [ k ] := s_k;
#
# recursive computation of the theta_2 table
#
if k < 3 then
   RETURN (s_k);
else
   m := k;
   for j from 1 to iquo (k, 3)
   do
      m         := m - 3;
      diff0     := arr [ m + 1 ] - arr [ m ];
      diff1     := arr [ m + 2 ] - arr [ m + 1 ];
      diff2     := arr [ m + 3 ] - arr [ m + 2 ];
      dnom      := diff2 * (diff1 - diff0) -
                   diff0 * (diff2 - diff1);
      if evalf (abs (dnom)) < evalhf (DBL_MIN) then
         arr [m] := evalhf (DBL_MAX)
      else
         arr [m] := arr [ m + 1 ] - diff0 * diff1 *
                   (diff2 - diff1) / dnom
      fi
   od;
#
   RETURN (arr [modp (k, 3) ])
fi
end:
`trans/aitken_sym` := proc (s_k, k, arr)
#***********************************************************************
#
#  Procedure  : aitken
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 18 june 1990
#  Update     : 1 july 1990
#               normalize intermetiate expressions
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  A recursive algorithm is used to perform the iterated Aitken
#  transformation.
#
#  Input parameters :
#
#  s_k  : sequence element s_k of the sequence to be accelerated
#  k    : number of the last element
#  arr  : 1-dimensional array to store the actual counterdiagonal of
#         the Aitken table
#
#***********************************************************************
#
local j, dnom, m;
#
# initialization
#
arr [ k ] := s_k;
#
# perform the iterated Aitken transformation
#
if k < 2 then
   RETURN (s_k)
else
   m := k;
   for j from 1 to iquo (k, 2)
   do
      m         := m - 2;
      dnom      := normal (arr [ m + 2 ] - 2 * arr [ m + 1 ] + arr [ m ]);
      arr [ m ] := normal (arr [ m ] - (arr [ m ] - arr [ m + 1 ]) ** 2 / dnom)
   od;
#
   if modp (k, 2) = 0 then
      RETURN (arr [ 0 ])
   else
      RETURN (arr [ 1 ])
   fi
fi
end:
`trans/aitken` := proc (s_k, k, arr)
#***********************************************************************
#
#  Procedure  : aitken
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 24 september 1992
#               version of aitken for use with evalhf
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  A recursive algorithm is used to perform the iterated Aitken
#  transformation.
#
#  Input parameters :
#
#  s_k  : sequence element s_k of the sequence to be accelerated
#  k    : number of the last element
#  arr  : 1-dimensional array to store the actual counterdiagonal of
#         the Aitken table
#
#***********************************************************************
#
local j, dnom, m;
#
# initialization
#
arr [ k ] := s_k;
#
# perform the iterated Aitken transformation
#
if k < 2 then
   RETURN (s_k)
else
   m := k;
   for j from 1 to iquo (k, 2)
   do
      m         := m - 2;
      dnom      := arr [ m + 2 ] - 2 * arr [ m + 1 ] + arr [ m ];
      if evalf (abs (dnom)) < evalhf (DBL_MIN) then
         arr [m] := evalhf (DBL_MAX)
      else
         arr [m] := arr [ m ] - (arr [ m ] - arr [ m + 1 ]) ** 2 / dnom
      fi
   od;
#
   if modp (k, 2) = 0 then
      RETURN (arr [0])
   else
      RETURN (arr [1])
   fi
fi
end:
`trans/rich_sym` := proc (s_k, x_k, k, arr, xarr)
#***********************************************************************
#
#  Procedure  : rich
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 18 june 1990
#  Update     : 1 july 1990
#               normalize intermetiate expressions
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  Neville's recursive scheme is used to perform the Richardson
#  extrapolation process.
#
#  Input parameters :
#
#  s_k  : sequence element s_k of the sequence to be accelerated
#  x_k  : element x_k of the auxiliary sequence
#  k    : number of the last element
#  arr  : 1-dimensional array to store the actual counterdiagonal of
#         Neville's table
#  xarr : 1-dimensional array to store the auxiliary sequence
#
#***********************************************************************
#
local j, diff1;
#
# initializations
#
arr  [ k ] := s_k;
xarr [ k ] := x_k;
#
# recursive computation of Neville's table
#
for j from 1 to k
do
   diff1         := normal (xarr [ k - j ] - xarr [ k ]);
   arr [ k - j ] := normal ((xarr [ k - j ] * arr [ k - j + 1 ] -
                    xarr [ k ] * arr [ k - j ]) / diff1)
od;
#
RETURN (arr [ 0 ]);
#
end:
`trans/rich` := proc (s_k, x_k, k, arr, xarr)
#***********************************************************************
#
#  Procedure  : rich
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 24 september 1992
#               version of rich for use with evalhf
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  Neville's recursive scheme is used to perform the Richardson
#  extrapolation process.
#
#  Input parameters :
#
#  s_k  : sequence element s_k of the sequence to be accelerated
#  x_k  : element x_k of the auxiliary sequence
#  k    : number of the last element
#  arr  : 1-dimensional array to store the actual counterdiagonal of
#         Neville's table
#  xarr : 1-dimensional array to store the auxiliary sequence
#
#***********************************************************************
#
local j, diff1;
#
# initializations
#
arr  [ k ] := s_k;
xarr [ k ] := x_k;
#
# recursive computation of Neville's table
#
for j from 1 to k
do
   diff1         := xarr [ k - j ] - xarr [ k ];
   if evalf (abs (diff1)) < evalhf (DBL_MIN) then
      arr [j - 1] := evalhf (DBL_MAX)
   else
      arr [k - j] := (xarr [ k - j ] * arr [ k - j + 1 ] -
                     xarr [ k ] * arr [ k - j ]) / diff1
   fi
od;
#
RETURN (arr [0]);
#
end:
`trans/gb_sym` := proc (s_k, x_k, k, arr, xarr)
#***********************************************************************
#
#  Procedure  : gb
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 18 june 1990
#  Update     : 1 july 1990
#               normalize intermetiate expressions
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  Neville's recursive scheme is used to perform the transformation
#  of Germain-Bonne.
#
#  Input parameters :
#
#  s_k  : partial sum s_k of the series to be accelerated
#  x_k  : term x_k of the series
#  k    : number of the last partial sum
#  arr  : 1-dimensional array to store the actual counterdiagonal of
#         Neville's table
#  xarr : 1-dimensional array to store the terms of the series
#
#***********************************************************************
#
local j, diff1;
#
# initializations
#
arr  [ k ] := s_k;
xarr [ k ] := x_k;
#
# recursive computation of Neville's table
#
for j from 2 to k
do
   diff1         := normal (xarr [ k - j + 1] - xarr [ k ]);
   arr [ k - j ] := normal( (xarr [ k - j + 1 ] *
                    arr [ k - j + 1 ] - xarr [ k ] *
                    arr [ k - j ]) / diff1)
od;
RETURN (arr [ 0 ]);
end:
`trans/gb` := proc (s_k, x_k, k, arr, xarr)
#***********************************************************************
#
#  Procedure  : gb
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 24 september 1992
#               version of gb for use with evalhf
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  Neville's recursive scheme is used to perform the transformation
#  of Germain-Bonne.
#
#  Input parameters :
#
#  s_k  : partial sum s_k of the series to be accelerated
#  x_k  : term x_k of the series
#  k    : number of the last partial sum
#  arr  : 1-dimensional array to store the actual counterdiagonal of
#         Neville's table
#  xarr : 1-dimensional array to store the terms of the series
#
#***********************************************************************
#
local j, diff1;
#
# initializations
#
arr  [ k ] := s_k;
xarr [ k ] := x_k;
#
# recursive computation of Neville's table
#
for j from 2 to k
do
   diff1         := xarr [ k - j + 1] - xarr [ k ];
   if evalf (abs (diff1)) < evalhf (DBL_MIN) then
      arr [k - j] := evalhf (DBL_MAX)
   else
      arr [k - j] := (xarr [ k - j + 1 ] *
                     arr [ k - j + 1 ] - xarr [ k ] *
                     arr [ k - j ]) / diff1
   fi
od;
RETURN (arr [0]);
end:
`trans/lev_sym` := proc (s_k, a_k, k, arlo, arup, typ)
#***********************************************************************
#
#  Procedure  : lev
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 18 june 1990
#  Update     : 1 july 1990
#               normalize intermetiate expressions
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  lev converts a series expansion to a rational function
#  using a series transformation of D. Levin (J. Comput. Math.,
#  Vol.B3, 1973, pp.371-388 ).
#
#  In Levin's transformations it is assumed that the partial sums s_n
#  of a series can be written as s_n = x + r_n (x limit or antilimit)
#  and that the first term of the Poincare-type asymptotic expansion
#  of the remainder r_n is proportional to:
#
#  (k+1) * a_k                            (u transformation)
#  a_k                                    (t transformation)
#  a_{k+1}                                (d transformation)
#  a_{k+1} * a_k / (a_k - a_{k+1})        (v transformation)
#
#  (a_k, k >= 0,  are the terms of the series)
#
#  Input parameters :
#
#  s_k   : partial sum s_k of the series to be accelerated
#  a_k   : term a_k of the series
#  k     : number of the last partial sum
#  arlo  : 1-dim. array(-1 .. n) to store the counterdiagonal of the
#          numerator table arlo[1] .. arlo[n] and intermediate values of a_k
#          in arlo [-1]
#  arup  : 1-dim. array(-1 .. n) to store the counterdiagonal of the
#          denominator table in arup[1] .. arup[n] and intermediate values of s_k
#          in arup [-1]
#  typ   : type of transformation: u, t, d or v
#
#***********************************************************************
#
local j, fact, k1;
#
#  determine the special part of the specified transformation
#
k1 := k;
#
if typ = 'u' then
   arlo [ k1 ] := normal (1 / ((k1 + 1) ** 2 * a_k))
elif typ = 't' then
   arlo [ k1 ] := normal (1 / ((k1 + 1) * a_k))
elif typ = 'd' then
   if k = 0 then
      arlo [ k1 ] := 1
   else
      k1          := k - 1;
      arlo [ k1 ] := normal (1 / ((k1 + 1) * a_k))
   fi
elif typ = 'v' then
   if k = 0 then
      arlo [-1]   := a_k;
      arlo [ k1 ] := 1
   else
      k1          := k - 1;
      arlo [ k1 ] := normal ((arlo [-1] - a_k) / ((k1 + 1) * arlo [-1] * a_k));
      arlo [-1]   := a_k
   fi
fi;
#
if typ = 'd'  or typ = 'v' then
   if k = 0 then
      arup [-1]   := s_k;
      arup [ k1 ] := s_k
   else
      arup [ k1 ] := arup [-1] * arlo [ k1 ];
      arup [-1]   := s_k
   fi;
else
   arup [ k1 ] := s_k * arlo [ k1 ]
fi;
#
for j from 1 to k1
do
   fact            := (k1 - j + 1) * k1 ** (j - 1) / (k1 + 1) ** j;
   arup [ k1 - j ] := normal (arup [ k1 - j + 1 ] - fact * arup [ k1 - j ]);
   arlo [ k1 - j ] := normal (arlo [ k1 - j + 1 ] - fact * arlo [ k1 - j ])
od;
RETURN (normal (arup [ 0 ] / arlo [ 0 ]));
end:
`trans/lev` := proc (s_k, a_k, k, arlo, arup, typ)
#***********************************************************************
#
#  Procedure  : lev
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 21 september 1992
#               version of lev for use with evalhf
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  lev converts a series expansion to a rational function
#  using a series transformation of D. Levin (J. Comput. Math.,
#  Vol.B3, 1973, pp.371-388 ).
#
#  In Levin's transformations it is assumed that the partial sums s_n
#  of a series can be written as s_n = x + r_n (x limit or antilimit)
#  and that the first term of the Poincare-type asymptotic expansion
#  of the remainder r_n is proportional to:
#
#  (k+1) * a_k                            (u transformation)
#  a_k                                    (t transformation)
#  a_{k+1}                                (d transformation)
#  a_{k+1} * a_k / (a_k - a_{k+1})        (v transformation)
#
#  (a_k, k >= 0,  are the terms of the series)
#
#  Input parameters :
#
#  s_k   : partial sum s_k of the series to be accelerated
#  a_k   : term a_k of the series
#  k     : number of the last partial sum
#  arlo  : 1-dim. array(-1 .. n) to store the counterdiagonal of the
#          numerator table arlo[1] .. arlo[n] and intermediate values 
#          of a_k in arlo [-1]
#  arup  : 1-dim. array(-1 .. n) to store the counterdiagonal of the
#          denominator table in arup[1] .. arup[n] and intermediate 
#          values of s_k in arup [-1]
#  typ   : type of transformation: 1, 2, 3, 4 (corresponds to u, t, d, v)
#
#***********************************************************************
#
local j, fact, k1;
#
#  determine the special part of the specified transformation
#
k1 := k;
#
if typ = 1 then
   arlo [ k1 ] := 1 / ((k1 + 1) ** 2 * a_k)
elif typ = 2 then
   arlo [ k1 ] := 1 / ((k1 + 1) * a_k)
elif typ = 3 then
   if k = 0 then
      arlo [ k1 ] := 1
   else
      k1          := k - 1;
      arlo [ k1 ] := 1 / ((k1 + 1) * a_k)
   fi
elif typ = 4 then
   if k = 0 then
      arlo [-1]   := a_k;
      arlo [ k1 ] := 1
   else
      k1          := k - 1;
      arlo [ k1 ] := (arlo [-1] - a_k) / ((k1 + 1) * arlo [-1] * a_k);
      arlo [-1]   := a_k
   fi
fi;
#
if (typ = 3  or typ = 4) then
   if k = 0 then
      arup [-1]   := s_k;
      arup [ k1 ] := s_k
   else
      arup [ k1 ] := arup [-1] * arlo [ k1 ];
      arup [-1]   := s_k
   fi;
else
   arup [ k1 ] := s_k * arlo [ k1 ]
fi;
#
for j from 1 to k1
do
   fact            := (k1 - j + 1) * k1 ** (j - 1) / (k1 + 1) ** j;
   arup [ k1 - j ] := arup [ k1 - j + 1 ] - fact * arup [ k1 - j ];
   arlo [ k1 - j ] := arlo [ k1 - j + 1 ] - fact * arlo [ k1 - j ]
od;
#
if evalf (abs(arlo [0])) < evalhf (DBL_MIN) then
   RETURN (evalhf (DBL_MAX))
else
   RETURN (arup [0] / arlo [0])
fi:
end:
`trans/sidi_sym` := proc (s_k, a_k, k, arlo, arup, typ)
#***********************************************************************
#
#  Procedure  : sidi
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 31 july 1990
#
#-----------------------------------------------------------------------
#
#  Description:
#
#  sidi converts a series expansion to a rational function
#  using a transformation due to Sidi
#  (A. Sidi J. Comput.Appl.Math. Vol. 7 (1981), 37-40)
#
#  As in Levin's transformations it is assumed that the partial sums s_n
#  of a series can be written as s_n = x + r_n (x limit or antilimit)
#  and that the first term of the asymptotic expansion
#  of the remainder r_n is proportional to:
#
#  (k+1) * a_k                            (su transformation)
#  a_k                                    (st transformation)
#  a_{k+1}                                (sd transformation)
#  a_{k+1} * a_k / (a_k - a_{k+1})        (sv transformation)
#
#  (a_k, k >= 0,  are the terms of the series)
#
#  Input parameters :
#
#  s_k   : partial sum s_k of the series to be accelerated
#  a_k   : term a_k of the series
#  k     : number of the last partial sum
#  arlo  : 1-dim. array(-1 .. n) to store the counterdiagonal of the
#          numerator table arlo[1] .. arlo[n] and intermediate values of
#          a_k in arlo [-1]
#  arup  : 1-dim. array(-1 .. n) to store the counterdiagonal of the
#          denominator table in arup[1] .. arup[n] and intermediate 
#          values of s_k in arup [-1]
#  typ   : type of transformation: su, st, sd or sv
#
#***********************************************************************
#
local j, fact, k1;
#
#  determine the special part of the specified transformation
#
k1 := k;
#
if typ = 'su' then
   arlo [ k1 ] := normal (1 / ((k1 + 1) * a_k))
elif typ = 'st' then
   arlo [ k1 ] := normal (1 / a_k)
elif typ = 'sd' then
   if k = 0 then
      arlo [ k1 ] := 1
   else
      k1          := k - 1;
      arlo [ k1 ] := normal (1 / a_k)
   fi
elif typ = 'sv' then
   if k = 0 then
      arlo [ k1 ] := 1;
      arlo [-1]   := a_k
   else
      arlo [ k1 ] := normal ((arlo [-1] - a_k) / (arlo [-1] * a_k));
      arlo [-1]   := a_k
   fi
fi;
#
if typ = 'sd'  or typ = 'sv' then
   if k = 0 then
      arup [ k ] := s_k;
      arup [-1]  := s_k
   else
      arup [ k1 ] := arup [-1] * arlo [ k1 ];
      arup [-1]   := s_k
   fi;
else
   arup [ k1 ] := s_k * arlo [ k1 ]
fi;
#
if k1 > 0 then
   arup [ k1 - 1 ] := arup [ k1 ] - arup [ k1 - 1 ];
   arlo [ k1 - 1 ] := arlo [ k1 ] - arlo [ k1 - 1 ];
   for j from 2 to k1
   do
      fact            := (k1 - 1) * k1 / ((k1 + j - 2) * (k1 + j - 1));
      arup [ k1 - j ] := normal (arup [ k1 - j + 1 ] - fact * arup [ k1 - j ]);
      arlo [ k1 - j ] := normal (arlo [ k1 - j + 1 ] - fact * arlo [ k1 - j ])
   od;
fi;
RETURN (normal (arup [ 0 ] / arlo [ 0 ]));
end:
`trans/sidi` := proc (s_k, a_k, k, arlo, arup, typ)
#***********************************************************************
#
#  Procedure  : sidi
#
#  Programmer : Johannes Grotendorst
#
#  Date       : Juelich, 24 september 1992
#               version of sidi for use with evalhf
# 
#-----------------------------------------------------------------------
#
#  Description:
#
#  sidi converts a series expansion to a rational function
#  using a transformation due to Sidi
#  (A. Sidi J. Comput.Appl.Math. Vol. 7 (1981), 37-40)
#
#  As in Levin's transformations it is assumed that the partial sums s_n
#  of a series can be written as s_n = x + r_n (x limit or antilimit)
#  and that the first term of the asymptotic expansion
#  of the remainder r_n is proportional to:
#
#  (k+1) * a_k                            (su transformation)
#  a_k                                    (st transformation)
#  a_{k+1}                                (sd transformation)
#  a_{k+1} * a_k / (a_k - a_{k+1})        (sv transformation)
#
#  (a_k, k >= 0,  are the terms of the series)
#
#  Input parameters :
#
#  s_k   : partial sum s_k of the series to be accelerated
#  a_k   : term a_k of the series
#  k     : number of the last partial sum
#  arlo  : 1-dim. array(-1 .. n) to store the counterdiagonal of the
#          numerator table arlo[1] .. arlo[n] and intermediate values 
#          of a_k in arlo [-1]
#  arup  : 1-dim. array(-1 .. n) to store the counterdiagonal of the
#          denominator table in arup[1] .. arup[n] and intermediate
#          values of s_k in arup [-1]
#  typ   : type of transformation: 1, 2, 3, 4 (su, st, sd or sv)
#
#***********************************************************************
#
local j, fact, k1;
#
#  determine the special part of the specified transformation
#
k1 := k;
#
if typ = 1 then
   arlo [ k1 ] := 1 / ((k1 + 1) * a_k)
elif typ = 2 then
   arlo [ k1 ] := 1 / a_k
elif typ = 3 then
   if k = 0 then
      arlo [ k1 ] := 1
   else
      k1          := k - 1;
      arlo [ k1 ] := 1 / a_k
   fi
elif typ = 4 then
   if k = 0 then
      arlo [ k1 ] := 1;
      arlo [-1]   := a_k
   else
      arlo [ k1 ] := (arlo [-1] - a_k) / (arlo [-1] * a_k);
      arlo [-1]   := a_k
   fi
fi;
#
if (typ = 3  or typ = 4) then
   if k = 0 then
      arup [ k ] := s_k;
      arup [-1]  := s_k
   else
      arup [ k1 ] := arup [-1] * arlo [ k1 ];
      arup [-1]   := s_k
   fi;
else
   arup [ k1 ] := s_k * arlo [ k1 ]
fi;
#
if k1 > 0 then
   arup [ k1 - 1 ] := arup [ k1 ] - arup [ k1 - 1 ];
   arlo [ k1 - 1 ] := arlo [ k1 ] - arlo [ k1 - 1 ];
   for j from 2 to k1
   do
      fact            := (k1 - 1) * k1 / ((k1 + j - 2) * (k1 + j - 1));
      arup [ k1 - j ] := arup [ k1 - j + 1 ] - fact * arup [ k1 - j ];
      arlo [ k1 - j ] := arlo [ k1 - j + 1 ] - fact * arlo [ k1 - j ]
   od;
fi;
#
if evalf (abs (arlo [0])) < evalhf (DBL_MIN) then
   RETURN (evalhf (DBL_MAX))
else
   RETURN (arup [0] / arlo [0])
fi
end:
#
# difference between my_fort and the fortran function in MapleV:
# In my_fort an output_file is opended only if the output_filename
# in unequal to terminal.
#
`trans/my_fort` := 'fortran':

`help/text/trans` := TEXT (
`HELP FOR: The rational approximation package`,
`   `,
`CALLING SEQUENCE:`,
`   trans[ function ] ( args )`,
`   or function ( args )`,
`   `,
`SYNOPSIS:`,
`To use a trans function either define that function alone using`,
`with(trans,<function>), or define all trans functions by typing `,
`with( trans )`,
`   `,
`The functions available are:`,
`   `,
`            ratser   ratgen`,
`   `,
`            aitken   eps    gb     lev     rho`,
`            rhoit    rich   sidi   theta   thetait`,
`   `,
`            aitkenhf epshf  gbhf   levhf   rhohf`,
`            rhoithf  richhf sidihf thetahf thetaithf`,
`   `,
`   `,
`- The program ratser is designed to convert symbolically`,
`  series expansions with  data type "series" to rational approximants.`,
`- The program ratgen transforms generalized series expansions, e.g. asymptotic`,
`  expansions, with data type ``+``.`,
`- The functions aitken, ..., thetait can be used for the rational`,
`  approximation of numerical series  and sequences (acceleration of convergence,`,
`  summation of divergent series )`,
`- The functions aitkenhf, ..., thetaithf are idendical to aitken, ..., thetait`,
`  but use the hardware floating point system.`,
`- For more help of a particular function invoke help(trans, <function>);`,
`  or ?trans, <function>, where <function> is taken from the above list.`,
`   `,
`SEE ALSO: with, series, asympt, ``+`` `
):
#
`help/trans/text/aitken` := TEXT (
`HELP FOR: The iterated Aitken transformation`,
`   `,
`CALLING SEQUENCE:`,
`   `,
`aitken  (s_n, n, arr)`,
`aitkenhf (s_n, n, arr)`,
`   `,
`PARAMETERS`,
`   `,
`s_n   - element of the sequence `,
`n     - number of the last sequence element`,
`arr   - array (0 .. nmax) to store intermediate`,
`        elements of the  transformation table`,
`   `,
`SYNOPSIS:`,
`   `,
`- The elements s_n with n = 0, 1, 2, ... of the sequence to be`,
`  transformed have be read in successively, starting with s_0.`,
`- The procedure aitkenhf may be invoked to use the hardware floating`,
`  point system`,
`    `,
`EXAMPLE:`,
`    `,
`with (trans):`,
`# Acceleration of the alternating series`, 
`# sum ((-1)**(i+1)/sqrt(i+1), i=0 .. infinity) = (sqrt(2)-1)*Zeta(1/2)`,
`#`,
`Digits := 16:`,
`sum0   := 0:`,
`arr1   := array(0 .. 20):`,
`arr2   := array(0 .. 20):`,
`printlevel := 0:`,
`for i from 0 to 11 do`,
`   term0  := (-1) ** (i + 1) / sqrt (i + 1):`,
`   sum0   := sum0 + term0:`,
`   app[1] := i:`,
`   app[2] := evalf (sum0):`,
`   app[3] := evalf (aitken (sum0, i, arr1)):`,
`   app[4] := aitkenhf (sum0, i, arr2):`,
`   if i >= 5 then`,
`      printlevel := 1`,
`   fi;`,
`   app[m] $ m = 1 .. 4;`,
`   printlevel := 0`,
`od;`,
`   `,
`           5, -.4092087930391730, -.6048585480487868, -.6048585480487871`,
`   `,
`           6, -.7871732660484004, -.6049003225748472, -.6049003225748471`,
`   `,
`           7, -.4336198754551269, -.6048981314608436, -.6048981314608440`,
`   `,
`           8, -.7669532087884602, -.6048986607207577, -.6048986607207576`,
`   `,
`           9, -.4507254427716223, -.6048986383858591, -.6048986383858595`,
`   `,
`          10, -.7522367873493859, -.6048986435562148, -.6048986435562145`,
`   `,
`          11, -.4635616527545732, -.6048986433830988, -.6048986433830992`,
`   `,
`#Comparison:`,
`   `,
`> evalf ((sqrt(2)-1)*Zeta(1/2));`,
`                                 -.6048986434216304`
):
#
`help/trans/text/eps` := TEXT (
`HELP FOR: The Epsilon algorithm (Shanks transformation)`,
`   `,
`CALLING SEQUENCE:`,
`   `,
`eps  (s_n, n, arr)`,
`epshf (s_n, n, arr)`,
`   `,
`PARAMETERS`,
`   `,
`s_n   - element of the sequence `,
`n     - number of the last sequence element`,
`arr   - array (0 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`   `,
`SYNOPSIS:`,
`   `,
`- The elements s_n with n = 0, 1, 2, ... of the sequence to be`,
`  transformed have be read in successively, starting with s_0.`,
`- The procedure epshf may be invoked to use the hardware floating`,
`  point system.`,
`   `,
`EXAMPLE:`,
`   `,
`with (trans):`,
`# Acceleration of the alternating series expansion`,
`# for ln (1 + z) at z = 1`, 
`#`,
`sum0  := 0:`,
`arr1 := array(0 .. 30):`,
`arr2 := array(0 .. 30):`,
`Digits := 16:`,
`printlevel := 0:`,
`for i from 0 to 22 do`,
`   term0 := (-1) ** i / (1 + i):`,
`   sum0  := sum0 + term0:`,
`   app[1] := i:`,
`   app[2] := evalf (sum0):`,
`   app[3] := evalf (eps (sum0, i, arr1)):`,
`   app[4] := epshf (sum0, i, arr2):`,
`   if i >= 17 then`,
`      printlevel := 1`,
`   fi;`,
`   app[m] $ m = 1 .. 4;`,
`   printlevel := 0`,
`od;`,
`   `,
`            17, .6661398242280595, .6931471805599219, .6931471805599217`,
`   `,
`            18, .7187714031754279, .6931471805599485, .6931471805599484`,
`   `,
`            19, .6687714031754279, .6931471805599446, .6931471805599447`,
`   `,
`            20, .7163904507944756, .6931471805599454, .6931471805599454`,
`   `,
`            21, .6709359053399301, .6931471805599453, .6931471805599453`,
`   `,
`            22, .7144141662094953, .6931471805599453, .6931471805599454`,
`   `,
`#Comparison`,
`   `,
`> evalf (ln(2));`,
`                                 .6931471805599453`
):
#
`help/trans/text/thetait` := TEXT (
`HELP FOR: The iterated theta algorithm of order 2`,
`   `,
`CALLING SEQUENCE:`,
`   `,
`thetait  (s_n, n, arr)`,
`thetaithf (s_n, n, arr)`,
`   `,
`PARAMETERS`,
`   `,
`s_n   - element of the sequence `,
`n     - number of the last sequence element`,
`arr   - array (0 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`   `,
`SYNOPSIS:`,
`   `,
`- The elements s_n with n = 0, 1, 2, ... of the sequence to be`,
`  transformed have be read in successively, starting with s_0.`,
`- The procedure thetaithf may be invoked to use the hardware floating`,
`  point system.`,
`   `,
`EXAMPLE:`,
`   `,
`# Evaluation of the logarithmic convergent series for`,
`# the lemniscate constant`,
`#`,
`with(trans):`,                                                                    
`Digits := 16:`,                                                                   
`arr0  := array (0 .. 20):`,                                                          
`arr1  := array (0 .. 20):`,                                                          
`sum0  := 0:`,                                                                      
`term0 := 1:`,                                                                     
`term  := 1:`,                                                                      
`printlevel := 0:`,                                                               
`for i from 0 to 16 do`,                                                            
`   if i >= 1 then`,                                                               
`      term0 := term0 * (2 * i - 1) / (2 * i):`,                                   
`      term  := term0 / (4 * i + 1)`,                                               
`   fi:`,                                                                          
`   sum0 := sum0 + term:`,                                                         
`   app [1] := i:`,
`   app [2] := evalf (sum0):`,
`   app [3] := evalf (thetait (sum0, i, arr0)):`,
`   app [4] := thetaithf (sum0, i, arr1):`,
`   if i >= 10 then`,                                                               
`      printlevel := 1`,                                                           
`   fi:`,                                                                          
`   app[m] $ m = 1 .. 4;`,                                                         
`   printlevel := 0`,                                                             
`od;`,                                                                             
`    `,
`            10, 1.225016204786238, 1.311028771841582, 1.311028770038779`,
`   `,
`            11, 1.228753718010522, 1.311028775087538, 1.311028770945963`,
`   `,
`            12, 1.232043111026792, 1.311028777134897, 1.311028770515077`,
`   `,
`            13, 1.234967281160994, 1.311028777142468, 1.311028769540489`,
`   `,
`            14, 1.237589140473052, 1.311028777144742, 1.311028783165459`,
`   `,
`            15, 1.239957410113943, 1.311028777146056, 1.311028769961395`,
`   `,
`            16, 1.242110486023042, 1.311028777146059, 1.311028898004512`,
`   `,
`Comparison:`,
`    `,
`evalf (GAMMA (1/4) ** 2 / (4*(2*Pi)^(1/2)));`,
`    `,                                   
`                                 1.311028777146059`
):
#
`help/trans/text/theta` := TEXT (
`HELP FOR: The theta algorithm`,
`   `,
`CALLING SEQUENCE:`,
`   `,
`theta  (s_n, n, arr1, arr2)`,
`thetahf (s_n, n, arr1, arr2)`,
`   `,
`PARAMETERS`,
`   `,
`s_n   - element of the sequence `,
`n     - number of the last sequence element`,
`arr1  - array (0 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`arr2  - another array (0 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`   `,
`SYNOPSIS:`,
`   `,
`- The elements s_n with n = 0, 1, 2, ... of the sequence to be`,
`  transformed have be read in successively, starting with s_0.`,
`- The procedure thetahf may be invoked to use the hardware floating`,
`  point system.`,
`   `,
`EXAMPLE:`,
`   `,
`with (trans):`,
`# Acceleration of the logarithmic convergent series expansion`,
`# for the Riemann Zeta function at z = 2`,
`#`,
`sum0  := 0:`,
`arr1 := array(-1 .. 20):`,
`arr2 := array(-1 .. 20):`,
`arr3 := array(-1 .. 20):`,
`arr4 := array(-1 .. 20):`,
`Digits := 16:`,
`printlevel := 0:`,
`for i from 0 to 18 do`,
`   term0 := 1 / (1 + i) ** 2:`,
`   sum0  := sum0 + term0:`,
`   app[1] := i:`,
`   app[2] := evalf (sum0):`,
`   app[3] := evalf (theta (sum0, i, arr1, arr2)):`,
`   app[4] := thetahf (sum0, i, arr3, arr4):`,
`   if i >= 12 then`,
`      printlevel := 1`,
`   fi;`,
`   app[m] $ m = 1 .. 4;`,
`   printlevel := 0`,
`od;`,
`   `,
`            12, 1.570893798184216, 1.644934066835620, 1.644934067639212`,
`   `,
`            13, 1.575995839000543, 1.644934066844397, 1.644934067645051`,
`   `,
`            14, 1.580440283444987, 1.644934066846830, 1.644934067661326`,
`   `,
`            15, 1.584346533444987, 1.644934066848300, 1.644934067643393`,
`   `,
`            16, 1.587806741057444, 1.644934066848237, 1.644934067596188`,
`   `,
`            17, 1.590893160810530, 1.644934066848227, 1.644934067680783`,
`   `,
`            18, 1.593663243913023, 1.644934066848226, 1.644934067622190`,
`   `,
`#Comparison:`,
`   `,
`> evalf (Zeta(2));`,
`                                 1.644934066848226`
):
#
`help/trans/text/rho` := TEXT (
`HELP FOR: The rho algorithm`,
`   `,
`CALLING SEQUENCE:`,
`   `,
`rho  (s_n, x_n, n, arr1, arr2)`,
`rhohf (s_n, x_n, n, arr1, arr2)`,
`   `,
`PARAMETERS`,
`   `,
`s_n   - element of the sequence `,
`x_n   - element of the auxiliary sequence`,
`n     - number of the last sequence element`,
`arr1  - array (0 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`arr2  - another array (0 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`   `,
`SYNOPSIS:`,
`   `,
`- The elements s_n with n = 0, 1, 2, ... of the sequence to be`,
`  transformed have be read in successively, starting with s_0.`,
`- The procedure rhohf may be invoked to use the hardware floating`,
`  point system.`,
`   `,
`EXAMPLE:`,
`   `,
`# Evaluation of the logarithmic convergent series`, 
`# sum ((1/2)_m / (m+1)!, m = 0 .. infinity) = 1,`, 
`# where (1/2)_m = (1/2)*(1/2+1)* ... *(1/2+m-1)`,
`#`,
`with(trans):`,                                                                    
`Digits := 32:`,                                                                   
`arr0  := array (0..30):`,                                                          
`arr1  := array (0..30):`,                                                          
`arr2  := array (0..30):`,                                                          
`arr3  := array (0..30):`,                                                          
`sum0  := 0:`,                                                                      
`term  := 1/2:`,                                                                      
`printlevel := 0:`,                                                               
`for i from 0 to 22 do`,                                                            
`   if i >= 1 then`,                                                               
`      term := term * (1/2 + i - 1) / (i + 1):`,                                   
`   fi:`,                                                                          
`   sum0 := sum0 + term:`,                                                         
`   app [1] := i:`,
`   app [2] := evalf (sum0, 16):`,
`   app [3] := evalf (rho (sum0, evalf( sqrt(1 + i)), i, arr0,  arr1), 16):`,
`   app [4] := rhohf (sum0, sqrt(1 + i) ,i , arr2, arr3):`,       
`   if i >= 16 then`,                                                               
`      printlevel := 1`,                                                           
`   fi:`,                                                                          
`   app[m] $ m = 1 .. 4;`,                                                         
`   printlevel := 0`,                                                             
`od;`,                                                                             
`   `,
`            16, .8641662404406816, 1.000000000061395, .9999999990400201`,
`   `,
`            17, .8679394004284404, 1.000000000010533, .9999999921709852`,
`   `,
`            18, .8714146793645341, .9999999999996657, .9999999449980014`,
`   `,
`            19, .8746293123804207, 1.000000000000018, .9999999923249799`,
`   `,
`            20, .8776143287523155, 1.000000000000053, .9999999981738057`,
`   `,
`            21, .8803958212806720, 1.000000000000034, 1.000000006280654`,
`   `,
`            22, .8829959121223965, 1.000000000000001, .9999999984028170`
):
#
`help/trans/text/rhoit` := TEXT (
`HELP FOR: The iterated rho algorithm of order 2`,
`   `,
`CALLING SEQUENCE:`,
`   `,
`rhoit  (s_n, x_n, n, arr1, arr2)`,
`rhoithf (s_n, x_n, n, arr1, arr2)`,
`   `,
`PARAMETERS`,
`   `,
`s_n   - element of the sequence `,
`x_n   - element of the auxiliary sequence`,
`n     - number of the last sequence element`,
`arr1  - array (0 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`arr2  - another array (0 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`   `,
`SYNOPSIS:`,
`   `,
`- The elements s_n with n = 0, 1, 2, ... of the sequence to be`,
`  transformed have be read in successively, starting with s_0.`,
`- The procedure rhoithf may be invoked to use the hardware floating`,
`  point system.`,
`   `,
`EXAMPLE:`,
`   `,
`# Evaluation of the logarithmic convergent series`, 
`# sum ((1/2)_m / (m+1)!, m = 0 .. infinity) = 1,`, 
`# where (1/2)_m = (1/2)*(1/2+1)* ... *(1/2+m-1)`,
`#`,
`with(trans):`,                                                                    
`Digits := 32:`,                                                                   
`arr0  := array (0..30):`,                                                          
`arr1  := array (0..30):`,                                                          
`arr2  := array (0..30):`,                                                          
`arr3  := array (0..30):`,                                                          
`sum0  := 0:`,                                                                      
`term  := 1/2:`,                                                                      
`printlevel := 0:`,                                                               
`for i from 0 to 28 do`,                                                            
`   if i >= 1 then`,                                                               
`      term := term * (1/2 + i - 1) / (i + 1):`,                                   
`   fi:`,                                                                          
`   sum0 := sum0 + term:`,                                                         
`   app [1] := i:`,                                                             
`   app [2] := evalf (sum0, 16):`,
`   app [3] := evalf (rhoit (sum0, evalf (sqrt(1 + i)), i, arr0,  arr1), 16):`,
`   app [4] := rhoithf (sum0, sqrt(1 + i) ,i , arr2, arr3):`,       
`   if i >= 22 then`,                                                               
`      printlevel := 1`,                                                           
`   fi:`,                                                                          
`   app[m] $ m = 1 .. 4;`,                                                         
`   printlevel := 0`,                                                             
`od;`,                                                                             
`   `,
`            22, .8829959121223965, 1.000000000002646, 1.000000038877647`,
`    `,
`            23, .8854334972865132, .9999999999992899, .9999999274150462`,
`    `,
`            24, .8877248273407830, .9999999999990417, .9999999272692581`,
`    `,
`            25, .8898839652765371, .9999999999992648, .9999999273311515`,
`    `,
`            26, .8919231511047494, .9999999999989741, .9999999273133531`,
`    `,
`            27, .8938530948350217, 1.000000000000231, .9999999273243236`,
`    `,
`            28, .8956832138895903, 1.000000000000227, .9999999273173647`
):
#
`help/trans/text/rich` := TEXT (
`HELP FOR: The Richardson extrapolation algorithm`,
`   `,
`CALLING SEQUENCE:`,
`   `,
`rich  (s_n, x_n, n, arr1, arr2)`,
`richhf (s_n, x_n, n, arr1, arr2)`,
`   `,
`PARAMETERS`,
`   `,
`s_n   - element of the sequence `,
`x_n   - element of the auxiliary sequence`,
`n     - number of the last sequence element`,
`arr1  - array (0 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`arr2  - another  array (0 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`   `,
`SYNOPSIS:`,
`   `,
`- The elements s_n with n = 0, 1, 2, ... of the sequence to be`,
`  transformed have be read in successively, starting with s_0.`,
`- The procedur richhf may be invoked to use the hardware floating`,
`  point system.`,
`   `,
`EXAMPLE:`,
`   `,
`# Evaluation of the logarithmic convergent series for`,
`# the lemniscate constant`,
`#`,
`with(trans):`,                                                                    
`Digits := 64:`,                                                                   
`arr0  := array (0..30):`,                                                          
`arr1  := array (0..30):`,                                                          
`arr2  := array (0..30):`,                                                          
`arr3  := array (0..30):`,                                                          
`sum0  := 0:`,                                                                      
`term0 := 1:`,                                                                     
`term  := 1:`,                                                                      
`printlevel := 0:`,                                                               
`for i from 0 to 30 do`,                                                            
`   if i >= 1 then`,                                                               
`      term0 := term0 * (2 * i - 1) / (2 * i):`,                                   
`      term  := term0 / (4 * i + 1)`,                                               
`   fi:`,                                                                          
`   sum0 := sum0 + term:`,                                                         
`   app [1] := i:`,
`   app [2] := evalf (sum0, 16):`,
`   app [3] := evalf (rich (sum0, evalf (1/sqrt (i + 1)), i, arr0, arr1), 16):`,
`   app [4] := richhf (sum0, 1/sqrt (i + 1), i, arr2, arr3):`,
`   if i >= 25 then`,                                                               
`      printlevel := 1`,                                                           
`   fi:`,                                                                          
`   app[m] $ m = 1 .. 4;`,                                                         
`   printlevel := 0`,                                                             
`od;`,
`   `,
`         25, 1.255440406453036, 1.311028777146109,  -960.5692209593385`,
`   `,
`         26, 1.256489130593259, 1.311028777146053,  -1184.448344185356`,
`   `,
`         27, 1.257480661317069, 1.311028777146056,   39081.21854422915`,
`   `,
`         28, 1.258420014460122, 1.311028777146061,  -323896.8388921543`,
`   `,
`                                                                        7`,
`         29, 1.259311610922604, 1.311028777146060,  .1846881499128207*10`,
`   `,
`                                                                        7`,
`         30, 1.260159364418542, 1.311028777146060, -.7907845631543007*10`,
`   `,
`#Comparison:`,
`   `,
`> evalf (GAMMA (1/4) ** 2 / (4*(2*Pi) **(1/2)));`,
`   `,
`                                 1.311028777146059`
):
#
`help/trans/text/gb` := TEXT (
`HELP FOR: The transformation of Germain-Bonne`,
`   `,
`CALLING SEQUENCE:`,
`   `,
`gb  (s_n, a_n, n, arr1, arr2)`,
`gbhf (s_n, a_n, n, arr1, arr2)`,
`   `,
`PARAMETERS`,
`   `,
`s_n   - element of the sequence `,
`a_n   - difference a_n = s_n - s_{n-1}`,
`n     - number of the last sequence element`,
`arr1  - array (0 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`arr2  - another array (0 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`   `,
`SYNOPSIS:`,
`   `,
`- The elements s_n with n = 0, 1, 2, ... of the sequence to be`,
`  transformed have be read in successively, starting with s_0.`,
`- The procedure gbhf may be invoked to use the hardware floating`,
`  point system.`,
`   `,
`EXAMPLE:`,
`   `,
`# Evaluation of the convergent sequence s_{i+1} = exp (- s_{i}),`,
`# s_{0} = 0.`,
`#`,
`with(trans):`,                                                                    
`Digits := 16:`,                                                                   
`arr0  := array (0..30):`,                                                          
`arr1  := array (0..30):`,                                                          
`arr2  := array (0..30):`,                                                          
`arr3  := array (0..30):`,                                                          
`term0 := 0:`,
`term1 := 0:`,                                                                     
`printlevel := 0:`,                                                               
`for i from 0 to 10 do`,                                                            
`   term1 := exp (-term0):`,                                   
`   app [1] := i:`,
`   app [2] := evalf (term1):`,
`   app [3] := evalf (gb (term1, evalf (term1 - term0), i, arr0, arr1)):`,
`   app [4] := gbhf (term1, term1 - term0, i, arr2, arr3):`,
`   term0   := term1:`,
`   if i >= 4 then`,                                                               
`      printlevel := 1`,                                                           
`   fi:`,                                                                          
`   app[m] $ m = 1 .. 4;`,                                                         
`   printlevel := 0`,                                                             
`od;`,
`   `,                                                                             
`            4, .6062435350855974, .5671503876193775, .5671503876193773`,
`   `,
`            5, .5453957859750270, .5671432389174803, .5671432389174803`,
`   `,
`            6, .5796123355033788, .5671432908868726, .5671432908868727`,
`   `,
`            7, .5601154613610892, .5671432904066679, .5671432904066680`,
`   `,
`            8, .5711431150801770, .5671432904097847, .5671432904097848`,
`   `,
`            9, .5648793473910495, .5671432904097838, .5671432904097840`,
`   `,
`           10, .5684287250290607, .5671432904097832, .5671432904097840`
):
#
`help/trans/text/lev` := TEXT (
`HELP FOR: The Levin transformation`,
`   `,
`CALLING SEQUENCE:`,
`   `,
`lev  (s_n, a_n, n, arr1, arr2, typ)`,
`levhf (s_n, a_n, n, arr1, arr2, typ)`,
`   `,
`PARAMETERS`,
`   `,
`s_n   - element of the sequence `,
`a_n   - term a_n = s_n - s_{n-1} of a series`,
`n     - number of the last sequence element`,
`arr1  - array (-1 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`arr2  - another array (-1 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`typ   - type of transformation: u, t, d, v`,
`   `,
`SYNOPSIS:`,
`   `,
`- The elements s_n with n = 0, 1, 2, ... of the sequence to be`,
`  transformed have be read in successively, starting with s_0.`,
`- The procedure levhf may be invoked to use the hardware floating`,
`  point system.`,
`   `,
`EXAMPLE:`,
`   `,
`with (trans):`,
`# Acceleration of the logarithmic convergent series expansion`,
`# for the Riemann Zeta function at z = 2`,
`#`,
`sum0  := 0:`,
`arr1 := array(-1 .. 20):`,
`arr2 := array(-1 .. 20):`,
`arr3 := array(-1 .. 20):`,
`arr4 := array(-1 .. 20):`,
`Digits := 16:`,
`printlevel := 0:`,
`for i from 0 to 18 do`,
`   term0 := 1 / (1 + i) ** 2:`,
`   sum0  := sum0 + term0:`,
`   app[1] := i:`,
`   app[2] := evalf (sum0):`,
`   app[3] := evalf (lev (sum0, term0, i, arr1, arr2, u)):`,
`   app[4] := levhf (sum0, term0, i, arr3, arr4, u):`,
`   if i >= 12 then`,
`      printlevel := 1`,
`   fi;`,
`   app[m] $ m = 1 .. 4;`,
`   printlevel := 0`,
`od;`,
`   `,
`            12, 1.570893798184216, 1.644934066847177, 1.644934066834372`,
`   `,
`            13, 1.575995839000543, 1.644934066847631, 1.644934066809508`,
`   `,
`            14, 1.580440283444987, 1.644934066848187, 1.644934067091964`,
`   `,
`            15, 1.584346533444987, 1.644934066848231, 1.644934067341459`,
`   `,
`            16, 1.587806741057444, 1.644934066848227, 1.644934058323074`,
`   `,
`            17, 1.590893160810530, 1.644934066848226, 1.644934108727477`,
`   `,
`            18, 1.593663243913023, 1.644934066848226, 1.644933932643541`,
`   `,
`#Comparison:`,
`   `,
`> evalf (Zeta(2));`,
`                                 1.644934066848226`
):
#
`help/trans/text/sidi` := TEXT (
`HELP FOR: The Sidi transformation`,
`   `,
`CALLING SEQUENCE:`,
`   `,
`sidi  (s_n, a_n, n, arr1, arr2, typ)`,
`sidihf (s_n, a_n, n, arr1, arr2, typ)`,
`   `,
`PARAMETERS`,
`   `,
`s_n   - element of the sequence `,
`a_n   - term a_n = s_n - s_{n-1} of a series`,
`n     - number of the last sequence element`,
`arr1  - array (-1 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`arr2  - another array (-1 .. nmax) to store intermediate`,
`        elements of the transformation table`,
`typ   - type of transformation: u, t, d, v`,
`   `,
`SYNOPSIS:`,
`   `,
`- The elements s_n with n = 0, 1, 2, ... of the sequence to be`,
`  transformed have be read in successively, starting with s_0.`,
`- The procedure sidihf may be invoked to use the hardware floating`,
`  point system.`,
`   `,
`EXAMPLE:`,
`   `,
`with(trans):`, 
`# Summation of the divergent Euler series,`,
`# alternating n! series`,
`#`,                                                                   
`Digits := 16:`,                                                                   
`arr0 := array (-1..30):`,                                                          
`arr1 := array (-1..30):`,                                                          
`arr2 := array (-1..30):`,                                                          
`arr3 := array (-1..30):`,                                                          
`sum0 := 0:`,                                                                      
`printlevel := 0:`,                                                               
`for i from 0 to 29 do`,
`   term0   := (-1) ^ i * i!:`,                                                       
`   sum0    := sum0 + term0:`,                                                         
`   app [1] := i:`,
`   app [2] := evalf (sum0):`,                                     
`   app [3] := evalf (sidi (sum0, term0, i, arr0, arr1, d)):`,                      
`   app [4] := sidihf (sum0, term0, i, arr2, arr3, d):`,                    
`   if i >= 23 then`,                                                               
`      printlevel := 1`,                                                           
`   fi:`,                                                                          
`   app [m] $ m = 1 .. 4;`,                                                         
`   printlevel := 0:`,                                                             
`od;`, 
`   `,
`                                  23`,
`         23, -.2477678962998852*10  , .5963473623231885, .5963473624247936`,
`  `,
`                                  24`,
`         24,  .5956716121032509*10  , .5963473623231899, .5963473625137528`,
`   `,
`                                  26`,
`         25, -.1491553843122774*10  , .5963473623231924, .5963473622882467`,
`   `,
`                                  27`,
`         26,  .3883759226953779*10  , .5963473623231936, .5963473597424967`,
`   `,
`                                  29`,
`         27, -.1050049352772297*10  , .5963473623231940, .5963473472547150`,
`   `,
`                                  30`,
`         28,  .2943878510839909*10  , .5963473623231941, .5963473053673139`,
`   `,
`                                  31`,
`         29, -.8547374142655711*10  , .5963473623231941, .5963472184698268`,
`   `,
`#Comparison:`,
`   `,
`> int(exp(-t)/(1+t), t=0 .. infinity);`,
`   `,
`                                  - exp(1) Ei(-1)`,
`   `,
`> evalf (");`,
`                                 .5963473623231941`
):
#
`help/trans/text/ratser` := TEXT (
`HELP FOR: ratser - convert a series to a symbolic rational approximant`,
`   `,
`CALLING SEQUENCE:`,
`   `,
`ratser  (<series>, options)`,
`   `,
`PARAMETERS:`,
`   `,
`<series>  - series expansion with data type "series"`,
`            (has to be the first parameter)`,
`   `,
`OPTIONAL PARAMETERS:`,
`   `,
`typ       - type of transformation`,
`norder    - order of transformation (default: number of terms)`,
`expts     - list with expansion points of data type real constant`,
`            for segmented approximation (default: [ ], empty list)`,
`switch    - switch for the generation of a FORTRAN function:`,
`            fort or nofort (default: nofort)`,
`precision - type of the FORTRAN function: single or double`,
`            (default: single)`,
`evalorder - computational form for the rational function:`,
`            horner or confrac (default: horner)`,
`fn        - filename for the FORTRAN function program. (default: ````)`,
`   `,
`The formal input parameter typ (type of transformation)`,
`can have one of the following values:`,
`   `,
`u     - u transformation`,
`t     - t transformation`,
`d     - d transformation`,
`v     - v transformation`,
`su    - su transformation`,
`st    - st transformation`,
`sd    - sd transformation`,
`sv    - sv transformation`,
`sh    - Shanks transformation`,
`gb    - Germain-Bonne transformation`,
`rh    - rho transformation`,
`rhit  - iterated rho_2 transformation`,
`r     - Richardson extrapolation process`,
`th    - theta algorithm`,
`thit  - iterated theta_2 algorithm`,
`at    - iterated Aitken transformation`,
`   `,
`- In case of the Richardson extrapolation (r), rho transformation (rh)`,
`  or iterated rho_2 transformation (rhit) the user can specify a list`,
`  of auxiliary parameters x_n, (default: x_n = 1/(n+1) for the`,
`  Richardson extrapolation process and x_n = n+1 for the rho`,
`  transformation and the iterated rho_2 transformation). Then the`,
`  first element in the list characterizes the type of the`,
`  transformation, i.e. it must be equal to r, rh or rhit.`,
`   `,
`EXAMPLES:`,
`   `,
`with (trans):`,
`   `,
`> a1 := series(GAMMA(x), x = x0, 3);`, 
`   `,
` a1 := GAMMA(x0) + Psi(x0) GAMMA(x0) (x - x0)`,
`   `,
`                                               2                    2`,
`      + (1/2 Psi(1, x0) GAMMA(x0) + 1/2 Psi(x0)  GAMMA(x0)) (x - x0)`,
`   `,
`                  3`,
`      + O((x - x0) )`,
`   `,
`> a2 := ratser (a1, sh, horner);`,
`   `,
`                                                            2`,
`a2 := (- 2 Psi(x0) GAMMA(x0)+(- Psi(1, x0) GAMMA(x0)+Psi(x0)  GAMMA(x0)) x0`,
`   `,
`                                      2`,
`     + (Psi(1, x0) GAMMA(x0) - Psi(x0)  GAMMA(x0)) x)`,
`   `,
`       /                                     2                          2`,
`      /  (- 2 Psi(x0)+(- Psi(1, x0) - Psi(x0) ) x0 + (Psi(1, x0)+Psi(x0) ) x)`,
`     /`,
`   `,
`> ratser (a1, sh, fort, horner, double, [1,2,3]);`,
`   `,
`      function shtr (x)`,
`      double precision shtr, x`,
`      if (x .le. 150.D-2) then`, 
`      shtr = (-0.157324813237442D0+0.1311756143040508D1*x)/(-0.823680660`,
`     #8528794D0+0.1978111990655945D1*x)`,
`      elseif (x .gt. 150.D-2 .and. x .le. 250.D-2) then`,
`      shtr = (-0.1777943615884081D1+0.4661874728435735D0*x)/(-0.24929299`,
`     #91902693D1+0.8236806608528794D0*x)`,
`      elseif (x .gt. 250.D-2) then`, 
`      shtr = (-0.9515561668645066D0-0.9131937245097873D0*x)/(-0.55849636`,
`     #58050974D1+0.1246464995951347D1*x)`,
`      end if`,
`      end`
):
#
`help/trans/text/ratgen` := TEXT (
`HELP FOR: ratgen - convert a generalized series to a symbolic rational`,
`                   approximant`,
`   `,
`CALLING SEQUENCE:`,
`   `,
`ratgen  (<series>, options)`,
`   `,
`PARAMETERS:`,
`   `,
`<series>  - generalized series with data type ``+```,
`            (has to be the first parameter)`,
`   `,
`OPTIONAL PARAMETERS:`,
`   `,
`typ       - type of transformation`,
`norder    - order of transformation (default: number of terms)`,
`switch    - switch for the generation of a FORTRAN function:`,
`            fort or nofort (default: nofort)`,
`precision - type of the FORTRAN function: single or double`,
`            (default: single)`,
`evalorder - computational form for the rational function:`,
`            horner (default: ````)`,
`fn        - filename for the FORTRAN function program (default:````)`,
`   `,
`The formal input parameter typ (type of transformation)`,
`can have one of the following values:`,
`   `,
`u     - u transformation`,
`t     - t transformation`,
`d     - d transformation`,
`v     - v transformation`,
`su    - su transformation`,
`st    - st transformation`,
`sd    - sd transformation`,
`sv    - sv transformation`,
`sh    - Shanks transformation`,
`gb    - Germain-Bonne transformation`,
`rh    - rho transformation`,
`rhit  - iterated rho_2 transformation`,
`r     - Richardson extrapolation process`,
`th    - theta algorithm`,
`thit  - iterated theta_2 algorithm`,
`at    - iterated Aitken transformation`,
`   `,
`- In case of the Richardson extrapolation (r), rho transformation (rh)`,
`  or iterated rho_2 transformation (rhit) the user can specify a list`,
`  of auxiliary parameters x_n, (default: x_n = 1/(n+1) for the`,
`  Richardson extrapolation process and x_n = n+1 for the rho`,
`  transformation and the iterated rho_2 transformation). Then the`,
`  first element in the list characterizes the type of the`,
`  transformation, i.e. it must be equal to r, rh or rhit.`,
`   `,
`EXAMPLES:`,
`   `,
`with (trans):`,
`   `,
`> a3 := series (sqrt(sin(x)), x, 8);`,
`   `,
`               1/2         5/2           9/2            13/2      15/2`,
`        a3 := x    - 1/12 x    + 1/1440 x    - 1/24192 x     + O(x    )`,
`   `,
`> ratgen (a3, [rh, 1, 6, 9, 16]);`,
`   `,
`                       1/2          5/2         9/2       13/2`,
`               846720 x    - 34560 x    - 2412 x    - 35 x     `,
`               -----------------------------------------------`,
`                                              2 `,
`                              846720 + 36000 x `,
`   `,
`> a4 := asympt (Psi (2*exp(x))-x, x, 4);`,
`   `,
`                                  1           1            1`,
`                a4 := ln(2) - -------- - ---------- + O(-------)`,
`                              4 exp(x)            2           4`,
`                                         48 exp(x)      exp(x)`,
`   `,
`> ratgen (a4, th);`,
`   `,
`                                         2`,
`                          48 ln(2) exp(x)  - 12 exp(x) - 1`,
`                     1/48 --------------------------------`,
`                                             2`
):
#
# Aliases for help files
#
`help/trans/text/aitkenhf`   := `help/trans/text/aitken`:
`help/trans/text/epshf`      := `help/trans/text/eps`:
`help/trans/text/thetaithf`  := `help/trans/text/thetait`:
`help/trans/text/thetahf`    := `help/trans/text/theta`:
`help/trans/text/rhohf`      := `help/trans/text/rho`:
`help/trans/text/rhoithf`    := `help/trans/text/rhoit`:
`help/trans/text/richhf`     := `help/trans/text/rich`:
`help/trans/text/gbhf`       := `help/trans/text/gb`:
`help/trans/text/levhf`      := `help/trans/text/lev`:
`help/trans/text/sidihf`     := `help/trans/text/sidi`:
`help/trans/text/ratserhf`   := `help/trans/text/ratser`:
`help/trans/text/ratgenhf`   := `help/trans/text/ratgen`:

#save
#`trans/thetait`, `trans/ratser`, `trans/rich_sym`, `trans/aitken_sym`, 
#`help/text/trans`, `trans/rho`, trans, `trans/theta`, `trans/rho_sym`, 
#`trans/sidi_sym`, `trans/my_fort`, `trans/ratgen`, `trans/series_transform`, 
#`trans/rhoit_sym`, `trans/lev_sym`, `trans/rich`, 
#`trans/rhoit`, `trans/aitken`, `trans/thetait_sym`, `trans/gb`, `trans/gb_sym`
#, `trans/eps_sym`, `trans/eps`, `trans/theta_sym`, `trans/fortran_header`, 
#`trans/lev`, `trans/sidi`,
#`help/trans/text/eps`, `help/trans/text/rhoithf`, 
#`help/trans/text/aitkenhf`, `help/trans/text/ratgen`, `help/trans/text/theta`, 
#`help/trans/text/lev`, `help/trans/text/thetait`, `help/trans/text/aitken`, 
#`help/trans/text/ratserhf`, `help/trans/text/thetahf`, `help/trans/text/richhf`
#, `help/trans/text/rhoit`, `help/trans/text/thetaithf`, `help/text/trans`
#, `help/trans/text/rich`, `help/trans/text/rhohf`, `help/trans/text/rho`, 
#`help/trans/text/gbhf`, `help/trans/text/gb`, `help/trans/text/levhf`, 
#`help/trans/text/ratgenhf`, `help/trans/text/sidihf`, `help/trans/text/ratser`
#, `help/trans/text/epshf`, `help/trans/text/sidi`,
#`trans.m`; 
#quit
