ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 26 Jan 2014 15:58:42 +0100taylor(1/x^2,x,2,2) give unexpected resultshttps://ask.sagemath.org/question/10958/taylor1x2x22-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.
Fri, 24 Jan 2014 14:41:05 +0100https://ask.sagemath.org/question/10958/taylor1x2x22-give-unexpected-results/Comment by dart2163 for <p>When I calculated this by hand, the constant term is 1/4 but sage gives 3/4.</p>
<p>Sage:
$$\newcommand{\Bold}[1]{\mathbf{#1}}\frac{3}{16} {\left(x - 2\right)}^{2} - \frac{1}{4} x + \frac{3}{4}$$</p>
<p>My calculation:</p>
<p>$$\frac{1}{4} -\frac{1}{4}(x-2)+\frac{3}{16}(x-2)^2$$</p>
<p>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.</p>
<p>Any ideas? I running sage Sage Version 6.0,Release Date: 2013-12-17 under Ubuntu 12.10. Thanks.</p>
https://ask.sagemath.org/question/10958/taylor1x2x22-give-unexpected-results/?comment=16391#post-id-16391Yes, 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. Sun, 26 Jan 2014 15:58:42 +0100https://ask.sagemath.org/question/10958/taylor1x2x22-give-unexpected-results/?comment=16391#post-id-16391Comment by kcrisman for <p>When I calculated this by hand, the constant term is 1/4 but sage gives 3/4.</p>
<p>Sage:
$$\newcommand{\Bold}[1]{\mathbf{#1}}\frac{3}{16} {\left(x - 2\right)}^{2} - \frac{1}{4} x + \frac{3}{4}$$</p>
<p>My calculation:</p>
<p>$$\frac{1}{4} -\frac{1}{4}(x-2)+\frac{3}{16}(x-2)^2$$</p>
<p>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.</p>
<p>Any ideas? I running sage Sage Version 6.0,Release Date: 2013-12-17 under Ubuntu 12.10. Thanks.</p>
https://ask.sagemath.org/question/10958/taylor1x2x22-give-unexpected-results/?comment=16398#post-id-16398Maybe what @Ariyama wants is for Sage to not "simplify" the linear terms.Fri, 24 Jan 2014 15:05:20 +0100https://ask.sagemath.org/question/10958/taylor1x2x22-give-unexpected-results/?comment=16398#post-id-16398Comment by Shashank for <p>When I calculated this by hand, the constant term is 1/4 but sage gives 3/4.</p>
<p>Sage:
$$\newcommand{\Bold}[1]{\mathbf{#1}}\frac{3}{16} {\left(x - 2\right)}^{2} - \frac{1}{4} x + \frac{3}{4}$$</p>
<p>My calculation:</p>
<p>$$\frac{1}{4} -\frac{1}{4}(x-2)+\frac{3}{16}(x-2)^2$$</p>
<p>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.</p>
<p>Any ideas? I running sage Sage Version 6.0,Release Date: 2013-12-17 under Ubuntu 12.10. Thanks.</p>
https://ask.sagemath.org/question/10958/taylor1x2x22-give-unexpected-results/?comment=16399#post-id-16399The answer is the same in both cases. If you add 1/4 with 2/4 from the linear term you get 3/4.Fri, 24 Jan 2014 14:47:33 +0100https://ask.sagemath.org/question/10958/taylor1x2x22-give-unexpected-results/?comment=16399#post-id-16399Answer by kcrisman for <p>When I calculated this by hand, the constant term is 1/4 but sage gives 3/4.</p>
<p>Sage:
$$\newcommand{\Bold}[1]{\mathbf{#1}}\frac{3}{16} {\left(x - 2\right)}^{2} - \frac{1}{4} x + \frac{3}{4}$$</p>
<p>My calculation:</p>
<p>$$\frac{1}{4} -\frac{1}{4}(x-2)+\frac{3}{16}(x-2)^2$$</p>
<p>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.</p>
<p>Any ideas? I running sage Sage Version 6.0,Release Date: 2013-12-17 under Ubuntu 12.10. Thanks.</p>
https://ask.sagemath.org/question/10958/taylor1x2x22-give-unexpected-results/?answer=15964#post-id-15964There'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.Fri, 24 Jan 2014 15:09:21 +0100https://ask.sagemath.org/question/10958/taylor1x2x22-give-unexpected-results/?answer=15964#post-id-15964Comment by AndyH for <p>There's a way to at least get this to print.</p>
<pre><code>sage: f = 1/x^2
sage: f._maxima_().taylor((x,2,2))
1/4-(x-2)/4+3*(x-2)^2/16
</code></pre>
<p>However, it doesn't stick around when you send it back to Sage.</p>
<pre><code>sage: SR(_)
3/16*(x - 2)^2 - 1/4*x + 3/4
</code></pre>
<p>Indeed,</p>
<pre><code>sage: (x-2)/4
1/4*x - 1/2
</code></pre>
<p>It's possible to get this to not simplify</p>
<pre><code>sage: (x-2).mul(1/4,hold=True)
1/4*(x - 2)
</code></pre>
<p>but I'm not sure if we can <em>easily</em> massage the output of Maxima to automatically not simplify with that.</p>
https://ask.sagemath.org/question/10958/taylor1x2x22-give-unexpected-results/?comment=16397#post-id-16397Ah, 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 Fri, 24 Jan 2014 17:06:37 +0100https://ask.sagemath.org/question/10958/taylor1x2x22-give-unexpected-results/?comment=16397#post-id-16397