#lang racket (require (planet wcy/mpost-wrapper)) (provide main) (define (main) (define (compute_curve f xmin xmax xinc) (apply op.. (for/list ((x (in-range xmin xmax xinc))) (point x (f x))))) (define (f x) (op+ 1 (op** x 2))) (define (g x) (op- 2 (op** (op- x 1) 2))) (let* ((p (scale '1cm (compute_curve f -1 1.5 0.1))) (q (scale '1cm (compute_curve g -0.5 2 0.1)))) (fill (buildcycle p (op-reverse q)) #:withcolor (op+ 'red 'green)) (draw p #:withpen (scale '1bp 'pencircle)) (draw q #:withpen (scale '1bp 'pencircle)) (draw (op-- (point '-1cm 0) (point '2cm 0))) (draw (op-- (point 0 (op* (g -0.5) '1cm)) (point 0 (op* (f 1.5) '1cm)))) ))