MatPade :=
`See ?SigmaBases, ?HermitePade, ?PHPA, ?SimultaneousPade, `
. `?RightMatrixPade, ?LeftMatrixPade, ?Pade`:

SigmaBases := proc(F,z,n,s,Sigma)

# Input:
# ---- F:  an m x 1  matrix of formal power series
# ---- z:  variable of the vector of power series 
# ---- n:  a vector of integers 
# ---- s:  an integer
#
# Output:
# An m-by-m matrix polynomial P. The rows of P provide a basis for 
# L^Sigma
#
# Method:
# Uses the algorithm of Beckermann and Labahn (1991) 
# (to appear in SIAM J. of Matrix Analysis (1993)
#

  local lambda,sigma,l,m,FF,d,i,c,P,pi,d_pi,j;

# Initialization

  sigma := 0; 
  if type(F,matrix) then
     m := linalg[rowdim](F);
     for l from 1 to m do
        FF[l] := convert(series(F[l,1],z,Sigma+1),polynom);
     od;
  elif type(F,list) then
     m := nops(F);
     FF := [seq(convert(series(F[l],z,Sigma+1),polynom),l=1..m)];
  elif type(F,vector) then
     m := linalg[vecdim](F);
     FF := [seq(convert(series(F[l],z,Sigma+1),polynom),l=1..m)];
  fi;

  d:= linalg[vector](m);
  for i from 1 to m do
    d[i] := n[i] + 1;
  od;

  P := linalg[matrix](m,m,proc(i,j) if i<>j then 0 else 1 fi end );

# Recursive Step

  while sigma < Sigma do
     lambda := NULL; 

     for l from 1 to m do
        c[l] :=expand(convert([seq(subs(z = z^s,P[l,j])*FF[j],j=1..m)] , `+`));
        c[l] := coeff(expand(c[l]/z^sigma),z,0);
        if  c[l] <> 0 then 
          lambda := lambda,l; 
        fi;
     od;
     # Make lambda into a set
     lambda := {lambda};

# Case Lamda sub sigma = {}

     if lambda = {} then 
        sigma := sigma + 1;

# Case Lamda sub sigma <> {}

     else
        pi := lambda[1];
        d_pi := d[pi];
        for l in lambda  do
          if d[l] > d_pi then d_pi := d[l]; pi := l; fi; 
        od;

        for l in lambda do
          if l <> pi then
              P := linalg[addrow](P,pi,l,-normal(c[l]/c[pi])):
          fi;
        od;
        P := linalg[mulrow](P,pi,z);
        P:= map(normal,P);
        d[pi] := d[pi] - 1; 
        sigma := sigma + 1;
     fi;

# Output
  
   od;
   eval(P);
end:

PHPA := proc( f , z, n ,s, sigma)
  local F, P, x, m, i, sols,j,alpha, dct, poly;

  F := map(series,f,z,sigma+1);
  m := nops(F);
  F := linalg[matrix](m,1,F);
  if type(z,`=`) then
    x := op(1,z);
    F := map(proc(m,i,j) subs(i=j,m) end,eval(F),x,x+op(2,z));
    F := map(normal,eval(F));
  else 
    x := z;
  fi;
  
  if nargs = 6 then sols:= false 
  else sols := true; fi;

  P := SigmaBases(F,x,n,s,sigma);
  for i from 1 to m do
     dct[i] := min(seq(n[j]+1-degree(P[i,j],x),j=1..m));
     if sols then
       if dct[i] > 0 then poly[i] := 1 else poly[i] := 0 fi;
     else
       poly[i]:= convert( [ seq( _c(i,j)*x^j , j=0..dct[i]-1)],`+`);
     fi;
  od;
  alpha := linalg[matrix](1,m,[seq(poly[i],i=1..m)]);
  P := map(expand,evalm( alpha &* P ));
  P := map(sort,eval(P),x);
  P := map(collect,eval(P),x);
  if type(z,`=`) then 
    subs( op(1,z) = op(1,z) - op(2,z),[seq(P[1,i],i=1..m)]);
  else
    [seq(P[1,i],i=1..m)];
  fi;

end:

HermitePade := proc( f , z, n )
  local Sigma;
  Sigma := convert(n,`+`) + nops(f) - 1;
  PHPA(f, z, n, 1, Sigma, args[4..nargs]);
end:

SimultaneousPade := proc( f , z, n)
  local F, Sigma, P, j,N, alpha, dct, i, mu, sols, x, poly;

  Sigma := convert(n,`+`);
  F := map(series,f,z,Sigma+1);
  mu := nops(F);

  if type(z,`=`) then
    x := op(1,z);
    F := map(proc(x,i,j) subs(i=j,x) end, F,x,x+op(2,z)); 
  else x := z;
  fi;

  if nargs = 4 then sols:= false 
  else sols := true; fi;

  F :=  linalg[matrix](mu+1,1,
                      [- convert([seq(x^(j-1)*subs(x=x^mu,F[j]),j=1..mu)],`+`),
                         seq(x^(j-1),j=1..mu)]);
  N := [seq( Sigma - n[i],i=1..mu+1)]; 
  P := SigmaBases(F,x,N,mu,mu*(Sigma+1));
  for i from 1 to mu+1 do
     dct[i] := min(seq(N[j] + 1 -degree(P[i,j],x),j=1..mu+1));
     if sols then
       if dct[i] > 0 then poly[i]:= 1 else poly[i]:= 0 fi;
     else
       poly[i]:= convert( [ seq( _c(i,j)*x^j , j=0..dct[i]-1)],`+`);
     fi;
  od;
  alpha := linalg[matrix](1,mu+1,[seq(poly[i],i=1..mu+1)]);
  P := map(expand,evalm( alpha &* P ));
  P := map(sort,eval(P),x);
  P := map(collect,eval(P),x);
  if type(z,`=`) then 
    subs( op(1,z) = op(1,z) - op(2,z),[seq(P[1,i],i=1..mu+1)]);
  else
    [seq(P[1,i],i=1..mu+1)];
  fi;

end:

