Function of #cas
gamma
The exact value of the Gamma function at an integer or a half-integer, with a theorem about Mathlib’s Real.Gamma.
#cas (gamma q)Real.Gamma q = v.gamma computes the exact special values of , the ones you would look up in a table. At a positive integer the value is a factorial, and at a half-integer it is a rational multiple of . Each answer comes with a theorem about Mathlib’s Real.Gamma, so it means exactly what Mathlib means, down to Mathlib’s value 0 at the poles.
Examples (11)#
Basic Examples (2)
At a half-integer the value is a rational multiple of :
#cas (gamma (5/2))
exact value of Γ
3√π/4- Input (rational number)
5/2
Checked by Lean’s kernel: Gamma by a closed formula
Real.Gamma (5 / 2) = 3 * √Real.pi / 4
The certificate: 1 checked step
Gamma by a closed formula
Real.Gamma (5 / 2) = 3 * √Real.pi / 4
At a positive integer it is a factorial, :
#cas (gamma 5)
exact value of Γ
24- Input (rational number)
5
Checked by Lean’s kernel: Gamma by a closed formula
Real.Gamma 5 = 24
The certificate: 1 checked step
Gamma by a closed formula
Real.Gamma 5 = 24
Scope (3)
At a negative half-integer the formula is , here with :
#cas (gamma (-3/2))
exact value of Γ
4√π/3- Input (rational number)
-3/2
Checked by Lean’s kernel: Gamma by a closed formula
Real.Gamma (-(3 / 2)) = 4 * √Real.pi / 3
The certificate: 1 checked step
Gamma by a closed formula
Real.Gamma (-(3 / 2)) = 4 * √Real.pi / 3
The value at is :
#cas (gamma (1/2))
exact value of Γ
√π- Input (rational number)
1/2
Checked by Lean’s kernel: Gamma by a closed formula
Real.Gamma (1 / 2) = √Real.pi
The certificate: 1 checked step
Gamma by a closed formula
Real.Gamma (1 / 2) = √Real.pi
At a pole the report gives Mathlib’s value 0 and says that the point is a pole:
#cas (gamma (-3))
exact value of Γ
0 (Mathlib's value at the pole -3; Mathematica: ComplexInfinity)- Input (rational number)
-3
Checked by Lean’s kernel: Mathlib's Gamma at a pole
Real.Gamma (-3) = 0
The certificate: 1 checked step
Mathlib's Gamma at a pole
Real.Gamma (-3) = 0
Applications (1)
The tactic cas proves the same values inside a proof, and only the three standard axioms are used:
theorem gamma_seven_halves : Real.Gamma (7 / 2) = 15 / 8 * √Real.pi := by cas #print axioms gamma_seven_halves
gamma_seven_halves depends on the axioms propext, Classical.choice, Quot.sound.
Properties and Relations (1)
The recurrence takes to :
#cas (gamma (7/2))
exact value of Γ
15√π/8- Input (rational number)
7/2
Checked by Lean’s kernel: Gamma by a closed formula
Real.Gamma (7 / 2) = 15 * √Real.pi / 8
The certificate: 1 checked step
Gamma by a closed formula
Real.Gamma (7 / 2) = 15 * √Real.pi / 8
Possible Issues (4)
The call computes exact values at integers and half-integers only, and is neither:
#cas (gamma (1/3))
Error
gamma: exact values are computed at integers and half-integers; `1/3` is neither
The argument is a number, not a symbol:
#cas (gamma x)Error
gamma needs a closed expression; free symbols: x
The call is evaluated as the whole input, not inside a larger expression:
#cas (2 * gamma (5/2))
Error
unsupported symbolic function 'gamma'; expected abs, sin, cos, tan, sinh, cosh, tanh, atan/arctan, asin/arcsin, acos/arccos, exp, log, or sqrt. `gamma x` is evaluated as the whole input of `#cas (gamma x)`
The argument lies within :
#cas (gamma (1003/2))
Error
gamma: exact values are computed for |q| ≤ 1001/2; `1003/2` is outside that range
See Also
factorial · binomial · zeta · BernoulliB · cas
