Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

series of x^s, when s is symbolic #15854

Open
dkrenn opened this issue Feb 24, 2014 · 3 comments
Open

series of x^s, when s is symbolic #15854

dkrenn opened this issue Feb 24, 2014 · 3 comments

Comments

@dkrenn
Copy link
Contributor

dkrenn commented Feb 24, 2014

We have the following behaviour:

sage: var('s')
s
sage: (x^s).series(x, 0)
Order(1)
sage: (x^s).series(x, 1)
(0^s) + Order(x)
sage: (x^s).series(x, 2)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-4-5abc79662303> in <module>()
----> 1 (x**s).series(x, Integer(2))

/usr/opt/sage-6.1.1/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.series (sage/symbolic/expression.cpp:17596)()

ValueError: power::eval(): division by zero

This output is weird and definitely wrong (since the correct output depends strongly on s.).

CC: @mforets

Component: symbolics

Keywords: symbolic, series, exponent

Issue created by migration from https://trac.sagemath.org/ticket/15854

@dkrenn dkrenn added this to the sage-6.2 milestone Feb 24, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@dkrenn
Copy link
Contributor Author

dkrenn commented Apr 16, 2015

comment:3

Still there in 6.6

@rwst
Copy link

rwst commented Jun 14, 2015

comment:4

Could you please specify what output exactly to expect?

@mforets
Copy link
Mannequin

mforets mannequin commented May 3, 2017

comment:5

there is no error if you declare s as integer:

sage: s = SR.var('s', domain='integer')
sage: (x^s).series(x, 2) # ok (?) or we expect x^s
(0^s) + (0^(s - 1)*s)*x + Order(x^2)

to compare, W|A gives various series representations. in this case maybe it could answer just x^s?

however, there is this closely related issue:

sage: n = SR.var('n', domain='integer')
sage: ((x+1/x)**n).series(x)  # wrong (what happened with n?)
1 + Order(x^20)

one expects something like 1/x^n*(1 + n*x^2 + O(x^3)).

this behaviour has side effects for example if you want to compute the residue of this function:

sage: f = 1/x*((x^2+1)/(2*x))**(2*k)
sage: f.residue(x==0)   # wrong
(1/2)^(2*k)

in fact:

sage: f(k=4)
1/256*(x^2 + 1)^8/x^9
sage: f(k=4).residue(x==0)
35/128
sage: f.residue(x==0).subs(k==4)
1/256
sage: res(k) = 1/2**(2*k)*binomial(2*k, k)   # correct answer
sage: res(k=4)
35/128

a bit unrelated, but let me mention that SymPy's residue gives wrong result for this one (0), and giac gives unevaluated expression.

@mforets mforets mannequin added s: needs work and removed s: needs info labels May 3, 2017
@mkoeppe mkoeppe removed this from the sage-6.4 milestone Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants