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

Unevaluated integrals to infinity have nonsense numeric value #22567

Open
pelegm opened this issue Mar 10, 2017 · 6 comments
Open

Unevaluated integrals to infinity have nonsense numeric value #22567

pelegm opened this issue Mar 10, 2017 · 6 comments

Comments

@pelegm
Copy link
Contributor

pelegm commented Mar 10, 2017

Running

integrate(floor(x), x, 0, infinity, algorithm='sympy')

returns

integrate(floor(x), x, 0, +Infinity)

and trying

integrate(floor(x), x, 0, infinity, algorithm='sympy').n()

returns (!!!) -679.7441466712775. This is awfully wrong. It shows with any unevaluated integral.

CC: @kcrisman @rwst

Component: calculus

Keywords: integrate

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

@pelegm pelegm added this to the sage-7.6 milestone Mar 10, 2017
@pelegm

This comment has been minimized.

@rwst

This comment has been minimized.

@rwst rwst changed the title The integral of floor(x) from 0 to inf is negative Unevaluated integrals have nonsense numeric value Mar 11, 2017
@pelegm
Copy link
Contributor Author

pelegm commented Mar 11, 2017

comment:4

Note that it doesn't happen without algorithm='sympy'.

@rwst
Copy link

rwst commented Mar 12, 2017

comment:5

I don't think this is correct:

sage: integrate((1+x+x^2)^(1/3), x, 0, infinity)
integrate((x^2 + x + 1)^(1/3), x, 0, +Infinity)
sage: _.n()
8.835093500042741e+20

@kcrisman
Copy link
Member

Changed keywords from floor, integrate, sympy to integrate

@kcrisman
Copy link
Member

comment:6

I want to point out that all these integrals involve infinity. I can't remember any more exactly where to find it (did poke about a bit) but there should be code, and not original code, for how to deal with this situation - I think it just sends it to the GSL algorithm numerical_integral which would likely give nonsense for infinity. And indeed that is the case - compare this Sage cell:

sage: print numerical_integral(floor(x), 0, +Infinity)
sage: print numerical_integral((x^2 + x + 1)^(1/3), 0, +Infinity)
(-679.7441466712775, 632.307547415802)
(8.835093500042741e+20, 1.6991730463958232e+21)

@kcrisman kcrisman changed the title Unevaluated integrals have nonsense numeric value Unevaluated integrals to infinity have nonsense numeric value Mar 13, 2017
@mkoeppe mkoeppe removed this from the sage-7.6 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

4 participants