rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

integrate(sin(x)/x,-X,X) limit as X--> infinity is wrong #4076

Open rtoy opened 1 month ago

rtoy commented 1 month ago

Imported from SourceForge on 2024-07-09 11:16:42 Created by zzoo on 2023-11-17 03:15:28 Original: https://sourceforge.net/p/maxima/bugs/4213


This is from comment: https://sourceforge.net/p/maxima/mailman/message/51782153/ One can check this against other CAS systems with sage: sage: integrate(sin(x)/x, x,-M,M,algorithm='maxima').limit(M=infinity) 0 sage: integrate(sin(x)/x, x,-M,M,algorithm='giac').limit(M=infinity) pi sage: integrate(sin(x)/x, x,-M,M,algorithm='fricas').limit(M=infinity) pi

rtoy commented 1 month ago

Imported from SourceForge on 2024-07-09 11:16:44 Created by robert_dodier on 2023-11-24 18:59:04 Original: https://sourceforge.net/p/maxima/bugs/4213/#81a5


rtoy commented 1 month ago

Imported from SourceForge on 2024-07-09 11:16:47 Created by robert_dodier on 2023-11-24 18:59:04 Original: https://sourceforge.net/p/maxima/bugs/4213/#0157


For the record, the equivalent Maxima-specific formulation is

integrate (sin(x)/x, x, -M, M);
limit (%, x, M, inf);

Not clear to me where the error is entering the picture, whether integrate is calling the limit code and the error is in limit, or if integrate is getting mixed up on its own.

integrate has trouble with related problems if 0 is in the interval of integration, but it seems to be okay if 0 is excluded, e.g.

assume (M1 > 0);
foo: integrate (sin(x)/x, x, M1, inf);
ev (foo, M1 = 1/100, numer, expand);

seems okay (it's approximately pi/2) but

limit (foo, M1, 0, plus);

provokes "unfamiliar singularity".

rtoy commented 1 month ago

Imported from SourceForge on 2024-07-09 11:16:51 Created by willisbl on 2023-12-30 13:18:50 Original: https://sourceforge.net/p/maxima/bugs/4213/#1843


Incidentally:

OK:

(%i1)   integrate(sin(x)/x,x,minf,inf);
(%o1)   %pi

OK:

(%i2)   defint(sin(x)/x,x,minf,inf);
(%o2)   %pi

Not OK:

(%i3)   ldefint(sin(x)/x,x,minf,inf);
(%o3)   0

A better antiderivative for integrate(sin(x)/x,x,-M,M) is expintegral_si(M) - expintegral_si(-M). And

(%i26)  limit(expintegral_si(M) - expintegral_si(-M),M,inf);
(%o26)  %pi
rtoy commented 1 month ago

Imported from SourceForge on 2024-07-09 11:16:54 Created by rtoy on 2023-12-30 16:46:19 Original: https://sourceforge.net/p/maxima/bugs/4213/#bacf


I think that antiderivative is better than the one we return today which involves gamma_incomplete(0,%i*x). The occurrence of %i is kind of messy looking.