init: tool for graphing functions and slope fields in love2d
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
local function factorial(n)
|
||||
if n <= 2 then
|
||||
return n
|
||||
end
|
||||
return n * factorial(n-1)
|
||||
end
|
||||
|
||||
local function calculate_e(terms)
|
||||
local e = 1
|
||||
for i = 1, terms do
|
||||
e = e + 1 / factorial(i)
|
||||
end
|
||||
return e
|
||||
end
|
||||
return calculate_e(10)
|
||||
Reference in New Issue
Block a user