Opened 7 years ago
Closed 5 months ago
#15496 closed defect (fixed)
Incorrect result for divergent integral
Reported by:  ppurka  Owned by:  

Priority:  major  Milestone:  sage9.2 
Component:  calculus  Keywords:  
Cc:  kcrisman, jakobkroeker, slelievre, vklein, rws, tscrim  Merged in:  
Authors:  Frédéric Chapoton  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  u/chapoton/15496 (Commits)  Commit:  0661926ece85d45ed1018fa9d508dfcf7bb90add 
Dependencies:  Stopgaps: 
Description (last modified by )
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.262178610048295e09)
and in one specific algorithm
sage: numerical_integral(D,oo,+oo, algorithm="qag") (3.3357920860949157, 4.262178610048295e09) 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.1310893050241475e09) sage: numerical_integral(D,oo,0) (1.6678960430474579, 2.1310893050241475e09)
Change History (16)
comment:1 Changed 7 years ago by
 Cc kcrisman added
comment:2 Changed 7 years ago by
 Milestone changed from sage6.1 to sage6.2
comment:3 Changed 7 years ago by
 Milestone changed from sage6.2 to sage6.3
comment:4 Changed 6 years ago by
 Milestone changed from sage6.3 to sage6.4
comment:5 Changed 4 years ago by
 Cc jakobkroeker added
comment:6 Changed 5 months ago by
 Description modified (diff)
comment:7 Changed 5 months ago by
 Description modified (diff)
comment:8 Changed 5 months ago by
 Description modified (diff)
comment:9 Changed 5 months ago by
 Description modified (diff)
comment:10 Changed 5 months ago by
 Branch set to u/chapoton/15496
 Commit set to 0661926ece85d45ed1018fa9d508dfcf7bb90add
 Status changed from new to needs_review
here is a proposal : check that the limit is zero before doing the numerical integral
New commits:
0661926  add some safety check for numerical integrals up to infinity

comment:11 Changed 5 months ago by
 Milestone changed from sage6.4 to sage9.2
 Stopgaps todo deleted
comment:13 Changed 5 months ago by
 Cc vklein rws added
comment:14 Changed 5 months ago by
 Cc tscrim added
comment:15 Changed 5 months ago by
 Reviewers set to Travis Scrimshaw
 Status changed from needs_review to positive_review
LGTM.
comment:16 Changed 5 months ago by
 Resolution set to fixed
 Status changed from positive_review to closed
These have been merged into 9.2.beta4
Note: See
TracTickets for help on using
tickets.
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.