[Haskell-beginners] numerical integration over lists
Thomas Engel
thomas.engel1 at gmx.net
Sun Feb 5 17:32:44 CET 2012
Hello Benjamin,
>
> [Float] is a list of floats. (Float) is not.
thanks for pointing out an error. But now I get an other error message.
integriereListe::[Float]->[Float]->[Float]
integriereListe [][] = 0.0
integriereListe (x:xs) (y:ys) = (y - y2) / 2.0 * (x2 -x)
where
x2 = head xs
y2 = head ys
No instance for (Fractional [Float])
arising from a use of `/'
Possible fix: add an instance declaration for (Fractional [Float])
In the first argument of `(*)', namely `(y - y2) / 2.0'
In the expression: (y - y2) / 2.0 * (x2 - x)
In an equation for `integriereListe':
integriereListe (x : xs) (y : ys)
= (y - y2) / 2.0 * (x2 - x)
where
x2 = head xs
y2 = head ys
Thomas
More information about the Beginners
mailing list