RightMatrixPade := proc( f , z, n )
  local F, Sigma, P, r, sols, j, k, N, Q, a, coeffslist,
      dct, den, i, num, p, q, seqlist, x, poly;

  Sigma := convert(n,`+`);
  F := map(series,evalm(f),z,Sigma+1);
  p := linalg[rowdim](F);
  q := linalg[coldim](F);

  if nargs >= 4 and type(args[4],integer) then 
       r := args[4];
       if nargs = 5 then sols := false; 
       else sols := true; fi;
  elif nargs = 4 then sols := false; r := q;
  else r := q; sols := true; 
  fi;

  if type(z,`=`) then
    x := op(1,z);
    F := map(proc(r,i,j) subs(i=j,r) end,eval(F),x,x+op(2,z)); 
  else x := z; 
  fi;

  F := evalm(linalg[matrix](1,p,[seq(x^j,j=0..p-1)]) &*
             linalg[augment]( 
                  linalg[matrix](p,p,proc(i,j) if i=j then 1 else 0 fi end),
                  evalm(- subs(x = x^p,eval(F) ) )));
  F := linalg[transpose](map(series,eval(F),x,p*(Sigma+1)));
  F := map(convert,eval(F),polynom);

  N := [seq(n[1],i=1..p),seq(n[2],i=1..q)]; 
  P := SigmaBases(F,x,N,p,p*(n[1] + n[2] +1));
  
  seqlist:= NULL;
  for i from 1 to p + q  do
     dct[i] := min(seq(N[j] + 1 - degree(P[i,j],x),j=1..p+q));
     if sols then
       if dct[i] > 0 then 
          poly[i] := linalg[matrix](1,r,[seq( convert(
                [seq(_c(i,j)*x^j,j=0..dct[i]-1)],`+`),k=1..r)]); 
          seqlist:= seqlist,[seq(_c(i,j)=0,j=0..dct[i]-1)]; 
       else poly[i]:= linalg[matrix](1,r,0) 
       fi;
     else
       poly[i]:= linalg[matrix](1,r,[seq( convert(  
		[seq(_c(i,j,k)*x^j,j=0..dct[i]-1)],`+`),k=1..r)]);;
     fi;
  od;

  if sols then
     seqlist := [seqlist];
     if nops(seqlist) >= r then
        coeffslist := [seq(op(1,seqlist[i]),i=1..r)];
        seqlist := {op(map(op,seqlist))};
     else
        coeffslist := map(op,seqlist);
        seqlist := {op(coeffslist)};
     fi;
     for i from 1 to p + q do
         for j from 1 to r do
             a := op(1,op(j,coeffslist));
             poly[i][1,j] := sort(subs(subs((a=0)=(a=1),seqlist),
                     poly[i][1,j]),x);
         od;
     od;
  fi;

  Q := linalg[submatrix](P,1..p+q,1..p);
  P := linalg[submatrix](P,1..p+q,p+1..p+q);
  
  num := evalm( convert([ seq(linalg[matrix](p,1,
                   eval(linalg[row](Q,i)))&*poly[i],i=1..p+q) ],`+`)); 
  den := evalm( convert([ seq(linalg[matrix](p,1,
                   eval(linalg[row](P,i)))&*poly[i],i=1..p+q) ],`+`)); 
  num := map(expand,num);
  den := map(expand,den);
  num := map(collect,eval(num),x);
  den := map(collect,eval(den),x);
  if type(z,`=`) then 
    subs( op(1,z) = op(1,z) - op(2,z), [ eval(num), eval(den) ]);
  else
    [ eval(num), eval(den) ]; 
  fi;
end:

LeftMatrixPade := proc( f , z, n )
  local ans;

  ans := RightMatrixPade(linalg[transpose](f), args[2..nargs]);
  [ eval(linalg[transpose](ans[1])), eval(linalg[transpose](ans[2]))];

end:

Pade := proc( f , z , n)
   local F, ans, sols;

  if nargs = 4 then sols:= false 
  else sols := true; fi;

  if sols then
     F := series(f,z,n[1] + n[2] + 1);
     ans := convert(F,ratpoly,n[1],n[2]);
     [numer(ans),denom(ans)];
  else
     ans := HermitePade([-1,f],z,n,'all');
  fi;

end:

`help/text/HermitePade` := TEXT(
`   `,
`FUNCTION: HermitePade - find Hermite-Pade Approximant of matrix of series`,
`   `,
`CALLING SEQUENCE:`,
`   HermitePade( F, x, n );`,
`   HermitePade( F, x = a, n );`,
`   HermitePade( F, x, n, all );`,
`   HermitePade( F, x = a, n, all );`,
`   `,
`SYNOPSIS:   `,
`- Computes a Hermite Pade Approximant for a list F of power series in x of type`,
`  n. Here n is a list of nonnegative integers. If`,
`   `,
`        F = [F0(x) , ... , Fk(x)]`,
`        n = [n0 , ... , nk]`,
`   `,
`- then HermitePade returns a list P = [P0(x), ... , Pk(x)] of polynomials, with`,
`  degree of Pj(x) at most nj and satisfying`,
`   `,
`        F0(x) P0(x) + ... + Fk(x) Pk(x) =  x^N  R(x)`,
`   `,
`- where N = n0 + ... nk + k - 1 and R(x) is a power series (called the`,
`  residual).`,
`   `,
`- When the user specifies the last argument as all then HermitePade returns a`,
`  parameterized list of ALL the solutions satisfying the above conditions.  The`,
`  method of computing these approximants uses the notion of a Power Hermite`,
`  Pade along with Sigma Bases for the corresponding space of all solutions to`,
`  this problem.`,
`   `,
`- REFERENCES:`,
`   `,
`    B. Beckermann and G. Labahn, A uniform approach for Hermite-Pade`,
`        and simultaneous Pade approximants and their matrix-type`,
`        generalizations, Numerical Algorithms, 3 (1992) 45-54`,
`   `,
`    B. Beckermann and G. Labahn, A uniform approach for the fast`,
`       computation of matrix-type Pade approximants, To appear in`,
`       SIAM J. of Matrix Analysis and Applications, (1994)`,
`   `,
`   `,
`EXAMPLES:   `,
`>    `,
`> F := [2*x^6 + (1+x)/(1-x), 1 + x^8*cos(x) , (1 + x)/(1-2*x)];`,
`                           6   1 + x       8          1 + x`,
`                  F := [2 x  + -----, 1 + x  cos(x), -------]`,
`                               1 - x                 1 - 2 x`,
`   `,
`> n := [1,2,3]: N := convert(n,``+``) + nops(n) - 1:`,
`> P := HermitePade(F,x,n);`,
`                            P := [0, x + 1, 2 x - 1]`,
`   `,
`> s := sum( P[i]*F[i],i=1..nops(n) );`,
`                                   8           (2 x - 1) (x + 1)`,
`                s := (x + 1) (1 + x  cos(x)) + -----------------`,
`                                                    1 - 2 x`,
`   `,
`> series( s , x , N);`,
`                                        8`,
`                                     O(x )`,
`   `,
`> residual := series(s/x^N, x, N + 5);`,
`                                      2        3         4      5`,
`             residual := 1 + x - 1/2 x  - 1/2 x  + 1/24 x  + O(x )`,
`   `,
`> P := HermitePade(F,x,n,all);`,
`                             2`,
`          P := [0, _c(2, 1) x  + (_c(2, 0) + _c(2, 1)) x + _c(2, 0),`,
`   `,
`                          2`,
`              2 _c(2, 1) x  + (2 _c(2, 0) - _c(2, 1)) x - _c(2, 0)]`,
`   `,
`> s := sum( P[i]*F[i],i=1..nops(n) );`,
`                    2                                             8`,
`    s := (_c(2, 1) x  + (_c(2, 0) + _c(2, 1)) x + _c(2, 0)) (1 + x  cos(x))`,
`   `,
`                        2`,
`           (2 _c(2, 1) x  + (2 _c(2, 0) - _c(2, 1)) x - _c(2, 0)) (x + 1)`,
`         + --------------------------------------------------------------`,
`                                       1 - 2 x`,
`   `,
`> series( s , x , N);`,
`                                        8`,
`                                     O(x )`,
`   `,
`> residual := series(s/x^N, x, N + 5);`,
`                                                                              2`,
`residual := _c(2, 0) + (_c(2, 0) + _c(2, 1)) x + (- 1/2 _c(2, 0) + _c(2, 1)) x`,
`   `,
`                                        3                                   4`,
`     + (- 1/2 _c(2, 0) - 1/2 _c(2, 1)) x  + (1/24 _c(2, 0) - 1/2 _c(2, 1)) x`,
`   `,
`          5`,
`     + O(x )`,
`   `,
`> F := [2*x^6 + (1+x)/(1-x), 1 + x^8 , (1 + x)/(1-2*x)];`,
`                               6   x + 1       8   x + 1`,
`                      F := [2 x  + -----, 1 + x , -------]`,
`                                   1 - x          1 - 2 x`,
`   `,
`> n := [1,1,1]: N := convert(n,``+``) + nops(n) - 1:`,
`> P := HermitePade(F,x=-1,n);`,
`                   21513      51383   75153       134893       56147`,
`          P := [- ------ x - ------, ------- x + -------, x + ------]`,
`                  634604     634604  1269208     1269208      158651`,
`   `,
`> s := sum( P[i]*F[i],i=1..nops(n) );`,
`        /   21513      51383\\ /   6   x + 1\\   / 75153       134893\\       8`,
`   s := |- ------ x - ------| |2 x  + -----| + |------- x + -------| (1 + x )`,
`        \\  634604     634604/ \\       1 - x/   \\1269208     1269208/`,
`   `,
`          /     56147\\`,
`          |x + ------| (x + 1)`,
`          \\    158651/`,
`        + --------------------`,
`                 1 - 2 x`,
`   `,
`> series( s , x=-1 , N);`,
`                                           5`,
`                                  O((x + 1) )`,
`   `,
`> residual := series(s/(x+1)^N, x=-1, N + 3);`,
`                 704087   3140581           14137997        2            3`,
`     residual := ------ - ------- (x + 1) + -------- (x + 1)  + O((x + 1) )`,
`                 634604   1903812           11422872`,
`   `,
`SEE ALSO: SigmaBases, SimultaneousPade, PHPA, RightMatrixPade, LeftMatrixPade`
):
#savelib('`help/text/HermitePade`','`help/text/HermitePade.m`'):

