1 | initial version |

Let `f`

be your function, here a symbolic expression:

```
sage: f = arctan(x)
sage: f.parent()
Symbolic Ring
```

If you search for "pade sagemath" you will get this page http://doc.sagemath.org/html/en/reference/power_series/sage/rings/power_series_poly.html so you have first to transform the symbolic expression `arctan(x)`

into a power series. As you can see, the symbolic expression has a method named `power_series`

, so let us try it:

```
sage: f.power_series(QQ)
TypeError: unable to convert arctan(x) to a rational
```

The problem is that, currently, Sage is not able to transform such a symbolic expression into a power series, only the expressions that are polynomials, see the doc of the method by typing `f.power_series`

So, you have first to approximate `f`

to a truncated power series, also known as Taylor expansion:

```
sage: f.taylor(x,0,12)
-1/11*x^11 + 1/9*x^9 - 1/7*x^7 + 1/5*x^5 - 1/3*x^3 + x
```

Then you can get it as a power series over the rationals:

```
sage: f.taylor(x,0,12).power_series(QQ)
x - 1/3*x^3 + 1/5*x^5 - 1/7*x^7 + 1/9*x^9 - 1/11*x^11 + O(x^12)
```

Then you can get the pade approximant of your choice:

```
sage: f.taylor(x,0,12).power_series(QQ).pade(3,3)
(4/9*x^3 + 5/3*x)/(x^2 + 5/3)
```

Of course, the higher pade approximant you require, the higer the degree in the Taylor expansion:

```
sage: f.taylor(x,0,12).power_series(QQ).pade(10,10)
ValueError: the precision of the series is not large enough
sage: f.taylor(x,0,42).power_series(QQ).pade(10,10)
(61567/3969*x^9 + 106964/441*x^7 + 44902/45*x^5 + 281996/189*x^3 + 46189/63*x)/(x^10 + 55*x^8 + 1430/3*x^6 + 1430*x^4 + 12155/7*x^2 + 46189/63)
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.