I m trying to do the following problem (there is a formula so I print-screened and uploaded it)
Formula http://img248.imageshack.us/img248/6558/problemh.jpg
(http://img248.imageshack.us/img248/6558/problemh.jpg)
Using accumulate:
(define (accumulate combiner null-value term a next b)
(if (> a b) null-value
(combiner (term a) (accumulate combiner null-value term (next a) next b))))
but I have pretty much no idea how to do it. It should look something like
(define (sum-func f k)...?
I m not sure how I should define f(x+ j*h) so that to put the changing number j (changes from 0 to the given number k) inside of it... In other words, I m pretty lost.
Thank you for the fast respond. I m studying for my midterms and I m trying to do the midterms from the previous years, but I just got stuck here. I know how to use the accumulate and everything in it, but I just don t know how to do the f(x + jh). I m trying this:
(define (sum-func term a b h x)
(define (next a) (+ a 1))
(define (term a) (term (+ x (* h a))))
(accumulate + 0 (term a) a (next a) b))
But it s not working...
In other words I don t know how to use the next (changing part) inside the term..
(sorry if I m explaining very clearly - English is not my native)