<< Previous exercise (3.77) | Index | Next exercise (3.79) >>

; Some test cases to verify an implementation.. (stream-ref (solve-2nd 1 0 0.0001 1 1) 10000) ; e (stream-ref (solve-2nd 0 -1 0.0001 1 0) 10472) ; cos pi/3 = 0.5 (stream-ref (solve-2nd 0 -1 0.0001 0 1) 5236) ; sin pi/6 = 0.5

I had the same solution has meteorgan and the program runs out of memory when trying to solve anything. I have memory limit to 1GB as well

`(define (solve-2nd a b dt y0 dy0) (define y (integral (delay dy) y0 dt)) (define dy (integral (delay ddy) dy0 dt)) (define ddy (add-streams (scale-stream dy a) (scale-stream y b))) y)`