`help/text/SimultaneousPade` := TEXT(
`   `,
`FUNCTION: SimultaneousPade - find Simultaneous Pade Approximant `,
`   `,
`CALLING SEQUENCE:`,
`   SimultaneousPade( F, x, n );`,
`   SimultaneousPade( F, x, n, all );`,
`   SimultaneousPade( F, x=a, n );`,
`   SimultaneousPade( F, x=a, n, all );`,
`   `,
`SYNOPSIS:   `,
`- Computes a Simultaneous Pade Approximant for a list F of power series in x or`,
`  (x - a) of type n. Here n is a list of nonnegative integers. If`,
`   `,
`        F = [F1(x) , ... , Fk(x)]`,
`        n = [n0 , ... , nk]`,
`   `,
`- then SimultaneousPade returns a list P = [P0(x), ... , Pk(x)] of polynomials,`,
`  with degree of Pj(x) at most N - nj and satisfying`,
`   `,
`        Fi(x) P0(x) - Pi(x) = x^(N+1) Ri(x)`,
`   `,
`- where N = n0 + ... nk and Ri(x) is a power series for each i. The vector R =`,
`  [R1(x), ... , Rk(x)].`,
`   `,
`- When the user specifies the last argument as all then SimultaneousPade`,
`  returns a parameterized list of ALL the solutions satisfying the above condi-`,
`  tions.  The method of computing these approximants uses the notion of a Power`,
`  Hermite Pade along with Sigma Bases for the corresponding space of all solu-`,
`  tions to this problem.`,
`   `,
`- Simultaneous Pade approximants were introduced by Hermite in 1873. They were`,
`  the principal tools used in his proof of the transcendence of e.`,
`   `,
`- REFERENCES:`,
`   `,
`    B. Beckermann and G. Labahn, A uniform approach for Hermite-Pade`,
`        and simultaneous Pade approximants and their matrix-type`,
`        generalizations, Numerical Algorithms, 3 (1992) 45-54`,
`   `,
`    B. Beckermann and G. Labahn, A uniform approach for the fast`,
`       computation of matrix-type Pade approximants, To appear in`,
`       SIAM J. of Matrix Analysis and Applications, (1994)`,
`   `,
`   `,
`EXAMPLES:   `,
`> F := [2*x^6*cos(x) + (1+x)/(1-x), x^5 - (1 + x)/(1-2*x)];`,
`                             6          1 + x   5    1 + x`,
`                    F := [2 x  cos(x) + -----, x  - -------]`,
`                                        1 - x       1 - 2 x`,
`   `,
`> n := [2,3,3];`,
`                                 n := [2, 3, 3]`,
`   `,
`> P := SimultaneousPade(F,x,n);`,
`                  6   415  5   469  4    12  3          2`,
`   P := [- 3/103 x  + --- x  - --- x  + --- x  + 6/103 x  + 9/206 x + 3/103,`,
`                      206      206      103`,
`   `,
`         421  5   367  4    39  3    21  2    21`,
`       - --- x  - --- x  + --- x  + --- x  + --- x + 3/103,`,
`         206      206      103      103      206`,
`   `,
`        5    73  4    93  3    75  2    27`,
`       x  + --- x  - --- x  - --- x  - --- x - 3/103]`,
`            206      103      206      206`,
`   `,
`> N := convert(n,``+``);`,
`                                     N := 8`,
`   `,
`> for i from 1 to nops(F) do`,
`>     series(  P[1] * F[i] - P[i+1] , x, N + 1);`,
`> od;   `,
`                                        9`,
`                                     O(x )`,
`   `,
`                                        9`,
`                                     O(x )`,
`   `,
`> for i from 1 to nops(F) do`,
`>     R.i := series(  (P[1] * F[i] - P[i+1])/x^(N+1) , x, N + 3);`,
`> od;   `,
`                                  21   1935        2`,
`                           R1 := --- - ---- x + O(x )`,
`                                 206    412`,
`   `,
`                                  517   319        2`,
`                          R2 := - --- + --- x + O(x )`,
`                                  206   206`,
`   `,
`> residual := [seq( R.i, i=1..nops(F))];`,
`                         21   1935        2     517   319        2`,
`           residual := [--- - ---- x + O(x ), - --- + --- x + O(x )]`,
`                        206    412              206   206`,
`   `,
`> P := SimultaneousPade(F,x,n,all);`,
`                        6   415           5   469           4    12           3`,
`P := [- 3/103 _c(3, 0) x  + --- _c(3, 0) x  - --- _c(3, 0) x  + --- _c(3, 0) x`,
`                            206               206               103`,
`   `,
`                             2`,
`           + 6/103 _c(3, 0) x  + 9/206 _c(3, 0) x + 3/103 _c(3, 0),`,
`   `,
`      421           5   367           4    39           3    21           2`,
`    - --- _c(3, 0) x  - --- _c(3, 0) x  + --- _c(3, 0) x  + --- _c(3, 0) x`,
`      206               206               103               103`,
`   `,
`            21`,
`         + --- _c(3, 0) x + 3/103 _c(3, 0),`,
`           206`,
`   `,
`              5    73           4    93           3    75           2`,
`    _c(3, 0) x  + --- _c(3, 0) x  - --- _c(3, 0) x  - --- _c(3, 0) x`,
`                  206               103               206`,
`   `,
`            27`,
`         - --- _c(3, 0) x - 3/103 _c(3, 0)                           ]`,
`           206`,
`   `,
`> N := convert(n,``+``);`,
`                                     N := 8`,
`   `,
`> for i from 1 to nops(F) do`,
`>     series(  P[1] * F[i] - P[i+1] , x, N + 1);`,
`> od;   `,
`                                        9`,
`                                     O(x )`,
`   `,
`                                        9`,
`                                     O(x )`,
`   `,
`> for i from 1 to nops(F) do`,
`>     R.i := series(  (P[1] * F[i] - P[i+1])/x^(N+1) , x, N + 3);`,
`> od;   `,
`                         21            1935                 2`,
`                  R1 := --- _c(3, 0) - ---- _c(3, 0) x + O(x )`,
`                        206             412`,
`   `,
`                         517            319                 2`,
`                 R2 := - --- _c(3, 0) + --- _c(3, 0) x + O(x )`,
`                         206            206`,
`   `,
`> residual := [seq( R.i, i=1..nops(F))];`,
`residual := [`,
`   `,
` 21            1935                 2     517            319                 2`,
`--- _c(3, 0) - ---- _c(3, 0) x + O(x ), - --- _c(3, 0) + --- _c(3, 0) x + O(x )`,
`206             412                       206            206`,
`   `,
`]   `,
`   `,
`> F := [2*x^6 + (1+x)/(1-x), x^5 - (1 + x)/(1-2*x)];`,
`                                6   1 + x   5    1 + x`,
`                       F := [2 x  + -----, x  - -------]`,
`                                    1 - x       1 - 2 x`,
`   `,
`> n := [2,1,1];`,
`                                 n := [2, 1, 1]`,
`   `,
`> P := SimultaneousPade(F,x=-1,n);`,
`                   15043        2   42551   24797`,
`           P := [- ----- (1 + x)  - ----- - ----- x,`,
`                    8370             8370    8370`,
`   `,
`               65413        3   31331        2   119069   154577`,
`               ----- (1 + x)  - ----- (1 + x)  + ------ + ------ x,`,
`                4185             930              8370     8370`,
`   `,
`                      3   80809        2   40301   11611`,
`               (1 + x)  + ----- (1 + x)  - ----- - ----- x]`,
`                           8370             8370    1674`,
`   `,
`> N := convert(n,``+``);`,
`                                     N := 4`,
`   `,
`> for i from 1 to nops(F) do`,
`>     series(  P[1] * F[i] - P[i+1] , x=-1, N + 1);`,
`> od;   `,
`                                           5`,
`                                  O((1 + x) )`,
`   `,
`                                           5`,
`                                  O((1 + x) )`,
`   `,
`> for i from 1 to nops(F) do`,
`>     R.i := series(  (P[1] * F[i] - P[i+1])/(x+1)^(N+1) , x=-1, N + 3);`,
`> od;   `,
`                         22291   382453                    2`,
`                   R1 := ----- - ------ (1 + x) + O((1 + x) )`,
`                          2790    16740`,
`   `,
`                         115057   244421                    2`,
`                 R2 := - ------ + ------ (1 + x) + O((1 + x) )`,
`                          25110    37665`,
`   `,
`> residual := [seq( R.i, i=1..nops(F))];`,
`residual :=`,
`   `,
` 22291   382453                    2     115057   244421                    2`,
`[----- - ------ (1 + x) + O((1 + x) ), - ------ + ------ (1 + x) + O((1 + x) )]`,
`  2790    16740                           25110    37665`,
`   `,
`SEE ALSO: HermitePade, SigmaBases, PHPA, RightMatrixPade, LeftMatrixPade`
):

