AgentE382

Calculus

Oct 28th, 2013
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.25 KB | None | 0 0
  1. function riemann(func, first, last, rects, type)
  2.     local size, sum = (last - first) / rects, 0
  3.     for i = first, last, size do
  4.         sum = sum + func(type == "left" and i - 1 or type == "right" and i or i - .5) * size
  5.     end
  6.     return sum
  7. end
Advertisement
Add Comment
Please, Sign In to add comment