How to approximate $\sin(x)$ using Padé approximation? I need to write a function for $\sin(x)$ using Padé approximation.
I found here a formula, but I don't know how to achive this.

Thanks in advance.
 A: Since you know Taylor expansions, let us try a simple way.
You want to make $$f(x)=\frac{\sum_{i=0}^n a_ix^i } {1+ \sum_{i=1}^m b_ix^i }$$ where $m,n$ are predefined degrees. So, write $$f(x)\left({1+ \sum_{i=1}^m b_ix^i }\right)=\sum_{i=0}^n a_ix^i $$ Use the Taylor expansion of $f(x)$ and identify coefficients.
Let us try with $f(x)=e^x$, $m=2$, $n=3$. So, we have $$\left(1+x+\frac{x^2}{2}+\frac{x^3}{6}+\frac{x^4}{24}+\frac{x^5}{120}\right)\left(1+b_1x+b_2x^2+b_3x^3\right)=a_0+a_1x+a_2x^2$$ Expanding, grouping terms and setting coefficients equal to $0$ will lead to the following equations $$a_0=1$$ $$1-a_1+b_1=0$$ $$-a_2+b_1+b_2+\frac{1}{2}=0$$ $$\frac{b_1}{2}+b_2+b_3+\frac{1}{6}=0$$ $$\frac{b_1}{6}+\frac{b_2}{2}+b_3+\frac{1}{24}=0$$ $$5 b_1+20 b_2+60 b_3+1=0$$ from which $$a_0=1 \qquad a_1=\frac 25\qquad a_2=\frac 1{20}$$ $$b_1=-\frac35 \qquad b_2=\frac 3{20}\qquad b_3=-\frac 1{60}$$  and then $$\frac{1+\frac{2}{5}x+\frac{1}{20}x^2 } {1-\frac{3 }{5}x+\frac{3 }{20}x^2-\frac{1}{60}x^3 }$$ is the Padé approximant.
