All pastes #707426 Raw Edit

Something

public text v1 · immutable
#707426 ·published 2007-09-22 22:17 UTC
rendered paste body
(define (simpson f a b n)
  (let ((h (/ (- b a) n)))
    (let ((term (lambda(k) (f (+ a (* k h))))))
      (* (/ h 3.0)
         (+ (sum term 0 inc1 n)
            (sum term 1 inc1 (- n 1))
            (* 2.0 (sum term 1 inc2 (- n 1))))))))