Method: MoreMath::Functions.gamma

Defined in:
lib/more_math/functions.rb

.gamma(x) ⇒ Object

Returns the value of the gamma function, extended to a negative domain.



38
39
40
41
42
43
44
# File 'lib/more_math/functions.rb', line 38

def gamma(x)
  if x < 0.0
    return PI / (sin(PI * x) * exp(log_gamma(1 - x)))
  else
    exp(log_gamma(x))
  end
end