Ladies_Man

Integrate

Dec 17th, 2013
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.16 KB | None | 0 0
  1. (define (integrate f a b n)
  2.    (define x (/ (abs (- b a)) n))
  3.        (define (sum y k) (if (< y b)n(sum (+ y x) (+ k (abs (* x (f (+ y x)))))) k))
  4. (sum a 0.0))
Advertisement
Add Comment
Please, Sign In to add comment