# taylor(1/x^2,x,2,2) give unexpected results

When I calculated this by hand, the constant term is 1/4 but sage gives 3/4.

Sage: $$\newcommand{\Bold}[1]{\mathbf{#1}}\frac{3}{16} {\left(x - 2\right)}^{2} - \frac{1}{4} x + \frac{3}{4}$$

My calculation:

$$\frac{1}{4} -\frac{1}{4}(x-2)+\frac{3}{16}(x-2)^2$$

I'm learning taylor series and sage at the same time, so its quite possible I'm misusing sage. I checked the same thing on wolframalpha, and it agrees with me.

Any ideas? I running sage Sage Version 6.0,Release Date: 2013-12-17 under Ubuntu 12.10. Thanks.

edit retag close merge delete

The answer is the same in both cases. If you add 1/4 with 2/4 from the linear term you get 3/4.

( 2014-01-24 14:47:33 +0200 )edit

Maybe what @Ariyama wants is for Sage to not "simplify" the linear terms.

( 2014-01-24 15:05:20 +0200 )edit
1

Yes, if one asks for the Taylor series centered at 2, one should expect the answer to appear with (x-2)'s , not "simplified" into a series with some terms (or just leading term) centered at 2 and the rest centered at 0.

( 2014-01-26 15:58:42 +0200 )edit

Sort by ยป oldest newest most voted

There's a way to at least get this to print.

sage: f = 1/x^2
sage: f._maxima_().taylor((x,2,2))
1/4-(x-2)/4+3*(x-2)^2/16


However, it doesn't stick around when you send it back to Sage.

sage: SR(_)
3/16*(x - 2)^2 - 1/4*x + 3/4


Indeed,

sage: (x-2)/4
1/4*x - 1/2


It's possible to get this to not simplify

sage: (x-2).mul(1/4,hold=True)
1/4*(x - 2)


but I'm not sure if we can easily massage the output of Maxima to automatically not simplify with that.

more

Ah, thanks. I didn't notice before that sage was simplifying the (x-2)/4 term. I'm glad my sanity is intact, at least for now. Andy

( 2014-01-24 17:06:37 +0200 )edit