### 13.5.5 Padé expansion

The pade command finds a rational expression which agrees with a function up to a given order.

- pade takes 4 arguments
  - expr, an expression.
  - x, the variable name.
  - n, an integer or R, a polynomial.
  - p, an integer.
- pade(expr,x,n,p) or pade(expr,x,P,p) returns a rational function P/Q such that degree(P)<p and P/Q≡ expr(mod xn+1 ) (meaning that P/Q and f have the same Taylor expansion at 0 up to order n) or P/Q≡ expr· f(mod R ), respecively.

#### Examples

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

or:

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

−3 x2−24 x−60
x3−9 x2+36 x−60

To verify:

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

1+x+ |
x2
2
| + |
x3
6
| + |
x4
24
| + |
x5
120
| +x6 order_size | ⎛ ⎝ | x | ⎞ ⎠

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

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

or:

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

x+1 |  |  |  |  |  |  |  |  |  |

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

or:

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

2 x3+1
x11−x10+x9−x8+x7−x6+x5−x4+x3+x2−x+1

To verify:

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

1+x−x12−x13+2 x15+x16 order_size | ⎛ ⎝ | x | ⎞ ⎠

Then:

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

1+x−x12−x13+x15+x16 order_size | ⎛ ⎝ | x | ⎞ ⎠

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