First system info:
Maxima 5.32.1 http://maxima.sourceforge.net
using Lisp SBCL 1.1.14
on Mac OS X 10.8.5
The input with incorrect output is:
(%i1) integrate( x^n * exp(-x^2/2)/sqrt(2*%pi), x, minf, inf ); Is n + 1 positive, negative or zero? pos; Is n an integer? yes; (%o1) 0
The correct output can be obtained by answering "no" to whether n is an integer:
(%i3) integrate( x^n * exp(-x^2/2)/sqrt(2*%pi), x, minf, inf ); Is n + 1 positive, negative or zero? pos; Is n an integer? no; Is n positive, negative or zero? pos; n/2 - 1/2 n n + 1 n 1 n/2 - 1/2 2 (- 1) gamma(-----) + gamma(- + -) 2 2 2 2 (%o3) -------------------------------------------------------- sqrt(2) sqrt(%pi) (%i4) %, factor; n/2 - 1 n n + 1 2 ((- 1) + 1) gamma(-----) 2 (%o4) ---------------------------------- sqrt(%pi)
Problem seems to be that clearsign is called during
($ALOAD_MAC "simplification/facexp")
and assume database forgets that n+1>0
Works OK if you assume(n+1>0) before doing the integral,
or even if you just do the same integral twice in a row.
It looks like this was fixed by the patch I just pushed to fix [#2726]:
The
gamma_incomplete((n+1)/2, 0)
is a bit ugly, but otherwise it looks good.Related
Bugs:
#2726