Opened 3 years ago

Last modified 3 years ago

#22567 new defect

Unevaluated integrals to infinity have nonsense numeric value

Reported by: pelegm Owned by:
Priority: major Milestone: sage-7.6
Component: calculus Keywords: integrate
Cc: kcrisman, rws Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by rws)

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.

Change History (6)

comment:1 Changed 3 years ago by pelegm

  • Description modified (diff)

comment:2 Changed 3 years ago by kcrisman

  • Cc kcrisman rws added

comment:3 Changed 3 years ago by rws

  • Description modified (diff)
  • Summary changed from The integral of floor(x) from 0 to inf is negative to Unevaluated integrals have nonsense numeric value

comment:4 Changed 3 years ago by pelegm

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

comment:5 Changed 3 years ago by rws

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

comment:6 Changed 3 years ago by kcrisman

  • Keywords floor sympy removed
  • Summary changed from Unevaluated integrals have nonsense numeric value to Unevaluated integrals to infinity have nonsense numeric value

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)
Note: See TracTickets for help on using tickets.