RosettaCodeData/Task/Gamma-function/Pluto/gamma-function.pluto

13 lines
281 B
Plaintext

local fmt = require "fmt"
require "math2"
local function stirling(x)
return math.sqrt(2 * math.pi / x) * ((x / math.e) ^ x)
end
print(" x\tStirling\t\tLanczos\n")
for i = 1, 20 do
local d = i / 10
fmt.print("%4.2f\t%0.14f\t%0.14f", d, stirling(d), math.gamma(d))
end