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

Incorrect result for divergent integral #15496

Closed
ppurka opened this issue Dec 9, 2013 · 14 comments
Closed

Incorrect result for divergent integral #15496

ppurka opened this issue Dec 9, 2013 · 14 comments

Comments

@ppurka
Copy link
Member

ppurka commented Dec 9, 2013

From google spreadsheet which no one reads X-(

sage: integrate(x^2/exp(-1/(x^2+1))/(x^2+1),(x,-infinity,infinity)).n()
-3.3357920860949157

Wolfram alpha gives the correct answer.

The problem comes from here:

sage: D=1.00000000000000*x^2*e^(1/(x^2 + 1.00000000000000))/(x^2 + 1.00000000000
....: 000)
sage: numerical_integral(D,-oo,+oo)
(-3.3357920860949157, 4.262178610048295e-09)

and in one specific algorithm

sage: numerical_integral(D,-oo,+oo, algorithm="qag")
(-3.3357920860949157, 4.262178610048295e-09)
sage: numerical_integral(D,-oo,+oo, algorithm="qng")
(nan, nan)
sage: numerical_integral(D,-oo,+oo, algorithm="qags")
(nan, nan)

and this case is handled by
gsl_integration_qagi

And the problem can be cut into two parts:

sage: numerical_integral(D,0,+oo)
(-1.6678960430474579, 2.1310893050241475e-09)
sage: numerical_integral(D,-oo,0)
(-1.6678960430474579, 2.1310893050241475e-09)

CC: @kcrisman @sagetrac-jakobkroeker @slel @vinklein @rwst @tscrim

Component: calculus

Author: Frédéric Chapoton

Branch/Commit: u/chapoton/15496 @ 0661926

Reviewer: Travis Scrimshaw

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

@ppurka ppurka added this to the sage-6.1 milestone Dec 9, 2013
@kcrisman
Copy link
Member

kcrisman commented Dec 9, 2013

comment:1

This is not a symbolic Maxima problem, as the integral is just returned, so it's something about how we evaluate n on these unevaluated integrals.

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@fchapoton

This comment has been minimized.

@fchapoton

This comment has been minimized.

@fchapoton

This comment has been minimized.

@fchapoton

This comment has been minimized.

@fchapoton
Copy link
Contributor

Commit: 0661926

@fchapoton
Copy link
Contributor

Branch: u/chapoton/15496

@fchapoton
Copy link
Contributor

comment:10

here is a proposal : check that the limit is zero before doing the numerical integral


New commits:

0661926add some safety check for numerical integrals up to infinity

@fchapoton
Copy link
Contributor

Author: Frédéric Chapoton

@fchapoton
Copy link
Contributor

Changed stopgaps from todo to none

@fchapoton fchapoton modified the milestones: sage-6.4, sage-9.2 Jun 24, 2020
@fchapoton
Copy link
Contributor

comment:12

green bot, please review

@tscrim
Copy link
Collaborator

tscrim commented Jul 2, 2020

comment:15

LGTM.

@tscrim
Copy link
Collaborator

tscrim commented Jul 2, 2020

Reviewer: Travis Scrimshaw

@mkoeppe
Copy link
Member

mkoeppe commented Jul 8, 2020

comment:16

These have been merged into 9.2.beta4

@mkoeppe mkoeppe closed this as completed in 7e1f35f Jul 8, 2020
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

5 participants