#savelib('`help/text/SimultaneousPade`','`help/text/SimultaneousPade.m`'):

`help/text/PHPA` := TEXT(
`   `,
`FUNCTION: PHPA - find Power Hermite-Pade Approximant of matrix of series`,
`   `,
`CALLING SEQUENCE:`,
`   PHPA( F, x, n, s, sigma );`,
`   PHPA( F, x, n, s, sigma, all );`,
`   `,
`SYNOPSIS:   `,
`- Computes a Power Hermite Pade Approximant for a list F of power series in x`,
`  of type n and order sigma. Here n is a list of nonnegative integers. If`,
`   `,
`        F = [F0(x) , ... , Fk(x)]`,
`        n = [n0 , ... , nk]`,
`   `,
`- then PHPA returns a list P = [P0(x), ... , Pk(x)] of polynomials, with degree`,
`  of Pj(x) at most nj and satisfying`,
`   `,
`        F0(x) P0(x^s) + ... + Fk(x) Pk(x^s) = O( x^sigma)`,
`   `,
`- When the user specifies the last argument as all then HermitePade returns a`,
`  parameterized list of ALL the solutions satisfying the above conditions.`,
`   `,
`- Power Hermite Pade Approximants were introduced by Beckermann and Labahn as a`,
`  computational tool for computing matrix-type Pade approximants.  Examples of`,
`  such approximants include Hermite-Pade and Simultaneous Pade approximants.`,
`   `,
`- REFERENCES:`,
`   `,
`    B. Beckermann and G. Labahn, A uniform approach for Hermite-Pade`,
`        and simultaneous Pade approximants and their matrix-type`,
`        generalizations, Numerical Algorithms, 3 (1992) 45-54`,
`   `,
`    B. Beckermann and G. Labahn, A uniform approach for the fast`,
`       computation of matrix-type Pade approximants, To appear in`,
`       SIAM J. of Matrix Analysis and Applications, (1994)`,
`   `,
`   `,
`EXAMPLES:   `,
`>    `,
`> F := [2*x^6 + (1+x)/(1-x), 1 + x^8*cos(x) , (1 + x)/(1-2*x)];`,
`                           6   1 + x       8          1 + x`,
`                  F := [2 x  + -----, 1 + x  cos(x), -------]`,
`                               1 - x                 1 - 2 x`,
`   `,
`> n := [1,2,3]: N := convert(n,``+``) + nops(n):`,
`> P := PHPA(F,x,n,2,N);`,
`                                            3    2`,
`                     P := [1/2 x, - 1/6 x, x  + x  - 1/3 x]`,
`   `,
`> P := subs(x=x^2,P):`,
`> s := sum( P[i]*F[i],i=1..nops(n) );`,
`s :=   `,
`   `,
`                                                       6    4        2`,
`         2 /   6   1 + x\\        2       8           (x  + x  - 1/3 x ) (1 + x)`,
`    1/2 x  |2 x  + -----| - 1/6 x  (1 + x  cos(x)) + --------------------------`,
`           \\       1 - x/                                      1 - 2 x`,
`   `,
`> series( s , x , N);`,
`                                        9`,
`                                     O(x )`,
`   `,
`> P := PHPA(F,x,n, 2, N, all);`,
`P :=   `,
`   `,
`                                              3             2`,
` [1/2 _c(3, 0) x, - 1/6 _c(3, 0) x, _c(3, 0) x  + _c(3, 0) x  - 1/3 _c(3, 0) x]`,
`   `,
`> P := subs(x=x^2,P):`,
`> s := sum( P[i]*F[i],i=1..nops(n) );`,
`                        2 /   6   1 + x\\                 2       8`,
`     s := 1/2 _c(3, 0) x  |2 x  + -----| - 1/6 _c(3, 0) x  (1 + x  cos(x))`,
`                          \\       1 - x/`,
`   `,
`                       6             4                 2`,
`            (_c(3, 0) x  + _c(3, 0) x  - 1/3 _c(3, 0) x ) (1 + x)`,
`          + -----------------------------------------------------`,
`                                   1 - 2 x`,
`   `,
`> series( s , x , N);`,
`                                        9`,
`                                     O(x )`,
`   `,
`SEE ALSO: SigmaBases, HermitePade, SimultaneousPade, RightMatrixPade, LeftMa-`,
`          trixPade`
):

