Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Haskell Riemann Sum implementation
do_integral :: (Ord p, Num p, Fractional p) => (p -> p) -> p -> p -> p -> p
do_integral f start end dx
| end <= start = 0
| otherwise = (height * dx) + do_integral f (start + dx) end dx
where
height = f (start + (dx / 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment