tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
|
|
@ -0,0 +1,14 @@
|
|||
integrateClosed :: Fractional a => a -> [a] -> (a -> a) -> a -> a -> Int -> a
|
||||
integrateClosed v vs f a b n = approx f xs ws * h / v where
|
||||
m = fromIntegral (length vs - 1) * n
|
||||
h = (b-a) / fromIntegral m
|
||||
ws = overlap n vs
|
||||
xs = [a + h * fromIntegral i | i <- [0..m]]
|
||||
|
||||
overlap :: Num a => Int -> [a] -> [a]
|
||||
overlap n [] = []
|
||||
overlap n (x:xs) = x : inter n xs where
|
||||
inter 1 ys = ys
|
||||
inter n [] = x : inter (n-1) xs
|
||||
inter n [y] = (x+y) : inter (n-1) xs
|
||||
inter n (y:ys) = y : inter n ys
|
||||
Loading…
Add table
Add a link
Reference in a new issue