rtoy / maxima

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

integrate(t*cos(a*t^2 + b*t + c), t, 0, 1) => division by 0 #1456

Closed rtoy closed 3 months ago

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 16:05:43 Created by robert_dodier on 2010-09-23 03:35:56 Original: https://sourceforge.net/p/maxima/bugs/2081


integrate (t*cos(a*t^2 + b*t + c), t, 0, 1); => Division by 0

Maxima version: 5.22.1 Maxima build date: 22:6 8/11/2010 Host type: i686-redhat-linux-gnu Lisp implementation type: CLISP Lisp implementation version: 2.48 (2009-07-28) (built 3459348196) (memory 3490574775)

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 16:05:45 Created by willisbl on 2010-09-24 01:21:05 Original: https://sourceforge.net/p/maxima/bugs/2081/#48fd


Related, I think:

rectform(integrate (t*cos(a*t^2 + b*t + c), t)) --> division by zero

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 16:05:48 Created by crategus on 2010-10-02 13:18:19 Original: https://sourceforge.net/p/maxima/bugs/2081/#12f4


The example of the last posting is related to the reported bug ID: 3079975 - rectform(atan2(y,0)) -> division by zero.

Dieter Kaiser

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 16:05:52 Created by crategus on 2010-10-02 14:19:55 Original: https://sourceforge.net/p/maxima/bugs/2081/#7de9


The bug rectform(atan2(y,0)) -> division by zero has been fixed in revision 1.37 or rpart.lisp. The following example now works:

(%i1) rectform(integrate (t*cos(a*t^2 + b*t + c), t));

