# [Haskell-beginners] numerical integration over lists

Benjamin Edwards edwards.benj at gmail.com
Sun Feb 5 17:05:35 CET 2012

```The first two arguments to your function are not typed as lists in the
binding.

[Float] is a list of floats. (Float) is not.
On 5 Feb 2012 15:57, "Thomas Engel" <thomas.engel1 at gmx.net> wrote:

> Hello Henk-Jan,
> > >
> >
> > The line
> > >integriereListe [][]  = [0.0]
> > should be
> > >integriereListe [][]  = 0.0
> > as the line below that calculates a number, not a list of numbers
> > (that is, the type is different for that line).
> thanks for the hint. I have changed the function accordingly but there is
> still an error for the types.
>
> integriereListe::(Float)->(Float)->(Float)
> integriereListe [][]  = 0.0
> integriereListe (x:xs) (y:ys)   = (y - y2) /2 * (x2 -x)
>                                 where
>
>  Couldn't match expected type `Float' with actual type `[t0]'
>    In the pattern: x : xs
>    In an equation for `integriereListe':
>        integriereListe (x : xs) (y : ys)
>          = (y - y2) / 2 * (x2 - x)
>          where
>
> This are my first steps in haskell. I don't know whether my first basic
> approach is OK or is there a better solution for this calculation?
> There is no formula to map over a list and integrate, I only have two list
> with values. I can zip the lists together to have a list of tuples if this
> What I need is the first and the second value from each list, do the
> calculation,
> the second value will become the first value of the next calculation and
> so on until the end of the lists.
> I also need the result of the last calculation to add to the current
> calculation.
>
> My calculation in excel with VBA is working, but it's quite difficult for
> me to do this with functional programming.
>
> Any hints are welcome!
>
> Thomas
>
>
> _______________________________________________
> Beginners mailing list