Skip to main content

gammln

gammln (num [, accuracy ])

The gammln function returns the natural log of the gamma function of num, where

num > 0. If num is complex, it returns a complex result. Optionally, accuracy can be used to specify the desired fractional accuracy. If num is complex, a complex result is returned. In this case, accuracy is ignored.

Details

The accuracy parameter specifies the fractional accuracy that you desire. That is, if you set accuracy to 1e-7, that means that you wish that the absolute value of (factual-freturned)/factual be less than 10-7.

For backward compatibility, if you don't include accuracy , gammln uses older code that achieves an accuracy of about 2x10-10.

With accuracy, newer code is used that is both faster and more accurate. The output has fractional accuracy better than 1x10-15 except for values near zero, where the absolute accuracy (factual-freturned) is better than 2x10-16.

The speed of calculation depends only weakly on accuracy. Higher accuracy is significantly slower than lower accuracy only for num between 6 and about 10.

See Also

gamma