Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Well...

sage: S=cos(x).taylor(x,0,10).power_series(QQ).pade(2,4);S
(-244/3*x^2 + 200)/(x^4 + 56/3*x^2 + 200)
sage: M=mathematica.PadeApproximant(cos(x),[x,0,[2,4]]).sage();M
-4*(61*x^2 - 150)/(3*x^4 + 56*x^2 + 600)
sage: bool(M==S)
True

By the way, the Padé approximation is slightly less precise than the Taylor development of the equivalent degree:

sage: S(x=pi).n()
-1.25140289236071
sage: cos(x).taylor(x,0,6)(x=pi).n()
-1.21135284298250

And FredericC's solution is equivalent:

sage: t=QQ[['t']].0
sage: T=t.cos().pade(2,4);T
(-244/3*t^2 + 200)/(t^4 + 56/3*t^2 + 200)
sage: bool(T(x)==S)
True

Your Sage version (which is antique, by Sage standards...) gives you bullshit.