Skip to content

Instantly share code, notes, and snippets.

@jakevossen5
Created February 2, 2020 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakevossen5/ae3321742556e53d40b7585469c740d5 to your computer and use it in GitHub Desktop.
Save jakevossen5/ae3321742556e53d40b7585469c740d5 to your computer and use it in GitHub Desktop.
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