[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

more on gamma

From: Michael Creel
Subject: more on gamma
Date: Wed, 26 Mar 2003 11:47:03 -0800
User-agent: KMail/1.5.1

Thanks to a couple of you for suggestions. Two solutions to the gamma overflow 
problem are:

1) to write a wrapper function, as follows:

        function [f] = mc_gamma(z)

        test = z > 170;
        percentage = mean(test);
        if sum(test) > 0
                warning("mc_gamma: %f of the arguments were bounded", 
        z = 170*test + (1-test).*z;
        f = gamma(z);


This prevents overflows and gives you a warning when it occurs.

2) Run the input (x) to gamma(g(x)) through a nonlinear map that bounds it so 
that eps < g(x) < 170, e.g, 

        alpha = 165/(1 + exp(5 - psi(k+1,:))) + eps; # eps < alpha < 165

Now gamma(alpha) won't crash.

These two solutions together seem to be working for me, and were easy to 

Thanks, Michael

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]