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

Fix product(-x, x, 1, SR.var('n')) to return (-1)^n*factorial(n) #31557

Open
slel opened this issue Mar 25, 2021 · 11 comments
Open

Fix product(-x, x, 1, SR.var('n')) to return (-1)^n*factorial(n) #31557

slel opened this issue Mar 25, 2021 · 11 comments

Comments

@slel
Copy link
Member

slel commented Mar 25, 2021

From #30520.

Observed:

sage: product(-x, x, 1, SR.var('n'))
#0: simplify_product(product='product(-_SAGE_VAR_x,_SAGE_VAR_x,1,_SAGE_VAR_n))
...
Traceback (most recent call last)
...
RuntimeError: ECL says: Error executing code in Maxima:
factorial: factorial of negative integer -1 not defined.

or equivalently:

sage: from sage.calculus.calculus import symbolic_product
sage: x, n = SR.var('x, n')
sage: symbolic_product(-x, x, 1, n)
#0: simplify_product(product='product(-_SAGE_VAR_x,_SAGE_VAR_x,1,_SAGE_VAR_n))
...
Traceback (most recent call last)
...
RuntimeError: ECL says: Error executing code in Maxima:
factorial: factorial of negative integer -1 not defined.

Expected:

sage: from sage.calculus.calculus import symbolic_product
sage: x, n = SR.var('x, n')
sage: symbolic_product(-x, x, 1, n)
(-1)^n*factorial(n)

Upstream: Reported upstream. Developers acknowledge bug.

CC: @robert-dodier @slel

Component: symbolics

Keywords: symbolic_product, maxima

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

@slel slel added this to the sage-9.3 milestone Mar 25, 2021
@slel
Copy link
Member Author

slel commented Mar 25, 2021

@robert-dodier
Copy link

comment:2

I've pushed commit c584c24 on maxima-code/master to fix this bug.

@slel
Copy link
Member Author

slel commented Apr 21, 2021

Upstream: Fixed upstream, but not in a stable release.

@slel

This comment has been minimized.

@slel
Copy link
Member Author

slel commented Apr 21, 2021

comment:3

Thanks for fixing this and for the heads-up.

This should be applied as a patch in Sage until
a Maxima release has this and we upgrade to it.

@slel

This comment has been minimized.

@slel
Copy link
Member Author

slel commented Apr 21, 2021

comment:4

Adding link to commit to ticket description.

@robert-dodier
Copy link

comment:5

Oops, spoke too soon. Commit c584c24 causes a stack overflow in some other code (namely simplify_sum). Commit c584c24 has been reverted, and I'm working on an update. Sorry to say the problem isn't actually fixed yet.

@mkoeppe
Copy link
Member

mkoeppe commented May 10, 2021

comment:6

Moving to 9.4, as 9.3 has been released.

@mkoeppe mkoeppe modified the milestones: sage-9.3, sage-9.4 May 10, 2021
@DaveWitteMorris

This comment has been minimized.

@DaveWitteMorris
Copy link
Member

Changed upstream from Fixed upstream, but not in a stable release. to Reported upstream. Developers acknowledge bug.

@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Aug 22, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 18, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 May 3, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Sep 19, 2022
@mkoeppe mkoeppe removed this from the sage-9.8 milestone Jan 29, 2023
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

4 participants