Thanks for the bug report.
If you know how to proceed, please open a ticket and post the url here.
- series goes through the ginac library (which is full of bugs and we
are trying to get rid off it)
- taylor goes through maxima which is much more reliable
The sympy library offers a nice alternative for symbolic computations.
Best
Vincent
Le 09/04/2021 à 16:01, TBK a écrit :
> To Whom it May Concern:
>
> Per the "Reporting Bugs" procedure
> <
https://doc.sagemath.org/html/en/developer/trac.html#reporting-bugs>, I am
> emailing sage-devel@ with a suspected bug. I am happy to open a TRAC
> ticket, if appropriate.
>
> I'm getting some seemingly incorrect series expansions. In particular,
> adding a constant is sometimes introducing an $x^{-1}$ term instead of an
> $x^0$ term. I have included below a fairly minimal repro. Sage correctly
> expands `(1-sqrt(1-x))/x`. However, sage insists that adding `123`
> introduces a `123*x^-1` term. Using `taylor()`, I get the expected
> expansion in both cases.
>
> This seems obviously incorrect, but I am new to sage so apologize if this
> is just pilot error. I looked for existing threads on power series bugs.
> The closest I found was this message
> <
https://groups.google.com/g/sage-devel/c/_rB24fZSHKs/m/XneaemQ4AgAJ> asserting
> that the combinatorial species code has long been riddled with bugs. If
> this is a bug, is taylor() believed to be less bug-riddled?
>
>
> *Repro:*
> {{{
> sage: ((1-sqrt(1-x))/x + 0).series(x,3)
>
> 1/2 + 1/8*x + 1/16*x^2 + Order(x^3) # correct
> sage: ((1-sqrt(1-x))/x + 123).series(x,3)
>
> 123*x^(-1) + 1/2 + 1/8*x + 1/16*x^2 + Order(x^3) # ???
> # taylor() correctly expands both
> sage: taylor((1-sqrt(1-x))/x + 0,x,0,2)
>
> 1/16*x^2 + 1/8*x + 1/2
> sage: taylor((1-sqrt(1-x))/x + 123,x,0,2)
>
> 1/16*x^2 + 1/8*x + 247/2
> }}}
>
> *Version:*
> │ SageMath version 9.2, Release Date: 2020-10-24 │
> │ Using Python 3.8.5. Type "help()" for help. │
> *OS*: macOS Catalina (10.15.7) (64-bit x86)
>
> Best,
> Thomas
>
>