# [Maxima] bug in the integrate()?

Dmitry Shkirmanov piminusmeson at bk.ru
Sat May 5 05:47:27 CDT 2012

```Hello, list, it seems that i have found a bug in the integrate() function.It is obvious that integrate(x^n*exp(-a*x^2+b*x),x,X_0,inf)
is equal to the diff(integrate(exp(-a*x^2+b*x),x,X_0,inf),b,n). The result can be obtained in terms of the error function.
Maple can do the integration without any trouble. Let's see what gives maxima.

ya at debian:~\$ maxima
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) assume(a>0);
(%o1)                               [a>  0]
(%i2) expr: exp(-a*x^2+b*x)*x;
2
b x - a x
(%o2)                           x %e
(%i3) 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:
(%i4) res1new:integrate(expr,x,X_0,inf)\$
Is  2 a X_0 - b  positive, negative, or zero?

positive;
Let's see the results:
first
(%i5) factor(ratsimp(res1));
2
b
---                           2    2                2
4 a                        4 a  X_0  - 4 a b X_0 + b
(%o5) (%e    (2 gamma_incomplete(1, --------------------------) a
4 a
2    2                2
1  4 a  X_0  - 4 a b X_0 + b    3/2
abs(2 a X_0 - b) + 2 gamma_incomplete(-, --------------------------) a    b
2             4 a
2    2                2
1  4 a  X_0  - 4 a b X_0 + b            2
X_0 - gamma_incomplete(-, --------------------------) sqrt(a) b ))
2             4 a
2
/(4 a  abs(2 a X_0 - b))
second:
(%i6) factor(ratsimp(res1new));
2    2                2
1  4 a  X_0  - 4 a b X_0 + b
(%o6) ((gamma_incomplete(-, --------------------------) sqrt(a) b
2             4 a
2
b
2    2                2       ---
4 a  X_0  - 4 a b X_0 + b        4 a      2
+ 2 gamma_incomplete(1, --------------------------) a) %e   )/(4 a )
4 a

The results are different!!!

Let's continue:(now 2 a X_0 -b is negative)

(%i7) res2:integrate(expr,x,X_0,inf)\$
Is  2 a X_0 - b  positive, negative, or zero?

negative;
(%i8) res2new:integrate(expr,x,X_0,inf)\$
Is  2 a X_0 - b  positive, negative, or zero?

negative;
(%i9) factor(ratsimp(res2));
2    2                2
1  4 a  X_0  - 4 a b X_0 + b
(%o9) - ((gamma_incomplete(-, --------------------------) b - 2 sqrt(%pi) b
2             4 a
2
b
2    2                2             ---
4 a  X_0  - 4 a b X_0 + b              4 a      3/2
- 2 gamma_incomplete(1, --------------------------) sqrt(a)) %e   )/(4 a   )
Let'see the difference between expressions with positive and negative2 a X_0 -b
4 a
(%i10)  factor(ratsimp(res2-res1new));
2
b
2    2                2                   ---
1  4 a  X_0  - 4 a b X_0 + b                    4 a
(gamma_incomplete(-, --------------------------) - sqrt(%pi)) b %e
2             4 a
(%o10) - ---------------------------------------------------------------------
3/2
2 a
But results must be the same, it can be seen from the
diff(integrate(exp(-a*x^2+b*x),x,X_0,inf),b).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120505/08a47636/attachment.html>
```