Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Innaccuracy in a gammainc and , how best to override?
Date: Thu, 22 Sep 2011 05:16:26 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 28
Message-ID: <j5egba$da$1@newscl01ah.mathworks.com>
References: <e6d2bf35-7011-4fc8-baf4-45138f5e8798@a7g2000yqb.googlegroups.com> <j5dedo$1rj$1@newscl01ah.mathworks.com> <7583ba5c-88b2-48a7-8f24-f341f096c335@n40g2000yqb.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1316668586 426 172.30.248.46 (22 Sep 2011 05:16:26 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 22 Sep 2011 05:16:26 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:743877

DOD <dcodea@gmail.com> wrote in message <7583ba5c-88b2-48a7-8f24-f341f096c335@n40g2000yqb.googlegroups.com>...
> ......
> Integrate[Exp(t x ) (-((L x^(-1 - L/ Log[d] ))/ Log[d] )) ,{x,0,1}]
> ......
- - - - - - - - -
  Dennis, the MGF you are attempting to evaluate as a function of t is:

 MGF(t) = int('exp(t*x)*A*x^(A-1)','x',0,1)

and you apparently wish to use positive values of t as high as 50 combined with an 'A' value of .0267 or thereabouts.  You hope to use gammainc(-t,A) for this purpose.

  In my earlier posting I cast doubts as to the appropriateness of such negative values as inputs to matlab's 'gammainc'.  Actually 'gammainc' does accept them but appears to suffer catastrophic rounding errors for values of -t more negative than -30 or so, and this would explain the large "fluctuations" you observed.  Apparently the algorithm used in 'gammainc' does not envision being called upon by such negative values in its first argument along with a parameter as small as this A.

  However, there is a simple numerical method of evaluating MGF(t) and its derivative using matlab's quadrature routines.  Make the substitution

 u = x^A

so as to obtain

 MGF(t) = int('exp(t*u^(1/A))','u',0,1)

and

 dMGF(t)/dt = int('u^(1/A)*exp(t*u^(1/A))','u',0,1)

Each of these, and therefore their ratio, has no singularities and can readily be evaluated using various of the quadrature routines, 'quad', 'quadl', etc.

Roger Stafford