home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.math.symbolic
- Path: sparky!uunet!gatech!destroyer!news.iastate.edu!pv3448.vincent.iastate.edu!alex
- From: alex@iastate.edu (Roger Alexander)
- Subject: Gaussian moment integral Was: symbolic integral wanted
- Message-ID: <alex.711747852@pv3448.vincent.iastate.edu>
- Summary: Mma bug?
- Keywords: Mma, Gaussian moments, symbolic integration
- Sender: news@news.iastate.edu (USENET News System)
- Organization: Iowa State University, Ames IA
- Date: Tue, 21 Jul 1992 19:44:12 GMT
- Lines: 118
-
- In a previous post Richard Waterman (rpw001@fisher.stat.psu.edu)
- describes trouble getting Mma to evaluate the integral
-
- => ans1 = Integrate[x^a Exp[- b x^2 - c x],{x,0,Infinity}]
-
- and reports
-
- => Mma gives an "answer", no problem.
-
- But there *is* a problem, as he recognizes:
-
- => If I substitute in some numbers for {a,b,c}, say {2,1.5,-1},
- => into the symbolic answer I get a numerical result.
- =>
- => The question is, why isn't the result the same as when I do:
- =>
- => number2 = NIntegrate:x^2 Exp:- 1.5 x^2 + 1 x:,{x,0,Infinity}:
-
- The answer is, Mma's "answer" to the first problem is wrong. You
- can check this by looking it up in Gradshteyn/Ryzhik, for example.
- Or let Mma display the inconsistency itself:
-
- Mathematica 2.0 for DEC RISC
- Copyright 1988-91 Wolfram Research, Inc.
- -- X11 windows graphics initialized --
-
- In[1]:= ans1 = Integrate[x^a Exp[- b x^2 - c x],{x,0,Infinity}]
-
- 2
- -1 - a/2 a 3 c
- b c Gamma[1 + a] HypergeometricU[1 + -, -, ---]
- 2 2 4 b
- Out[1]= -------------------------------------------------------
- a
- 4 2
-
- (* Of course, the integral doesn't even converge unless certain
- conditions hold on a,b and c that Mma hasn't bothered to ask us about.
- An unsympathetic observer might feel that we deserve what happens
- next. This post merely reports facts; the reader who wishes may
- assign blame as seems appropriate. *)
-
- (* We assign values to the constants...*)
-
- In[2]:= subs = {a -> 2, b -> 3/2, c -> -1}
-
- 3
- Out[2]= {a -> 2, b -> -, c -> -1}
- 2
-
- (* ... substitute into the above expression, evaluate numerically ... *)
-
- In[3]:= %1 /. subs
-
- 3 1
- -HypergeometricU[2, -, -]
- 2 6
- Out[3]= -------------------------
- 18
-
- In[4]:= % //N
-
- Out[4]= -0.103054
-
- (* Thus Mma refutes its answer Out[1]: the integrand was positive. If
- we substitute the constants before integrating we get a different
- (correct? Exercise!) answer. *)
-
- In[5]:= Integrate[(x^a Exp[- b x^2 - c x])/.subs, {x,0,Infinity}]
-
- 1/6 1 1 3 1
- 12 + Sqrt[384] E Gamma[-, 0, -] + 3 HypergeometricU[2, -, -]
- 2 6 2 6
- Out[5]= ---------------------------------------------------------------
- 54
-
- In[6]:= % //N
-
- Out[6]= 0.656798
-
- =======================================
-
- I tried Maple V out on this integral too:
-
- |\^/| MAPLE V
- ._|\| |/|_. Copyright (c) 1981-1990 by the University of Waterloo.
- \ MAPLE / All rights reserved. MAPLE is a registered trademark of
- <____ ____> Waterloo Maple Software.
- | Type ? for help.
- > int(x^a * exp( -b*x^2 - c*x ),x=0..infinity);
- infinity
- /
- | a 2
- | x exp(- b x - c x) dx
- |
- /
- 0
-
- # Maple refuses to evaluate the integral without further information
- # on the constants a, b, and c.
-
- > a := 2: b := 3/2: c := -1:
- ________________________________________________________________________
- > int(x^a * exp( -b*x^2 - c*x ),x=0..infinity);
- 1/2 1/2 1/2
- 2/27 Pi exp(1/6) 3 2 + 1/9
-
- 1/2 1/2 1/2 1/2 1/2
- + 2/27 Pi exp(1/6) 3 2 erf(1/6 3 2 )
- ________________________________________________________________________
- > evalf(");
- .6567979782
- ------------------------------------------------------------------------
- --
- *_________________* "Faculty members encourage the free pursuit of
- Roger Alexander | learning in their students and protect academic
- alex@iastate.edu | freedom of students." --ISU Faculty Handbook
- *_________________* [official statement of policies & procedures]
-