Ask Your Question

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

asked 2014-01-24 14:41:05 +0200

AndyH gravatar image

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 flag offensive 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.

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

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

kcrisman gravatar imagekcrisman ( 2014-01-24 15:05:20 +0200 )edit

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.

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

1 Answer

Sort by ยป oldest newest most voted

answered 2014-01-24 15:09:21 +0200

kcrisman gravatar image

updated 2014-01-24 15:09:53 +0200

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

sage: f = 1/x^2
sage: f._maxima_().taylor((x,2,2))

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


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.

edit flag offensive delete link 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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2014-01-24 14:41:05 +0200

Seen: 340 times

Last updated: Jan 24 '14