On Thu, 10 Jan 2013 03:09:05 -0800 (PST)
LFS <
lfah...@gmail.com> wrote:
> Hiya, Probably I am just doing something wrong ...
> I have a cubic polynomial p(x) with "regular" coefficients and I
> wanted coefficients around e.g. (x-1). So I did p1=p.taylor(x,1,3).
> I get:
>
> x |--> 0.085*(x - 1)^3 - 0.255*(x - 1)^2 + 0.34*x + 1.23
> The polynomial is correct, but look at the last two terms.
>
> The 1-degree term is in x not in (x-1) and the difference has been
> added to the 0-degree term.
>
> I think i should get:
>
> x |--> 0.085*(x - 1)^3 - 0.255*(x - 1)^2 + 0.34*(x-1) + 1.57
The taylor() method calls maxima. Maxima returns the expected result,
but while converting the expression back to Sage, we "normalize" it,
and expand the linear term.
sage: ps
2*x^3 - x^2 + 2*x + 1
sage: mps = maxima(ps)
sage: mps
2*x^3-x^2+2*x+1
sage: mps.taylor(x, 1, 3)
4+6*(x-1)+5*(x-1)^2+2*(x-1)^3
sage: ps.taylor(x, 1, 3)
2*(x - 1)^3 + 5*(x - 1)^2 + 6*x - 2
Note that series() does the right thing:
sage: ps.series(x==1, 3)
4 + 6*(x - 1) + 5*(x - 1)^2 + Order((x - 1)^3)
There is a ticket to deprecate taylor() or switch it to use series():
http://trac.sagemath.org/sage_trac/ticket/6119
This requires some work to identify differences in the behavior of
these two functions and figure out how to best remedy these. Any help
is much appreciated.
Cheers,
Burcin