Opened 8 years ago

Closed 7 years ago

Last modified 5 years ago

#11737 closed defect (fixed)

"integrate" fails to integrate a convergent integral (sin(x^2)/x^2).

Reported by: lfousse Owned by: burcin
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: calculus Keywords:
Cc: Merged in:
Authors: Reviewers: Dmitrii Pasechnik, Karl-Dieter Crisman
Report Upstream: Fixed upstream, in a later stable release. Work issues:
Branch: Commit:
Dependencies: #13364 Stopgaps:

Description (last modified by dimpase)

sage: N(integrate(sin(x^2)/(x^2), x, 1, infinity))
[...]
ValueError: Integral is divergent.

This worked fine until v4.5.3, fails from v4.6.1 onward. The expected output (with Maxima 5.29.1) is:

0.285736646322858

Change History (19)

comment:1 Changed 8 years ago by lfousse

  • Type changed from PLEASE CHANGE to defect

comment:2 Changed 8 years ago by zimmerma

  • Description modified (diff)

comment:3 Changed 8 years ago by kcrisman

  • Report Upstream changed from N/A to Not yet reported upstream; Will do shortly.

This is in Maxima. In the latest:

(%i1) integrate(sin(x^2)/(x^2),x,1,inf);

defint: integral is divergent.

It used to just return the integral.

(%i1) integrate(sin(x^2)/(x^2),x,1,inf);
                                 inf
                                /         2
                                [    sin(x )
(%o1)                           I    ------- dx
                                ]       2
                                /      x
                                 1

I think this integral should converge, right? By the p-test (well, with absolute values) for p=2? And numerical_integral agrees with your thing. This is probably a bug in Maxima, I'll put it there.

comment:4 Changed 8 years ago by kcrisman

  • Report Upstream changed from Not yet reported upstream; Will do shortly. to Reported upstream. Little or no feedback.

This is tracked at this Maxima bug artifact.

comment:5 Changed 8 years ago by lfousse

The absolute value of the function is dominated by 1/x^2, which is integrable on this particular interval.

comment:6 Changed 8 years ago by kcrisman

You say potato, I say potahto :)

comment:7 Changed 8 years ago by zimmerma

Karl-Dieter, please can you check the bug is fixed upstream? Laurent (Fousse) says it was caused by commit 59775311e53ef8a8fb5a3ad067a6c1cc153075d2 of maxima.

Paul

comment:8 Changed 8 years ago by kcrisman

As far as I can tell, it's not fixed upstream - I have 5.25.1. The bug report had a resolution but it was something where they apparently typed in the wrong integral.

I am ignorant of how to use git and I can't do a text search for that commit line, unfortunately, so I'll take Laurent's word for it. I've put that info on the bug tracker as well.

comment:9 follow-up: Changed 8 years ago by zimmerma

Laurent tested with both 5.24.0 and the last git maxima version (commit 01679c735de525a39fa1d893f9e1d9f86bd65f91) and he got:

    % ./maxima-local
    Maxima 5.25post/branch-5_25-base-231-g01679c7
    http://maxima.sourceforge.net
    using Lisp CLISP 2.49 (2010-07-07)
    Distributed under the GNU Public License. See the file COPYING.
    Dedicated to the memory of William Schelter.
    The function bug_report() provides bug reporting information.
    (%i1) integrate(sin(x^2)/(x^2),x,1,inf);
    defint: integral is divergent.
     -- an error. To debug this try: debugmode(true);

Please can you add this to the maxima bug tracker?

Paul

comment:10 in reply to: ↑ 9 Changed 8 years ago by kcrisman

Please can you add this to the maxima bug tracker?

I think that you may have missed the fact that I already did so in comment:4 three months ago. The person from Maxima who first looked at it must have tried something else incorrect, and I updated it yesterday with your information about the commit in question.

comment:11 Changed 8 years ago by kcrisman

This is now fixed upstream.

(%i1) display2d:false;
(%o1) false
(%i2) float(integrate(sin(x^2)/(x^2),x,1,inf));
(%o2) -.1767766952966368*(.2733129188747918*%i-.5348723621187719)*%i
 +.1767766952966368*(-.2733129188747918*%i-.5348723621187719)*%i
 -.1767766952966368*(.2733129188747918*%i-.5348723621187719)
 -.1767766952966368*(-.2733129188747918*%i-.5348723621187719)
(%i3) integrate(sin(x^2)/(x^2),x,1,inf);
(%o3) %i*gamma_incomplete(-1/2,%i)/2^(5/2)
 -gamma_incomplete(-1/2,%i)/2^(5/2)-%i*gamma_incomplete(-1/2,-%i)/2^(5/2)
 -gamma_incomplete(-1/2,-%i)/2^(5/2)

comment:12 Changed 8 years ago by zimmerma

Karl-Dieter, do you know in which release of Maxima this will be fixed? Or is there a simple patch we can integrate in Sage?

Paul

comment:13 Changed 8 years ago by kcrisman

  • Report Upstream changed from Reported upstream. Little or no feedback. to Fixed upstream, in a later stable release.

It's in the latest stable release, 5.27.0. Probably it will be easiest to just upgrade.

comment:14 follow-up: Changed 7 years ago by dimpase

  • Description modified (diff)

Both new Maxima and Wolfram Alpha give the value about 0.2857367, and not 0.28625044 (what you see in the ticket description). Changing the latter to reflect the reality.

Last edited 7 years ago by dimpase (previous) (diff)

comment:15 Changed 7 years ago by kcrisman

  • Reviewers set to Dmitrii Pasechnik
  • Status changed from new to needs_review

This is fixed (and doctested) at #13364.

comment:16 Changed 7 years ago by kcrisman

  • Milestone changed from sage-5.6 to sage-duplicate/invalid/wontfix
  • Reviewers changed from Dmitrii Pasechnik to Dmitrii Pasechnik, Karl-Dieter Crisman
  • Status changed from needs_review to positive_review

comment:17 Changed 7 years ago by jdemeyer

  • Dependencies set to #13364

comment:18 Changed 7 years ago by jdemeyer

  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:19 in reply to: ↑ 14 Changed 5 years ago by rws

Replying to dimpase:

Both new Maxima and Wolfram Alpha give the value about 0.2857367, and not 0.28625044 (what you see in the ticket description). Changing the latter to reflect the reality.

The value was still off in the last digit given in the test. Fixed in #16697

Note: See TracTickets for help on using tickets.