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

Limit involving log(factorial(x)) incorrect #14793

Closed
ethankward opened this issue Jun 11, 2018 · 10 comments · Fixed by #19737
Closed

Limit involving log(factorial(x)) incorrect #14793

ethankward opened this issue Jun 11, 2018 · 10 comments · Fixed by #19737
Labels
Easy to Fix This is a good issue for new contributors. Feel free to work on this if no one else has already. limits series

Comments

@ethankward
Copy link
Contributor

From here, SymPy also gets this wrong but in a different way:

>>> from sympy import *
>>> x = Symbol('x')
>>> e = ((x + S(1)/2) * log(x) - x + log(2*pi)/2 - log(factorial(x)) + S(1)/(12*x))*x**3
>>> limit(e,x,oo)
-oo
>>> N(e.subs(x,1000))
0.00277777698412758

The correct answer is 1/360.

skirpichev added a commit to skirpichev/diofant that referenced this issue Jun 12, 2018
@0110G
Copy link

0110G commented Jun 21, 2018

I am new to open source and wanted to ask what is S(1) in the above code. Please help

@ethankward
Copy link
Contributor Author

S is a shortcut for sympify that turns a value into a SympPy object.

@dnabanita7
Copy link
Contributor

The correct answer is 0.00277777698412758 and if 1/360 is rounded it results to the output.
The error is in Mathematica not in sympy.

@dnabanita7
Copy link
Contributor

I guess thats all and this issue can be closed.

@oscarbenjamin
Copy link
Contributor

SymPy gives -oo for the limit so that isn't correct.

@dnabanita7
Copy link
Contributor

dnabanita7 commented Mar 12, 2019 via email

@dnabanita7
Copy link
Contributor

Ahh! sorry I get it. The problem is with limit() not with subs().
Can I take up this issue?

@dnabanita7
Copy link
Contributor

subs() returns the actual value while limit() declares it to be oo

@dnabanita7
Copy link
Contributor

dnabanita7 commented Mar 12, 2019

I am participating in GSoC-19.So,I was thinking of adding and extending Richardson to limit() to get exact value of the large numbers where limit() declares it to be oo.As well in https://docs.sympy.org/latest/modules/series/series.html ,it is written `TODO Richardson and Residue`` still needs work to be done.

@sachin-4099
Copy link
Contributor

sachin-4099 commented Jun 1, 2020

Works correctly on the current master:

In [1]: e = ((x + S(1)/2) * log(x) - x + log(2*pi)/2 - log(factorial(x)) + S(1)/(12*x))*x**3

In [2]: limit(e, x, oo)
Out[2]: 1/360

This issue only needs a test in order to be closed.

@sachin-4099 sachin-4099 added the Easy to Fix This is a good issue for new contributors. Feel free to work on this if no one else has already. label Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy to Fix This is a good issue for new contributors. Feel free to work on this if no one else has already. limits series
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants