rtoy / maxima

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

defint(exp(cos(x))*cos(sin(x)),x,0,2*%pi) wrong result 0 #1282

Closed rtoy closed 4 months ago

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 07:57:19 Created by *anonymous on 2010-06-23 15:53:28 Original: https://sourceforge.net/p/maxima/bugs/2019


The correct result is 2*%pi. This is a new bug appearing in version 5.21.1. Previous versions (<= 5.20.1 ) return just the integral expression unevaluated, which is fair enough, but most importantly is not a wrong result.

Maxima version: 5.21.1 Maxima build date: 8:13 4/26/2010 Host type: i686-pc-mingw32 also on linux system (fedora11) Lisp implementation type: GNU Common Lisp (GCL) also with cmucl Lisp implementation version: GCL 2.6.8 also with cmucl 19f

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 07:57:20 Created by rtoy on 2010-06-24 18:18:39 Original: https://sourceforge.net/p/maxima/bugs/2019/#7556


This particular integral is evaluated by computing the antiderivative. Perhaps in earlier versions, maxima could not, but maxima can now. So integrate(exp(cos(x))*cos(sin(x)),x) returns:

-(%i*conjugate(gamma_incomplete(0,-%e^(%i*x))) -%i*conjugate(gamma_incomplete(0,-%e^-(%i*x))) -%i*gamma_incomplete(0,-%e^(%i*x))+%i*gamma_incomplete(0,-%e^-(%i*x))) /4

Somehow this doesn't look right. Don't know if this is the correct antiderivative or not, but that's how maxima gets zero for the answer. At x=0, the result is zero, and by periodicity x=2*%pi is also zero. The wrong branch cut is taken, assuming the antiderivative is correct.

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 07:57:24 Created by crategus on 2010-06-24 18:42:50 Original: https://sourceforge.net/p/maxima/bugs/2019/#9343


We get a more simple result when expanding the function gamma_incomplete:

(%i3) integrate(exp(cos(x))*cos(sin(x)),x),gamma_expand:true; (%o3) -(%i*expintegral_ei(%e^(%i*x))-%i*expintegral_ei(%e^-(%i*x)))/2

I think this result is correct, as a reference I have compared the result with wolfram alpha.

But nevertheless, the definite integral is wrong and I am wondering why the conjugate function is introduced in the unsimplified result.

Dieter Kaiser

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 07:57:27 Created by rtoy on 2010-06-24 19:57:27 Original: https://sourceforge.net/p/maxima/bugs/2019/#1413


Expanding does produce a better answer. The derivative does equal the integrand.

Plotting realpart(%o3 )shows a discontinuity near %pi. (Perhaps it's a bug, but plot2d(%o3,[x,0,%pi]) produces a warning that a non-numeric value occurs somewhere. It seems as if it occurs everywhere except at 0.)

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 07:57:31 Created by dgildea on 2010-08-10 23:14:23 Original: https://sourceforge.net/p/maxima/bugs/2019/#264f


Fixed in defint.lisp rev 1.81: give up when we see %gamma_incomplete in limit-subs, due to discontinuities. This integral now returns a noun form. Ideally the code would identify the discontinuities and handle them.

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 07:57:34 Created by dgildea on 2010-08-10 23:14:23 Original: https://sourceforge.net/p/maxima/bugs/2019/#ddea


rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 07:57:38 Created by sf-robot on 2010-09-29 19:21:53 Original: https://sourceforge.net/p/maxima/bugs/2019/#6ecd


This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker).

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-04 07:57:41 Created by sf-robot on 2010-09-29 19:21:53 Original: https://sourceforge.net/p/maxima/bugs/2019/#1ed7