[GiNaC-list] series((x+x^2)^2,x,0) is broken

Vitaly Magerya vmagerya at gmail.com
Tue Jun 13 17:55:55 CEST 2023


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?


More information about the GiNaC-list mailing list