;;; Copyright © 2021 Gerald Sussman and Chris Hanson ;;; Copyright © 2022 David Thompson ;;; ;;; This program is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as ;;; published by the Free Software Foundation, either version 3 of the ;;; License, or (at your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;; General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this program. If not, see ;;; . (define (stormer-2 F h) (lambda (history) (+ (* 2 (x 0 history)) (* -1 (x 1 history)) (* (/ (expt h 2) 12) (+ (* 13 (F (t 0 history) (x 0 history))) (* -2 (F (t 1 history) (x 1 history))) (F (t 2 history) (x 2 history))))))) (define (stepper h integrator) (lambda (history) (extend-history (+ (t 0 history) h) (integrator history) history))) (define n:> >) (define n:- -) (define (evolver F h make-integrator) (let* ((integrator (make-integrator F h)) (step (stepper h integrator))) (define (evolve history n-steps) (if (n:> n-steps 0) (evolve (step history) (n:- n-steps 1)) history)) evolve))