#savelib('`help/text/PHPA`','`help/text/PHPA.m`'):

`help/text/LeftMatrixPade` := TEXT(
`   `,
`FUNCTION: LeftMatrixPade - find left Matrix Pade Approximant of matrix of`,
`                           series`,
`   `,
`CALLING SEQUENCE:`,
`   LeftMatrixPade( F, x, n );`,
`   LeftMatrixPade( F, x, n, all );`,
`   LeftMatrixPade( F, x = a, n );`,
`   LeftMatrixPade( F, x = a, n, all );`,
`   `,
`SYNOPSIS:   `,
`- Computes a left Matrix Pade Approximant for a matrix F of power series in x`,
`  or in (x - a) of type n. Here n is a list of two nonnegative integers. If`,
`   `,
`- then LeftMatrixPade returns a list P = [P(x), Q(x)] of polynomials, with`,
`  degree of P(x) and Q(x) at most n[1] and n[2], respectively, and satisfying`,
`   `,
`        Q(x) F(x) - P(x) = x^(N + 1) R(x)`,
`   `,
`- where N = n[1] + n[2] and R(x) is a matrix of power series (called the resi-`,
`  dual).   `,
`   `,
`- When the user specifies the last argument as all then LeftMatrixPade( returns`,
`  a parameterized list of ALL the solutions satisfying the above conditions.`,
`  The method of computing these approximants uses the notion of a Power Hermite`,
`  Pade Approximant along with Sigma Bases for the corresponding space of all`,
`  solutions to this problem.`,
`   `,
`- If F is a p x q matrix of power series then by default the denominator has`,
`  dimension p x p while the numerator has dimension p x q. If the fourth argu-`,
`  ment is an integer r then the dimensions will be r x p and r x q`,
`  respectively. The case when r = q is useful for inversion formulae for rec-`,
`  tangular block Hankel matrices.`,
`   `,
`- REFERENCES:`,
`   `,
`    B. Beckermann and G. Labahn, A uniform approach for Hermite-Pade`,
`        and simultaneous Pade approximants and their matrix-type`,
`        generalizations, Numerical Algorithms, 3 (1992) 45-54`,
`   `,
`    B. Beckermann and G. Labahn, A uniform approach for the fast`,
`       computation of matrix-type Pade approximants, To appear in`,
`       SIAM J. of Matrix Analysis and Applications, (1994)`,
`   `,
`   `,
`EXAMPLES:   `,
`> A := linalg[matrix](2,2,[ 1 + z^2 + 2*z^4 - z^5 + z^6 + O(z^8),`,
`>                           z^7 + O(z^8), -z^5 + O(z^8),`,
`>                           1 + z^2 + z^4 + z^7 + O(z^8) ]):`,
`> A := map(series,eval(A),z,8);`,
`            [      2      4    5    6      8           7      8         ]`,
`            [ 1 + z  + 2 z  - z  + z  + O(z )         z  + O(z )        ]`,
`       A := [                                                           ]`,
`            [              5      8                 2    4    7      8  ]`,
`            [           - z  + O(z )           1 + z  + z  + z  + O(z ) ]`,
`   `,
`> n := [2,3]: N := convert(n,``+``) + 1:`,
`> ans := LeftMatrixPade(A,z,n);`,
`                                          [           3 ]`,
`                              [ 0  - z ]  [ 0  - z + z  ]`,
`                      ans := [[        ], [             ]]`,
`                              [ 0  - z ]  [           3 ]`,
`                                          [ 0  - z + z  ]`,
`   `,
`> s := evalm( ans[2] &* A  - ans[1]):`,
`> map(series, eval(s), z, N);`,
`                                [    6      7  ]`,
`                                [ O(z )  O(z ) ]`,
`                                [              ]`,
`                                [    6      7  ]`,
`                                [ O(z )  O(z ) ]`,
`   `,
`> residual := map(series,evalm( (ans[2] &* A  - ans[1])/z^N),z,N+2);`,
`                               [      2      3          2  ]`,
`                               [ 1 - z  + O(z )  z + O(z ) ]`,
`                   residual := [                           ]`,
`                               [      2      3          2  ]`,
`                               [ 1 - z  + O(z )  z + O(z ) ]`,
`   `,
`> n := [3,4]: N := convert(n,``+``) + 1:`,
`> ans := LeftMatrixPade(A,z,n);`,
`                      [              3        2     2 ]`,
`                      [ 1/4 z - 1/4 z  + 1/4 z   - z  ]`,
`              ans := [[                               ],`,
`                      [              3        2     2 ]`,
`                      [ 1/4 z - 1/4 z  + 1/4 z   - z  ]`,
`   `,
`                  [              3        2        4     2    4 ]`,
`                  [ 1/4 z - 1/2 z  + 1/4 z  - 1/4 z   - z  + z  ]`,
`                  [                                             ]]`,
`                  [              3        2        4     2    4 ]`,
`                  [ 1/4 z - 1/2 z  + 1/4 z  - 1/4 z   - z  + z  ]`,
`   `,
`> s := evalm(ans[2]&*A  - ans[1]):`,
`> map(series, eval(s), z, N);`,
`                                [    8      8  ]`,
`                                [ O(z )  O(z ) ]`,
`                                [              ]`,
`                                [    8      8  ]`,
`                                [ O(z )  O(z ) ]`,
`   `,
`> ans := LeftMatrixPade(A,z,n,all);`,
`  ans := [                                        3       2         ,`,
`          [(- 1/4 _c(4, 0, 1) - 1/4 _c(3, 0, 1)) z  + %1 z  + %1 z,`,
`   `,
`                                             2`,
`              (- _c(3, 0, 1) - _c(4, 0, 1)) z ]`,
`   `,
`                                                  3       2`,
`          [(- 1/4 _c(4, 0, 2) - 1/4 _c(3, 0, 2)) z  + %2 z  + %2 z,`,
`   `,
`                                             2`,
`              (- _c(3, 0, 2) - _c(4, 0, 2)) z ]`,
`   `,
`                                              4                             ]`,
`      [(- 1/4 _c(4, 0, 1) - 1/4 _c(3, 0, 1)) z`,
`   `,
`                                                    3       2`,
`           + (- 1/2 _c(3, 0, 1) - 1/2 _c(4, 0, 1)) z  + %1 z  + %1 z,`,
`   `,
`                                       4                                  2`,
`          (_c(3, 0, 1) + _c(4, 0, 1)) z  + (- _c(3, 0, 1) - _c(4, 0, 1)) z ]`,
`   `,
`                                              4`,
`      [(- 1/4 _c(4, 0, 2) - 1/4 _c(3, 0, 2)) z`,
`   `,
`                                                    3       2`,
`           + (- 1/2 _c(3, 0, 2) - 1/2 _c(4, 0, 2)) z  + %2 z  + %2 z,`,
`   `,
`                                       4                                  2`,
`          (_c(3, 0, 2) + _c(4, 0, 2)) z  + (- _c(3, 0, 2) - _c(4, 0, 2)) z ]`,
`   `,
`%1 :=                 1/4 _c(3, 0, 1) + 1/4 _c(4, 0, 1)`,
`   `,
`%2 :=                 1/4 _c(3, 0, 2) + 1/4 _c(4, 0, 2)`,
`   `,
`> s := evalm(ans[2]&*A  - ans[1]):`,
`> map(series, eval(s), z, N);`,
`                                [    8      8  ]`,
`                                [ O(z )  O(z ) ]`,
`                                [              ]`,
`                                [    8      8  ]`,
`                                [ O(z )  O(z ) ]`,
`   `,
`> residual := map(series,evalm( (ans[2] &* A  - ans[1])/z^N),z,N+3);`,
`          residual := [(1/4 _c(3, 0, 1) + 1/4 _c(4, 0, 1)) + O(z),`,
`   `,
`                          (5/4 _c(3, 0, 1) + 5/4 _c(4, 0, 1)) + O(z)]`,
`   `,
`                      [(1/4 _c(3, 0, 2) + 1/4 _c(4, 0, 2)) + O(z),`,
`   `,
`                          (5/4 _c(3, 0, 2) + 5/4 _c(4, 0, 2)) + O(z)]`,
`   `,
`> A := linalg[matrix](2,2,[ 1 + z^2 + 2*z^4 - z^5 + z^6 + O((z-3)^8),`,
`>                           z^7 + O((z-3)^8), -z^5 + O((z-3)^8),`,
`>                           1 + z^2 + z^4 + z^7 + O((z-3)^8) ]):`,
`> A := map(series,eval(A),z=3,8):`,
`> ans := LeftMatrixPade(A,z=3,n):`,
`> s := evalm( ans[2] &* A  - ans[1]):`,
`> map(series, eval(s), z=3,N);`,
`                          [          8            8  ]`,
`                          [ O((z - 3) )  O((z - 3) ) ]`,
`                          [                          ]`,
`                          [          8            8  ]`,
`                          [ O((z - 3) )  O((z - 3) ) ]`,
`   `,
`> residual := map(series,evalm( (ans[2] &* A  - ans[1])/(z-3)^N),z=3,N+3);`,
`                                       [ O(1)  O(1) ]`,
`                           residual := [            ]`,
`                                       [ O(1)  O(1) ]`,
`   `,
`SEE ALSO: HermitePade, SimultaneousPade, PHPA, RightMatrixPade, SigmaBases`
):

