(define (sum term a next b)
  (define (iter acc p)
    (if (> p b)
        acc
        (iter (+ acc (term p)) (next p))))
  (iter 0 a))
(define (simp-int f a b n)
  (let* ((h (/ (- b a) n))
         (y (lambda (k)
              (f (+ a (* k h)))))
         (term
           (lambda (k)
             (cond ((= k 0) (f a))
                   ((= k n) (f b))
                   ((even? k) (* 2 (y k)))
                   (else (* 4 (y k))))))
         (next (lambda (x) (+ x 1))))
    (/ (* h (sum term 0 next n)) 3)))