rtoy / maxima

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

integrate gives complex area #2429

Open rtoy opened 4 months ago

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-06 08:19:23 Created by richhennessy610 on 2012-01-09 22:49:45 Original: https://sourceforge.net/p/maxima/bugs/2332


In evaluating integrate(exp(-signum(x-2)*x^3),x,-2,3); maxima gives complex result. Integrand is real valued and has well defined area under the curve. I would expect Maxima to give real number for result.

(%i2) load(abs_integrate); (%o2) C:/Maxima-5.25.1/share/maxima/5.25.1/share/contrib/integration/abs_integrate.mac (%i3) display2d:false; (%o3) false (%i4) integrate(exp(-signum(x-2)*x^3),x,-2,3); (%o4) gamma_incomplete(1/3,-8)/3-gamma_incomplete(1/3,27)/3 (%i5) rectform(float(%)); (%o5) -239.7616342762335*%i-137.5334645791589 (%i6) build_info(); Maxima version: 5.25.1 Maxima build date: 10:2 9/6/2011 Host type: i686-pc-mingw32 Lisp implementation type: GNU Common Lisp (GCL) Lisp implementation version: GCL 2.6.8 (%o6) "" (%i7)

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-06 08:19:24 Created by aleksasd on 2012-01-10 07:08:23 Original: https://sourceforge.net/p/maxima/bugs/2332/#2d91


(%i1) f:exp(-signum(x-2)*x^3)$

By properties of definite integral integrate(f,x,-2,3)=integrate(f,x,-2,0)+integrate(f,x,0,2)+integrate(f,x,2,3)

(%i2) integrate(f,x,-2,0)+integrate(f,x,0,2)+integrate(f,x,2,3)$ float(%), expand; sol:realpart(%);

(%o3) 277.7458676930253-4.263256414560601*10^-14*%i (%o4) 277.7458676930253

(%i5) /* test*/ first(quad_qags(exp(-signum(x-2)*x^3),x,-2,3)); (%o5) 277.7458676961945

Aleksas D.