#savelib('`help/text/LeftMatrixPade`','`help/text/LeftMatrixPade.m`'):

`help/text/RightMatrixPade` := TEXT(
`   `,
`FUNCTION: RightMatrixPade - find right Matrix Pade Approximant of matrix of`,
`                            series`,
`   `,
`CALLING SEQUENCE:`,
`   RightMatrixPade( F, x, n );`,
`   RightMatrixPade( F, x, n, all );`,
`   RightMatrixPade( F, x=a, n );`,
`   RightMatrixPade( F, x=a, n, all );`,
`   `,
`SYNOPSIS:   `,
`- Computes a right Matrix Pade Approximant for a matrix F of power series in x`,
`  or (x-a) of type n. Here n is a list of two nonnegative integers. If`,
`   `,
`- then RightMatrixPade returns a list P = [P(x), Q(x)] of polynomials, with`,
`  degree of P(x) and Q(x) at most n[1] and n[2], respectively, and satisfying`,
`   `,
`        F(x) Q(x) - P(x) = x^(N + 1) R(x)`,
`   `,
`- where N = n[1] + n[2] and R(x) is a matrix of power series.`,
`   `,
`- When the user specifies the last argument as all then RightMatrixPade returns`,
`  a parameterized list of ALL the solutions satisfying the above conditions.`,
`  The method of computing these approximants uses the notion of a Power Hermite`,
`  Pade Approximant along with Sigma Bases for the corresponding space of all`,
`  solutions to this problem.`,
`   `,
`- If F is a p x q matrix of power series then by default the denominator has`,
`  dimension q x q while the numerator has dimension p x q. If the fourth`,
`  argument is an integer r then the dimensions will be q x r and p x r respec-`,
`  tively. The case when r = p is useful for inversion formulae for rectangular`,
`  block Hankel matrices.`,
`   `,
`- REFERENCES:`,
`   `,
`    B. Beckermann and G. Labahn, A uniform approach for Hermite-Pade`,
`        and simultaneous Pade approximants and their matrix-type`,
`        generalizations, Numerical Algorithms, 3 (1992) 45-54`,
`   `,
`    B. Beckermann and G. Labahn, A uniform approach for the fast`,
`       computation of matrix-type Pade approximants, To appear in`,
`       SIAM J. of Matrix Analysis and Applications, (1994)`,
`   `,
`   `,
`EXAMPLES:   `,
`> A := linalg[matrix](2,2,[ 1 + z^2 + 2*z^4 - z^5 + z^6 + O(z^8),`,
`>                           z^7 + O(z^8), -z^5 + O(z^8),`,
`>                           1 + z^2 + z^4 + z^7 + O(z^8) ]):`,
`> A := map(series,eval(A),z,8);`,
`            [      2      4    5    6      8           7      8         ]`,
`            [ 1 + z  + 2 z  - z  + z  + O(z )         z  + O(z )        ]`,
`       A := [                                                           ]`,
`            [              5      8                 2    4    7      8  ]`,
`            [           - z  + O(z )           1 + z  + z  + z  + O(z ) ]`,
`   `,
`> n := [2,3]: N := convert(n,``+``) + 1:`,
`> ans := RightMatrixPade(A,z,n);`,
`                                       [     0         0    ]`,
`                          [  0   0  ]  [                    ]`,
`                  ans := [[         ], [        2         3 ]]`,
`                          [ -1  - z ]  [ - 1 + z   - z + z  ]`,
`   `,
`> s := evalm(A &* ans[2] - ans[1]):`,
`> map(series, eval(s), z, N);`,
`                                [    7      8  ]`,
`                                [ O(z )  O(z ) ]`,
`                                [              ]`,
`                                [    6      7  ]`,
`                                [ O(z )  O(z ) ]`,
`   `,
`> residual := map(series, evalm( (A &* ans[2] - ans[1] )/z^N), z,N+3);`,
`                             [           2        2      3   ]`,
`                             [  - z + O(z )    - z  + O(z )  ]`,
`                 residual := [                               ]`,
`                             [            2        2      3  ]`,
`                             [ 1 - z + O(z )  z - z  + O(z ) ]`,
`   `,
`> ans := RightMatrixPade(A,z,n,all);`,
`           [               0                              0               ]`,
`   ans := [[                                                              ],`,
`           [ - _c(4, 0, 1) - _c(4, 1, 1) z  - _c(4, 0, 2) - _c(4, 1, 2) z ]`,
`   `,
`                                      [0, 0]                               ]`,
`   `,
`                                         2                3`,
`       [- _c(4, 0, 1) - _c(4, 1, 1) z + z  _c(4, 0, 1) + z  _c(4, 1, 1),`,
`   `,
`                                            2                3`,
`           - _c(4, 0, 2) - _c(4, 1, 2) z + z  _c(4, 0, 2) + z  _c(4, 1, 2)]`,
`   `,
`> s := evalm(A &* ans[2] - ans[1]):`,
`> map(series, eval(s), z, N);`,
`                                [    7      7  ]`,
`                                [ O(z )  O(z ) ]`,
`                                [              ]`,
`                                [    6      6  ]`,
`                                [ O(z )  O(z ) ]`,
`   `,
`> n := [3,4]: N := convert(n,``+``) + 1:`,
`> ans := RightMatrixPade(A,z,n);`,
`                       [   0     0  ]  [     0          0     ]`,
`                       [            ]  [                      ]`,
`               ans := [[    2     2 ], [    2    4     2    4 ]]`,
`                       [ - z   - z  ]  [ - z  + z   - z  + z  ]`,
`   `,
`> s := evalm(A &* ans[2] - ans[1]):`,
`> map(series, eval(s), z, N);`,
`                                [    9      9  ]`,
`                                [ O(z )  O(z ) ]`,
`                                [              ]`,
`                                [    8      8  ]`,
`                                [ O(z )  O(z ) ]`,
`   `,
`> ans := RightMatrixPade(A,z,n,all);`,
`  ans := [   `,
`   `,
`      [                 0                                 0                ]`,
`      [                                                                    ]`,
`      [                                2                                 2 ],`,
`      [ (- _c(3, 0, 1) - _c(4, 0, 1)) z   (- _c(3, 0, 2) - _c(4, 0, 2)) z  ]`,
`   `,
`                                      [0, 0]                                ]`,
`   `,
`                                    4                                  2`,
`      [(_c(3, 0, 1) + _c(4, 0, 1)) z  + (- _c(3, 0, 1) - _c(4, 0, 1)) z ,`,
`   `,
`                                       4                                  2`,
`          (_c(3, 0, 2) + _c(4, 0, 2)) z  + (- _c(3, 0, 2) - _c(4, 0, 2)) z ]`,
`   `,
`> s := evalm(A &* ans[2] - ans[1]):`,
`> map(series, eval(s), z, N);`,
`                                [    9      9  ]`,
`                                [ O(z )  O(z ) ]`,
`                                [              ]`,
`                                [    8      8  ]`,
`                                [ O(z )  O(z ) ]`,
`   `,
`SEE ALSO: HermitePade, SimultaneousPade, PHPA, SigmaBases, LeftMatrixPade`
):

