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.
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]:
Maxima branch_5_33_base_36_g202e3e9_dirty http://maxima.sourceforge.net using Lisp SBCL 1.1.15.debian Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%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? y; n 1 n/2 - 1/2 n (%o1) (gamma_incomplete(- + -, 0) 2 (- 1) 2 2 n 1 n/2 - 1/2 + gamma_incomplete(- + -, 0) 2 )/(sqrt(2) sqrt(%pi)) 2 2 (%i2) %, factor; n/2 - 1 n n + 1 2 ((- 1) + 1) gamma_incomplete(-----, 0) 2 (%o2) ------------------------------------------------ sqrt(%pi)
The gamma_incomplete((n+1)/2, 0)
is a bit ugly, but otherwise it looks good.