[plt-scheme] HtDP Exercise 23.4.1
On Feb 10, 2009, at 9:53 AM, David Yrueta wrote:
> Hi Matthias --
>
> David, it is entirely safe to navigate around the mathematics
> sections in the book
>
> Yes, but I can't resist the challenge of tackling and hopefully
> solving an explicitly "mathematical" problem which I always
> considered beyond my reach :) (which is why I'm up at 5:30 am
> taking a whack at this thing!).
>
> I looked at the link sent to me by Thomas Chust and came up with
> this version of integrate-kepler (before reading your comments
> below, which I will):
>
> (define (integrate-kepler f left right)
> (local ((define (area-of-trap a b1 b2)
> (* a ( / ( + (f b1) (f b2)) 2)))
> (define midpoint ( / (+ right left) 2))
> (define alt-left (- midpoint left))
> (define alt-right (- right midpoint)))
> (+ (area-of-trap alt-left left midpoint)
> (area-of-trap alt-right midpoint right))))
>
> Am I in the ballpark?
Where are your examples? Tests? :-)