#savelib('`help/text/RightMatrixPade`','`help/text/RightMatrixPade.m`'):

`help/text/SigmaBases` := TEXT(
`   `,
`FUNCTION: SigmaBases - find a sigma basis for a matrix of power series`,
`   `,
`CALLING SEQUENCE:`,
`   SigmaBases(F, x, n, s, sigma );`,
`   `,
`SYNOPSIS:   `,
`- F is a list or vector or column matrix of power series in x, n is a list of`,
`  nonnegative integers and s and sigma are integers.  n is a list of nonnega-`,
`  tive integers. If`,
`   `,
`        F = [F1(x) , ... , Fk(x)]^T`,
`        n = [n1 , ... , nk]`,
`   `,
`- then SigmaBases returns a square k x k matrix whose rows form a basis for the`,
`  set of polynomial vectors [P1(x), ... , Pk(x)], with degree of Pj(x) at most`,
`  nj and satisfying`,
`   `,
`        F1(x) P1(x^s) + ... + Fk(x) Pk(x^s) = O( x^sigma )`,
`   `,
`- SigmaBases is used to compute a basis for the linear space of all Power Her-`,
`  mite Pade Approximants for a given vector of power series.  They were intro-`,
`  duced by Beckermann and Labahn as a computational tool for computing matrix-`,
`  type Pade approximants. Examples of such approximants include Hermite-Pade`,
`  and Simultaneous Pade approximants.`,
`   `,
`- REFERENCES:`,
`   `,
`    B. Beckermann and G. Labahn, A uniform approach for Hermite-Pade`,
`        and simultaneous Pade approximants and their matrix-type`,
`        generalizations, Numerical Algorithms, 3 (1992) 45-54`,
`   `,
`    B. Beckermann and G. Labahn, A uniform approach for the fast`,
`       computation of matrix-type Pade approximants, To appear in`,
`       SIAM J. of Matrix Analysis and Applications, (1994)`,
`   `,
`   `,
`EXAMPLES:   `,
`> F := linalg[matrix](4,1,[1,z,z/(1-z^4) + z^10,z/(1+z^4) + z^12]):`,
`> n := [2,2,2,2]:`,
`> SigmaBases(F,z,n,2,10);`,
`                        [  5                           ]`,
`                        [ z      0         0        0  ]`,
`                        [                              ]`,
`                        [        2                     ]`,
`                        [  0    z        -1/2      1/2 ]`,
`                        [                              ]`,
`                        [          2           2       ]`,
`                        [  0  1 - z   - 1/2 + z   -1/2 ]`,
`                        [                              ]`,
`                        [  0   - 2 z       z        z  ]`,
`   `,
`> F := [2*x^6 + (1+x)/(1-x), 1 + x^8*cos(x) , (1 + x)/(1-2*x)]:`,
`> n := [1,2,3]:`,
`> N := convert(n,``+``) + nops(n):`,
`> SigmaBases(F,x,n,2,N);`,
`      [        3                    3                  4        3       ]`,
`      [       x              - 1/3 x                2 x  - 2/3 x        ]`,
`      [                                                                 ]`,
`      [       2                2          3       3    25   2           ]`,
`      [ 7/12 x  - 1/2  - 7/36 x  + 1/6 + x   1/6 x  - ---- x  - x + 1/3 ]`,
`      [                                                18               ]`,
`      [                                                                 ]`,
`      [                                             2            3      ]`,
`      [     1/2 x             - 1/6 x              x  - 1/3 x + x       ]`,
`   `,
`SEE ALSO: HermitePade, SimultaneousPade, PHPA, RightMatrixPade, LeftMatrixPade`
):

