home *** CD-ROM | disk | FTP | other *** search
- ; book pp.300-301
-
- (require "data/stackloss")
-
- (defun standardize (x)
- (let ((x-bar (mean x))
- (s (standard-deviation x)))
- (/ (- x x-bar) s)))
-
- (setf std-air (standardize air))
- (setf std-temp (standardize temp))
- (setf std-conc (standardize conc))
- (setf std-loss (standardize loss))
- (setf w (plot-points std-air std-temp))
- (send w :range '(0 1) -3 3)
- (setf indices (iseq (length std-air)))
-
- (defun interpolate (p)
- (let* ((alpha (* (/ pi 2) p))
- (s (sin alpha))
- (c (cos alpha))
- (x (+ (* c std-air) (* s std-temp)))
- (y (+ (* c std-conc) (* s std-loss))))
- (send w :point-coordinate 0 indices x)
- (send w :point-coordinate 1 indices y)
- (send w :redraw-content)))
- (slider (interval-slider-dialog '(0 1) :action #'interpolate))
-
- (send w :add-subordinate slider)
-