(%o1) -(sqrt(abs(a))*sqrt(4*a^2*t^2+4*a*b*t+b^2) *(((1024*(gamma_incomplete(1/2, (4*%i*a^2*t^2+4*%i*a*b*t +%i*b^2) /(4*a)) [...] and a lot of more terms

But the division by 0 for the example of this bug report is still present:

integrate (t*cos(a*t^2 + b*t + c), t, 0, 1); Division by 0 -- an error. To debug this try: debugmode(true);

Dieter Kaiser

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 16:05:55 Created by crategus on 2010-10-02 14:55:38 Original: https://sourceforge.net/p/maxima/bugs/2081/#0b7e


Maxima can integrate the indefinite integral of the example of this bug report. The difference is the flag generate-atan2 which is set to NIL in the function antideriv, when calling sinint to integrate the problem:

(%i4) integrate(t*cos(a*t^2+b*t+c),t),?generate\-atan2:false;

Division by 0 -- an error. To debug this try: debugmode(true);

(%i5) integrate(t*cos(a*t^2+b*t+c),t),?generate\-atan2:true; (%o5) -(sqrt(abs(a))*sqrt(4*a^2*t^2+4*a*b*t+b^2) *(((2048*gamma_incomplete(1/2, (4*%i*a^2*t^2+4*%i*a*b*t+%i*b^2) /(4*a)) [...] and more terms

Dieter Kaiser

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 16:05:59 Created by crategus on 2010-10-02 16:52:46 Original: https://sourceforge.net/p/maxima/bugs/2081/#6ab0


After revision 1.38 of rpart.lisp we get a further problem with the example of this bug report:

(%i3) integrate (t*cos(a*t^2 + b*t + c), t, 0, 1),ratprint:false; Is b positive or negative? p; sign: argument cannot be imaginary; found %i -- an error. To debug this try: debugmode(true);

Now, limit has a problem, because it tries to get the sign of a complex expression.

Dieter Kaiser

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 16:06:02 Created by crategus on 2010-10-02 17:25:32 Original: https://sourceforge.net/p/maxima/bugs/2081/#af8b


rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 16:06:06 Created by crategus on 2010-10-02 17:25:32 Original: https://sourceforge.net/p/maxima/bugs/2081/#02d8


With revision 1.102 of limit.lisp we now get a result for the integral of this example:

(%i1) integrate (t*cos(a*t^2 + b*t + c), t, 0, 1),ratprint:false; Is b positive or negative? p; (%o1) (((gamma_incomplete(1/2,%i*b^2/(4*a)) +gamma_incomplete(1/2,-%i*b^2/(4*a))) *sqrt(abs(a))*b*sin(atan2(b^2/a,0)/2) +(%i*gamma_incomplete(1/2,%i*b^2/(4*a)) -%i*gamma_incomplete(1/2,-%i*b^2/(4*a))) *sqrt(abs(a))*b*cos(atan2(b^2/a,0)/2) +(-2*gamma_incomplete(1,%i*b^2/(4*a)) -2*gamma_incomplete(1,-%i*b^2/(4*a))) *a) *sin((4*a*c-b^2)/(4*a)) +((%i*gamma_incomplete(1/2,%i*b^2/(4*a)) -%i*gamma_incomplete(1/2,-%i*b^2/(4*a))) *sqrt(abs(a))*b*sin(atan2(b^2/a,0)/2) +(-gamma_incomplete(1/2,%i*b^2/(4*a)) -gamma_incomplete(1/2,-%i*b^2/(4*a))) *sqrt(abs(a))*b*cos(atan2(b^2/a,0)/2) +(2*%i*gamma_incomplete(1,-%i*b^2/(4*a)) -2*%i*gamma_incomplete(1,%i*b^2/(4*a))) *a) *cos((4*a*c-b^2)/(4*a))) /(8*a^2) -(((gamma_incomplete(1/2,(%i*b^2+4*%i*a*b+4*%i*a^2)/(4*a)) +gamma_incomplete(1/2,-(%i*b^2+4*%i*a*b+4*%i*a^2)/(4*a))) *sqrt(abs(a))*b*sin(atan2((b^2+4*a*b+4*a^2)/a,0)/2) +(%i*gamma_incomplete(1/2,(%i*b^2+4*%i*a*b+4*%i*a^2)/(4*a)) -%i*gamma_incomplete(1/2,-(%i*b^2+4*%i*a*b+4*%i*a^2)/(4*a))) *sqrt(abs(a))*b*cos(atan2((b^2+4*a*b+4*a^2)/a,0)/2) +(-2*gamma_incomplete(1,(%i*b^2+4*%i*a*b+4*%i*a^2)/(4*a)) -2*gamma_incomplete(1,-(%i*b^2+4*%i*a*b+4*%i*a^2)/(4*a))) *a) *sin((4*a*c-b^2)/(4*a)) +((%i*gamma_incomplete(1/2,(%i*b^2+4*%i*a*b+4*%i*a^2)/(4*a)) -%i*gamma_incomplete(1/2,-(%i*b^2+4*%i*a*b+4*%i*a^2)/(4*a))) *sqrt(abs(a))*b*sin(atan2((b^2+4*a*b+4*a^2)/a,0)/2) +(-gamma_incomplete(1/2,(%i*b^2+4*%i*a*b+4*%i*a^2)/(4*a)) -gamma_incomplete(1/2,-(%i*b^2+4*%i*a*b+4*%i*a^2)/(4*a))) *sqrt(abs(a))*b*cos(atan2((b^2+4*a*b+4*a^2)/a,0)/2) +(2*%i*gamma_incomplete(1,-(%i*b^2+4*%i*a*b+4*%i*a^2)/(4*a)) -2*%i*gamma_incomplete(1,(%i*b^2+4*%i*a*b+4*%i*a^2)/(4*a))) *a) *cos((4*a*c-b^2)/(4*a))) /(8*a^2)

The numerical value for a=3, b=2, and c=1 is correct:

(%i2) rectform(float(psubst([a=3,b=2,c=1],%))); (%o2) -.1134426855743835

Closing this bug report as fixed. Dieter Kaiser