#savelib('`help/text/SigmaBases`','`help/text/SigmaBases.m`'):

`help/text/Pade` := TEXT(
`   `,
`FUNCTION: Pade - find Pade Approximant of a series`,
`   `,
`CALLING SEQUENCE:`,
`   Pade( F, x, n );`,
`   Pade( F, x=a, n );`,
`   Pade( F, x, n, all );`,
`   Pade( F, x=a, n, all );`,
`   `,
`SYNOPSIS:   `,
`- Computes a Pade Approximant for a power series F in x of type n. Here n is a`,
`  list of nonnegative integers.`,
`   `,
`- Pade returns a list P = [P0(x), P1(x)] of polynomials, with degree of Pj(x)`,
`  at most n[j] and satisfying`,
`   `,
`        F0(x) P0(x) - P1(x) = O( x^(n[1] + n[2] + 1) )`,
`   `,
`- When the user specifies the last argument as all then Pade returns a`,
`  parameterized list of ALL the solutions satisfying the above conditions.  The`,
`  method of computing these approximants uses the notion of a Power Hermite`,
`  Pade along with Sigma Bases for the corresponding space of all solutions to`,
`  this problem.`,
`   `,
`EXAMPLES:   `,
`>    `,
`> F := 2*x^6 + (1+x)/(1-x);`,
`                                       6   1 + x`,
`                               F := 2 x  + -----`,
`                                           1 - x`,
`   `,
`> n := [1,2]: `,
`> P := Pade(F,x,n);`,
`                            P := [- 1 - x, - 1 + x]`,
`   `,
`> s := P[2]*F - P[1]:`,
`> series( s , x , 4);`,
`                                        4`,
`                                     O(x )`,
`   `,
`> P := Pade(F,x,n,all);`,
`             P := [_c(1, 0) x + _c(1, 0), - _c(1, 0) x + _c(1, 0)]`,
`   `,
`> s := P[2]*F - P[1]:`,
`> series( s , x , 4);`,
`                                        4`,
`                                     O(x )`,
`   `,
`> P := Pade(GAMMA(x),x=1,[1,2]);`,
`P := [   `,
`   `,
`        2           2        2              2                   3           3`,
` - 12 Pi  + 72 gamma  - 12 Pi  gamma + 12 Pi  gamma x + 24 gamma  - 24 gamma  x`,
`   `,
`      + 48 Zeta(3) - 48 Zeta(3) x,`,
`   `,
`        2           2                                       3           3`,
` - 12 Pi  + 72 gamma  + 48 Zeta(3) - 48 Zeta(3) x - 48 gamma  + 48 gamma  x`,
`   `,
`          4       4       4  2           4           4             4  2`,
`      + Pi  - 2 Pi  x + Pi  x  + 12 gamma  - 24 gamma  x + 12 gamma  x`,
`   `,
`                                                                  2`,
`      - 48 gamma Zeta(3) + 96 gamma Zeta(3) x - 48 gamma Zeta(3) x         ]`,
`   `,
`> s := GAMMA(x) - P[1]/P[2]:`,
`> simplify(series( s , x=1 , 4));`,
`                                            4`,
`                                 O((- 1 + x) )`,
`   `,
`> P := Pade(GAMMA(x),x=1,[1,2],all);`,
`P := [   `,
`   `,
`  /              2                          3                      \\`,
`  |   _c(2, 0) Pi  gamma      _c(2, 0) gamma       _c(2, 0) Zeta(3)|`,
`  |12 ------------------ - 24 --------------- - 48 ----------------| (- 1 + x)`,
`  \\           %1                     %1                   %1       /`,
`   `,
`                       2                    2`,
`            _c(2, 0) Pi       _c(2, 0) gamma`,
`       - 12 ------------ + 72 ---------------,`,
`                 %1                  %1`,
`   `,
`  /           4                    4                            \\`,
`  |_c(2, 0) Pi       _c(2, 0) gamma       _c(2, 0) gamma Zeta(3)|          2`,
`  |------------ + 12 --------------- - 48 ----------------------| (- 1 + x)`,
`  \\     %1                  %1                      %1          /`,
`   `,
`         /                 3                      \\                           2`,
`         |   _c(2, 0) gamma       _c(2, 0) Zeta(3)|                _c(2, 0) Pi`,
`       + |48 --------------- - 48 ----------------| (- 1 + x) - 12 ------------`,
`         \\          %1                   %1       /                     %1`,
`   `,
`                          2`,
`            _c(2, 0) gamma`,
`       + 72 ---------------`,
`                   %1`,
`   `,
`  ]   `,
`   `,
`                       4           4`,
`%1 :=                Pi  + 12 gamma  - 48 gamma Zeta(3)`,
`   `,
`> s := GAMMA(x) - P[1]/P[2]:`,
`> simplify(series( s , x=1 , 4));`,
`                                            4`,
`                                 O((- 1 + x) )`,
`   `,
`SEE ALSO: convert[ratpoly],numapprox[pade],SigmaBases`
):


#save `MatPade.m`;
#quit
