[GiNaC-list] series((x+x^2)^2,x,0) is broken
Richard B. Kreckel
kreckel at in.terlu.de
Sun Aug 6 19:43:13 CEST 2023
Dear Vitaly,
On 6/13/23 17:55, Vitaly Magerya wrote:
> Hi, all. I'm trying to expand expressions into series, and I've
> run into a case which looks broken (with the latest GiNaC):
>
> ginsh> series((x+x^2)^2,x,0);
> (Order(1)^2)*x^(-2)+Order(1)
>
> What I expect is Order(1) here, because the expression starts
> at O(x^2).
>
> Same problem with e.g. (x+sin(x))^2, and lots of other expressions.
> It seems that any non-trivial expression that starts at O(x)
> or higher to a power expands into this sort of an unhelpful
> result.
>
> Note that trying to remove the Order() parts does not work:
>
> ginsh> series_to_poly(series((x+x^2)^2,x,0));
> x^(-2)*Order(1)^2
>
> What I expect here is "0" instead.
>
> Any ideas on what's going on and how to fix it?
Please try commit 9435d80ac3.
(The evaluation Order(x)^e -> Order(x^e) for positive integer exponents
wasn't necessary but we may apply it anyways.)
-richy.
More information about the GiNaC-list
mailing list