small algorithm to approximate an integral
This commit is contained in:
parent
f7b26cc80d
commit
21ab12cc9c
|
@ -0,0 +1,7 @@
|
|||
f x = x * x
|
||||
|
||||
n = 10000
|
||||
|
||||
integral f startX endX =
|
||||
sum $ map (\x -> squareLen * f (x * squareLen)) [1..n]
|
||||
where squareLen = (endX - startX) / n
|
Loading…
Reference in New Issue