### 5.34.5 Padé expansion: pade

pade takes 4 arguments

- an expression,
- the variable name the expression depends on,
- an integer n or a polynomial N,
- an integer p.

pade returns a rational fraction P/Q such that degree(P)<p and P/Q=f (mod xn+1 ) or P/Q=f (mod N ). In the first case, it means that P/Q and f have the same Taylor expansion at 0 up to order n.
Input :

pade(exp(x),x,5,3)

or :

pade(exp(x),x,x`^`6,3)

Output :

(3*x`^`2+24*x+60)/(-x`^`3+9*x`^`2-36*x+60)

To verify input :

taylor((3*x`^`2+24*x+60)/(-x`^`3+9*x`^`2-36*x+60))

Output :

1+x+1/2*x`^`2+1/6*x`^`3+1/24*x`^`4+1/120*x`^`5+x`^`6*order_size(x)

which is the 5th-order series expansion of exp(x) at x=0.
Input :

pade((x`^`15+x+1)/(x`^`12+1),x,12,3)

or :

pade((x`^`15+x+1)/(x`^`12+1),x,x`^`13,3)

Output :

x+1

Input :

pade((x`^`15+x+1)/(x`^`12+1),x,14,4)

or :

pade((x`^`15+x+1)/(x`^`12+1),x,x`^`15,4)

Output :

(-2*x`^`3-1)/(-x`^`11+x`^`10-x`^`9+x`^`8-x`^`7+x`^`6-x`^`5+x`^`4- x`^`3-x`^`2+x-1)

To verify, input :

series(ans(),x=0,15)

Output :

1+x-x`^`12-x`^`13+2x`^`15+x`^`16*order_size(x)

then input :

series((x`^`15+x+1)/(`x^`12+1),x=0,15)

Output :

1+x-x`^`12-x`^`13+x`^`15+x`^`16*order_size(x)

These two expressions have the same 14th-order series expansion at x=0.