## #2403 bug in integrate(x*exp(-a*x^2+b*x),x,X_0,inf)

closed
nobody
5
2012-09-21
2012-05-11
ivan antonovich
No

Maxima 5.27.0 http://maxima.sourceforge.net
using Lisp CLISP 2.48 (2009-07-28)
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) display2d: false;
(%o1) false
(%i2) assume(a>0);
(%o2) [a > 0]
(%i3) expr: exp(-a*x^2+b*x)*x;
(%o3) x*%e^(b*x-a*x^2)
(%i4) res1:integrate(expr,x,X_0,inf)\$
Is 2*a*X_0-b positive, negative, or zero?

positive;
#============================================
#Let's do the integration once again:
#============================================
(%i5) res1new:integrate(expr,x,X_0,inf)\$
Is 2*a*X_0-b positive, negative, or zero?

positive;
#============================================
#Let's see the results
#============================================

#++++++++first++++++++++++

(%i6) factor(ratsimp(res1));
(%o6) %e^(b^2/(4*a))*(2*gamma_incomplete(1,(4*a^2*X_0^2-4*a*b*X_0+b^2)/(4*a))
*a*abs(2*a*X_0-b)
+2*gamma_incomplete(1/2,
(4*a^2*X_0^2-4*a*b*X_0+b^2)/(4*a))
*a^(3/2)*b*X_0
-gamma_incomplete(1/2,(4*a^2*X_0^2-4*a*b*X_0+b^2)/(4*a))
*sqrt(a)*b^2)
/(4*a^2*abs(2*a*X_0-b))

#++++++++second++++++++++++

(%i7) factor(ratsimp(res1new));
(%o7) (gamma_incomplete(1/2,(4*a^2*X_0^2-4*a*b*X_0+b^2)/(4*a))*sqrt(a)*b
+2*gamma_incomplete(1,(4*a^2*X_0^2-4*a*b*X_0+b^2)/(4*a))*a)
*%e^(b^2/(4*a))
/(4*a^2)
#============================================
#The results are different!!!
#============================================
#============================================
#Let's continue:(now 2 a X_0 -b is negative)
#============================================
(%i8) res2:integrate(expr,x,X_0,inf)\$
Is 2*a*X_0-b positive, negative, or zero?

negative;
(%i9) factor(ratsimp(res2));
(%o9) -(gamma_incomplete(1/2,(4*a^2*X_0^2-4*a*b*X_0+b^2)/(4*a))*b
-2*sqrt(%pi)*b
-2*gamma_incomplete(1,(4*a^2*X_0^2-4*a*b*X_0+b^2)/(4*a))*sqrt(a))
*%e^(b^2/(4*a))
/(4*a^(3/2))
#============================================
#Let'see the difference between expressions with positive and negative 2 a X_0 -b
#============================================
(%i10) factor(ratsimp(res2-res1new));
(%o10) -(gamma_incomplete(1/2,(4*a^2*X_0^2-4*a*b*X_0+b^2)/(4*a))-sqrt(%pi))
*b*%e^(b^2/(4*a))
/(2*a^(3/2))
#============================================
#But the results must be the same.
#============================================
P.S.
integrate(x^n*exp(-a*x^2+b*x),x,X_0,inf) can be programmed as diff(integrate(exp(-a*x^2+b*x),x,X_0,inf),b,n). To verify this one needs to change the order of integration and differentiation. The result can be obtained in terms of the error function. There is only one conditition -- a>0.

## Discussion

• labels: --> Lisp Core - Integration

• Raymond Toy
2012-08-15

In maxima 5.28post, the two integrals are identical for both 2*a*X_0-b positive and negative.

Marking as pending/worksforme

• Raymond Toy
2012-08-15

• status: open --> pending

• Raymond Toy
2012-09-21

• status: pending --> closed