
(/VERSIONCHECK 2) 

(DEFUN |PLOT;Fnan?| (|x| $) (COND ((= |x| |x|) 'NIL) ('T 'T))) 

(DEFUN |PLOT;Pnan?| (|x| $)
  (SPADCALL (CONS (|function| |PLOT;Fnan?|) $) |x| (QREFELT $ 19))) 

(DEFUN |PLOT;listBranches;$L;3| (|plot| $)
  (PROG (|outList| |newl| #1=#:G699 |p| #2=#:G698 |curve|)
    (RETURN
     (SEQ (LETT |outList| NIL . #3=(|PLOT;listBranches;$L;3|))
          (SEQ (LETT |curve| NIL . #3#) (LETT #2# (QVELT |plot| 4) . #3#) G190
               (COND
                ((OR (ATOM #2#) (PROGN (LETT |curve| (CAR #2#) . #3#) NIL))
                 #4=(GO G191)))
               (SEQ (LETT |newl| NIL . #3#)
                    (SEQ (LETT |p| NIL . #3#)
                         (LETT #1# (QVELT |curve| 3) . #3#) G190
                         (COND
                          ((OR (ATOM #1#)
                               (PROGN (LETT |p| (CAR #1#) . #3#) NIL))
                           #4#))
                         (SEQ
                          (EXIT
                           (COND
                            ((|PLOT;Pnan?| |p| $)
                             (COND
                              ((NULL (NULL |newl|))
                               (SEQ
                                (LETT |outList|
                                      (CONS
                                       (LETT |newl| (NREVERSE |newl|) . #3#)
                                       |outList|)
                                      . #3#)
                                (EXIT (LETT |newl| NIL . #3#))))))
                            ('T (LETT |newl| (CONS |p| |newl|) . #3#)))))
                         (LETT #1# (CDR #1#) . #3#) #5=(GO G190) G191
                         (EXIT NIL))
                    (EXIT
                     (COND
                      ((NULL (NULL |newl|))
                       (LETT |outList|
                             (CONS (LETT |newl| (NREVERSE |newl|) . #3#)
                                   |outList|)
                             . #3#)))))
               (LETT #2# (CDR #2#) . #3#) #5# G191 (EXIT NIL))
          (EXIT |outList|))))) 

(DEFUN |PLOT;checkRange| (|r| $)
  (COND
   ((< (SPADCALL |r| (QREFELT $ 23)) (SPADCALL |r| (QREFELT $ 24)))
    (|error| "ranges cannot be negative"))
   ('T |r|))) 

(DEFUN |PLOT;intersect| (|s| |t| $)
  (|PLOT;checkRange|
   (SPADCALL (MAX (SPADCALL |s| (QREFELT $ 24)) (SPADCALL |t| (QREFELT $ 24)))
             (MIN (SPADCALL |s| (QREFELT $ 23)) (SPADCALL |t| (QREFELT $ 23)))
             (QREFELT $ 25))
   $)) 

(DEFUN |PLOT;union| (|s| |t| $)
  (SPADCALL (MIN (SPADCALL |s| (QREFELT $ 24)) (SPADCALL |t| (QREFELT $ 24)))
            (MAX (SPADCALL |s| (QREFELT $ 23)) (SPADCALL |t| (QREFELT $ 23)))
            (QREFELT $ 25))) 

(DEFUN |PLOT;join| (|l| |i| $)
  (PROG (|u| #1=#:G708 |r| |rr|)
    (RETURN
     (SEQ (LETT |rr| (|SPADfirst| |l|) . #2=(|PLOT;join|))
          (LETT |u|
                (COND ((EQL |i| 0) (|SPADfirst| (QVELT |rr| 1)))
                      ((EQL |i| 1) (SPADCALL (QVELT |rr| 1) (QREFELT $ 27)))
                      ('T (SPADCALL (QVELT |rr| 1) (QREFELT $ 28))))
                . #2#)
          (SEQ (LETT |r| NIL . #2#) (LETT #1# (CDR |l|) . #2#) G190
               (COND
                ((OR (ATOM #1#) (PROGN (LETT |r| (CAR #1#) . #2#) NIL))
                 (GO G191)))
               (SEQ
                (EXIT
                 (COND
                  ((EQL |i| 0)
                   (LETT |u| (|PLOT;union| |u| (|SPADfirst| (QVELT |r| 1)) $)
                         . #2#))
                  ((EQL |i| 1)
                   (LETT |u|
                         (|PLOT;union| |u|
                          (SPADCALL (QVELT |r| 1) (QREFELT $ 27)) $)
                         . #2#))
                  ('T
                   (LETT |u|
                         (|PLOT;union| |u|
                          (SPADCALL (QVELT |r| 1) (QREFELT $ 28)) $)
                         . #2#)))))
               (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
          (EXIT |u|))))) 

(DEFUN |PLOT;parametricRange| (|r| $) (|SPADfirst| (QVELT |r| 2))) 

(DEFUN |PLOT;minPoints;I;9| ($) (QREFELT $ 8)) 

(DEFUN |PLOT;setMinPoints;2I;10| (|n| $)
  (SEQ (COND ((< |n| 3) (|error| "three points minimum required")))
       (COND ((< (QREFELT $ 9) |n|) (SETELT $ 9 |n|))) (EXIT (SETELT $ 8 |n|)))) 

(DEFUN |PLOT;maxPoints;I;11| ($) (QREFELT $ 9)) 

(DEFUN |PLOT;setMaxPoints;2I;12| (|n| $)
  (SEQ (COND ((< |n| 3) (|error| "three points minimum required")))
       (COND ((< |n| (QREFELT $ 8)) (SETELT $ 8 |n|))) (EXIT (SETELT $ 9 |n|)))) 

(DEFUN |PLOT;screenResolution;I;13| ($) (QREFELT $ 11)) 

(DEFUN |PLOT;setScreenResolution;2I;14| (|n| $)
  (SEQ (COND ((< |n| 2) (|error| "buy a new terminal")))
       (EXIT (SETELT $ 11 |n|)))) 

(DEFUN |PLOT;adaptive?;B;15| ($) (QREFELT $ 7)) 

(DEFUN |PLOT;setAdaptive;2B;16| (|b| $) (SETELT $ 7 |b|)) 

(PUT '|PLOT;parametric?;$B;17| '|SPADreplace| '(XLAM (|p|) (QVELT |p| 0))) 

(DEFUN |PLOT;parametric?;$B;17| (|p| $) (QVELT |p| 0)) 

(DEFUN |PLOT;numFunEvals;I;18| ($) (QREFELT $ 10)) 

(DEFUN |PLOT;debug;2B;19| (|b| $) (SETELT $ 15 |b|)) 

(DEFUN |PLOT;xRange;$S;20| (|plot| $)
  (SPADCALL (QVELT |plot| 2) (QREFELT $ 27))) 

(DEFUN |PLOT;yRange;$S;21| (|plot| $)
  (SPADCALL (QVELT |plot| 2) (QREFELT $ 28))) 

(DEFUN |PLOT;tRange;$S;22| (|plot| $) (|SPADfirst| (QVELT |plot| 2))) 

(DEFUN |PLOT;select| (|l| |f| |g| $)
  (PROG (|m| |n| #1=#:G732 |p|)
    (RETURN
     (SEQ (LETT |m| (SPADCALL (|SPADfirst| |l|) |f|) . #2=(|PLOT;select|))
          (COND ((|PLOT;Fnan?| |m| $) (LETT |m| 0.0 . #2#)))
          (SEQ (LETT |p| NIL . #2#) (LETT #1# (CDR |l|) . #2#) G190
               (COND
                ((OR (ATOM #1#) (PROGN (LETT |p| (CAR #1#) . #2#) NIL))
                 (GO G191)))
               (SEQ (LETT |n| |m| . #2#)
                    (LETT |m| (SPADCALL |m| (SPADCALL |p| |f|) |g|) . #2#)
                    (EXIT (COND ((|PLOT;Fnan?| |m| $) (LETT |m| |n| . #2#)))))
               (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
          (EXIT |m|))))) 

(DEFUN |PLOT;rangeRefine| (|curve| |nRange| $)
  (PROG (|yRange| |xRange| |p| |t| |i| |d| |n| |q| |c| |s| #1=#:G750 |f| |h|
         |l|)
    (RETURN
     (SEQ
      (EXIT
       (SEQ (|PLOT;checkRange| |nRange| $)
            (LETT |l| (SPADCALL |nRange| (QREFELT $ 24))
                  . #2=(|PLOT;rangeRefine|))
            (LETT |h| (SPADCALL |nRange| (QREFELT $ 23)) . #2#)
            (LETT |t| (QVELT |curve| 2) . #2#)
            (LETT |p| (QVELT |curve| 3) . #2#)
            (LETT |f| (QVELT |curve| 0) . #2#)
            (SEQ G190
                 (COND
                  ((NULL
                    (COND ((NULL |t|) 'NIL) ('T (< (|SPADfirst| |t|) |l|))))
                   #3=(GO G191)))
                 (SEQ (LETT |t| (CDR |t|) . #2#)
                      (EXIT (LETT |p| (CDR |p|) . #2#)))
                 NIL #4=(GO G190) G191 (EXIT NIL))
            (LETT |c| NIL . #2#) (LETT |q| NIL . #2#)
            (SEQ G190
                 (COND
                  ((NULL
                    (COND ((OR (NULL |t|) (< |h| (|SPADfirst| |t|))) 'NIL)
                          ('T 'T)))
                   #3#))
                 (SEQ (LETT |c| (CONS (|SPADfirst| |t|) |c|) . #2#)
                      (LETT |q| (CONS (|SPADfirst| |p|) |q|) . #2#)
                      (LETT |t| (CDR |t|) . #2#)
                      (EXIT (LETT |p| (CDR |p|) . #2#)))
                 NIL #4# G191 (EXIT NIL))
            (COND
             ((NULL |c|)
              (PROGN
               (LETT #1# (|PLOT;basicPlot| |f| |nRange| $) . #2#)
               (GO #1#))))
            (COND
             ((< (|SPADfirst| |c|) |h|)
              (SEQ (LETT |c| (CONS |h| |c|) . #2#)
                   (LETT |q| (CONS (SPADCALL |h| |f|) |q|) . #2#)
                   (EXIT (SETELT $ 10 (+ (QREFELT $ 10) 1))))))
            (LETT |t| (LETT |c| (NREVERSE |c|) . #2#) . #2#)
            (LETT |p| (LETT |q| (NREVERSE |q|) . #2#) . #2#)
            (LETT |s|
                  (/ (- |h| |l|)
                     (-
                      (FLOAT (SPADCALL (QREFELT $ 30))
                             MOST-POSITIVE-DOUBLE-FLOAT)
                      1.0))
                  . #2#)
            (COND
             ((NULL (= (|SPADfirst| |t|) |l|))
              (SEQ (LETT |t| (LETT |c| (CONS |l| |c|) . #2#) . #2#)
                   (LETT |p| (LETT |q| (CONS (SPADCALL |l| |f|) |p|) . #2#)
                         . #2#)
                   (EXIT (SETELT $ 10 (+ (QREFELT $ 10) 1))))))
            (SEQ G190
                 (COND ((NULL (COND ((NULL (CDR |t|)) 'NIL) ('T 'T))) #3#))
                 (SEQ
                  (LETT |n|
                        (TRUNCATE
                         (/ (- (SPADCALL |t| (QREFELT $ 45)) (|SPADfirst| |t|))
                            |s|))
                        . #2#)
                  (LETT |d|
                        (/ (- (SPADCALL |t| (QREFELT $ 45)) (|SPADfirst| |t|))
                           (FLOAT (+ |n| 1) MOST-POSITIVE-DOUBLE-FLOAT))
                        . #2#)
                  (SEQ (LETT |i| 1 . #2#) G190
                       (COND ((QSGREATERP |i| |n|) #3#))
                       (SEQ
                        (SPADCALL |t| '|rest|
                                  (CONS (+ (|SPADfirst| |t|) |d|) (CDR |t|))
                                  (QREFELT $ 47))
                        (SPADCALL |p| '|rest|
                                  (CONS
                                   (SPADCALL (SPADCALL |t| (QREFELT $ 45)) |f|)
                                   (CDR |p|))
                                  (QREFELT $ 49))
                        (SETELT $ 10 (+ (QREFELT $ 10) 1))
                        (LETT |t| (CDR |t|) . #2#)
                        (EXIT (LETT |p| (CDR |p|) . #2#)))
                       (LETT |i| (QSADD1 |i|) . #2#) #4# G191 (EXIT NIL))
                  (LETT |t| (CDR |t|) . #2#) (EXIT (LETT |p| (CDR |p|) . #2#)))
                 NIL #4# G191 (EXIT NIL))
            (LETT |xRange|
                  (SPADCALL (|PLOT;select| |q| (ELT $ 51) (ELT $ 52) $)
                            (|PLOT;select| |q| (ELT $ 51) (ELT $ 53) $)
                            (QREFELT $ 25))
                  . #2#)
            (LETT |yRange|
                  (SPADCALL (|PLOT;select| |q| (ELT $ 54) (ELT $ 52) $)
                            (|PLOT;select| |q| (ELT $ 54) (ELT $ 53) $)
                            (QREFELT $ 25))
                  . #2#)
            (EXIT (VECTOR |f| (LIST |nRange| |xRange| |yRange|) |c| |q|))))
      #1# (EXIT #1#))))) 

(DEFUN |PLOT;adaptivePlot|
       (|curve| |tRange| |xRange| |yRange| |pixelfraction| $)
  (PROG (|p| |t| |todo2| |todo1| |tj| |tm| |st| |n| #1=#:G777 |dp| |s2| |s1|
         |b2| |a2| |b1| |a1| |y2| |x2| |y1| |x1| |y0| |x0| |sp| |t2| |t1| |t0|
         |todop| |todot| |headerp| |headert| |tLimit| |maxLength| |minLength|
         |f| |tDiff| |h| |l| |yDiff| |xDiff|)
    (RETURN
     (SEQ
      (LETT |xDiff|
            (- (SPADCALL |xRange| (QREFELT $ 23))
               (SPADCALL |xRange| (QREFELT $ 24)))
            . #2=(|PLOT;adaptivePlot|))
      (LETT |yDiff|
            (- (SPADCALL |yRange| (QREFELT $ 23))
               (SPADCALL |yRange| (QREFELT $ 24)))
            . #2#)
      (COND ((OR (= |xDiff| 0.0) (= |yDiff| 0.0)) (EXIT |curve|)))
      (LETT |l| (SPADCALL |tRange| (QREFELT $ 24)) . #2#)
      (LETT |h| (SPADCALL |tRange| (QREFELT $ 23)) . #2#)
      (LETT |tDiff| (- |h| |l|) . #2#)
      (EXIT
       (COND ((= |tDiff| 0.0) |curve|)
             (#3='T
              (SEQ (LETT |t| (QVELT |curve| 2) . #2#)
                   (EXIT
                    (COND ((< (LENGTH |t|) 3) |curve|)
                          (#3#
                           (SEQ (LETT |p| (QVELT |curve| 3) . #2#)
                                (LETT |f| (QVELT |curve| 0) . #2#)
                                (LETT |minLength|
                                      (/ (FLOAT 4 MOST-POSITIVE-DOUBLE-FLOAT)
                                         (FLOAT 500
                                                MOST-POSITIVE-DOUBLE-FLOAT))
                                      . #2#)
                                (LETT |maxLength|
                                      (/ 1.0
                                         (FLOAT 6 MOST-POSITIVE-DOUBLE-FLOAT))
                                      . #2#)
                                (LETT |tLimit|
                                      (/ |tDiff|
                                         (FLOAT (* |pixelfraction| 500)
                                                MOST-POSITIVE-DOUBLE-FLOAT))
                                      . #2#)
                                (SEQ G190
                                     (COND
                                      ((NULL
                                        (COND ((NULL |t|) 'NIL)
                                              ('T (< (|SPADfirst| |t|) |l|))))
                                       #4=(GO G191)))
                                     (SEQ (LETT |t| (CDR |t|) . #2#)
                                          (EXIT (LETT |p| (CDR |p|) . #2#)))
                                     NIL #5=(GO G190) G191 (EXIT NIL))
                                (EXIT
                                 (COND ((< (LENGTH |t|) 3) |curve|)
                                       (#3#
                                        (SEQ (LETT |headert| |t| . #2#)
                                             (LETT |headerp| |p| . #2#)
                                             (LETT |st| |t| . #2#)
                                             (LETT |sp| |p| . #2#)
                                             (LETT |todot| NIL . #2#)
                                             (LETT |todop| NIL . #2#)
                                             (SEQ G190
                                                  (COND
                                                   ((NULL
                                                     (COND
                                                      ((NULL (CDR (CDR |st|)))
                                                       'NIL)
                                                      ('T 'T)))
                                                    #4#))
                                                  (SEQ
                                                   (LETT |todot|
                                                         (SPADCALL |todot| |st|
                                                                   (QREFELT $
                                                                            56))
                                                         . #2#)
                                                   (LETT |todop|
                                                         (SPADCALL |todop| |sp|
                                                                   (QREFELT $
                                                                            57))
                                                         . #2#)
                                                   (LETT |st| (CDR |st|) . #2#)
                                                   (EXIT
                                                    (LETT |sp| (CDR |sp|)
                                                          . #2#)))
                                                  NIL #5# G191 (EXIT NIL))
                                             (LETT |st| |headert| . #2#)
                                             (LETT |sp| |headerp| . #2#)
                                             (LETT |todo1| |todot| . #2#)
                                             (LETT |todo2| |todop| . #2#)
                                             (LETT |n| 0 . #2#)
                                             (SEQ
                                              (EXIT
                                               (SEQ G190
                                                    (COND
                                                     ((NULL
                                                       (COND
                                                        ((NULL |todo1|) 'NIL)
                                                        ('T 'T)))
                                                      #4#))
                                                    (SEQ
                                                     (LETT |st|
                                                           (|SPADfirst|
                                                            |todo1|)
                                                           . #2#)
                                                     (LETT |t0|
                                                           (|SPADfirst| |st|)
                                                           . #2#)
                                                     (LETT |t1|
                                                           (SPADCALL |st|
                                                                     (QREFELT $
                                                                              45))
                                                           . #2#)
                                                     (LETT |t2|
                                                           (SPADCALL |st|
                                                                     (QREFELT $
                                                                              58))
                                                           . #2#)
                                                     (COND
                                                      ((< |h| |t2|)
                                                       (PROGN
                                                        (LETT #1# |$NoValue|
                                                              . #2#)
                                                        (GO #1#))))
                                                     (EXIT
                                                      (COND
                                                       ((< (- |t2| |t0|)
                                                           |tLimit|)
                                                        (SEQ
                                                         (LETT |todo1|
                                                               (CDR |todo1|)
                                                               . #2#)
                                                         (LETT |todo2|
                                                               (CDR |todo2|)
                                                               . #2#)
                                                         (EXIT
                                                          (COND
                                                           ((NULL
                                                             (NULL |todo1|))
                                                            (SEQ
                                                             (LETT |t|
                                                                   (|SPADfirst|
                                                                    |todo1|)
                                                                   . #2#)
                                                             (EXIT
                                                              (LETT |p|
                                                                    (|SPADfirst|
                                                                     |todo2|)
                                                                    . #2#))))))))
                                                       ('T
                                                        (SEQ
                                                         (LETT |sp|
                                                               (|SPADfirst|
                                                                |todo2|)
                                                               . #2#)
                                                         (LETT |x0|
                                                               (SPADCALL
                                                                (|SPADfirst|
                                                                 |sp|)
                                                                (QREFELT $ 51))
                                                               . #2#)
                                                         (LETT |y0|
                                                               (SPADCALL
                                                                (|SPADfirst|
                                                                 |sp|)
                                                                (QREFELT $ 54))
                                                               . #2#)
                                                         (LETT |x1|
                                                               (SPADCALL
                                                                (SPADCALL |sp|
                                                                          (QREFELT
                                                                           $
                                                                           59))
                                                                (QREFELT $ 51))
                                                               . #2#)
                                                         (LETT |y1|
                                                               (SPADCALL
                                                                (SPADCALL |sp|
                                                                          (QREFELT
                                                                           $
                                                                           59))
                                                                (QREFELT $ 54))
                                                               . #2#)
                                                         (LETT |x2|
                                                               (SPADCALL
                                                                (SPADCALL |sp|
                                                                          (QREFELT
                                                                           $
                                                                           60))
                                                                (QREFELT $ 51))
                                                               . #2#)
                                                         (LETT |y2|
                                                               (SPADCALL
                                                                (SPADCALL |sp|
                                                                          (QREFELT
                                                                           $
                                                                           60))
                                                                (QREFELT $ 54))
                                                               . #2#)
                                                         (LETT |a1|
                                                               (/ (- |x1| |x0|)
                                                                  |xDiff|)
                                                               . #2#)
                                                         (LETT |b1|
                                                               (/ (- |y1| |y0|)
                                                                  |yDiff|)
                                                               . #2#)
                                                         (LETT |a2|
                                                               (/ (- |x2| |x1|)
                                                                  |xDiff|)
                                                               . #2#)
                                                         (LETT |b2|
                                                               (/ (- |y2| |y1|)
                                                                  |yDiff|)
                                                               . #2#)
                                                         (LETT |s1|
                                                               (SPADCALL
                                                                (+
                                                                 (SPADCALL |a1|
                                                                           2
                                                                           (QREFELT
                                                                            $
                                                                            62))
                                                                 (SPADCALL |b1|
                                                                           2
                                                                           (QREFELT
                                                                            $
                                                                            62)))
                                                                (QREFELT $ 63))
                                                               . #2#)
                                                         (LETT |s2|
                                                               (SPADCALL
                                                                (+
                                                                 (SPADCALL |a2|
                                                                           2
                                                                           (QREFELT
                                                                            $
                                                                            62))
                                                                 (SPADCALL |b2|
                                                                           2
                                                                           (QREFELT
                                                                            $
                                                                            62)))
                                                                (QREFELT $ 63))
                                                               . #2#)
                                                         (LETT |dp|
                                                               (+ (* |a1| |a2|)
                                                                  (* |b1|
                                                                     |b2|))
                                                               . #2#)
                                                         (COND
                                                          ((< |s1| |maxLength|)
                                                           (COND
                                                            ((< |s2|
                                                                |maxLength|)
                                                             (COND
                                                              ((OR (= |s1| 0.0)
                                                                   (= |s2|
                                                                      0.0))
                                                               (EXIT
                                                                (SEQ
                                                                 (LETT |todo1|
                                                                       (CDR
                                                                        |todo1|)
                                                                       . #2#)
                                                                 (LETT |todo2|
                                                                       (CDR
                                                                        |todo2|)
                                                                       . #2#)
                                                                 (EXIT
                                                                  (COND
                                                                   ((NULL
                                                                     (NULL
                                                                      |todo1|))
                                                                    (SEQ
                                                                     (LETT |t|
                                                                           (|SPADfirst|
                                                                            |todo1|)
                                                                           . #2#)
                                                                     (EXIT
                                                                      (LETT |p|
                                                                            (|SPADfirst|
                                                                             |todo2|)
                                                                            . #2#)))))))))
                                                              ((< |s1|
                                                                  |minLength|)
                                                               (COND
                                                                ((OR
                                                                  (< |s2|
                                                                     |minLength|)
                                                                  (<
                                                                   (QREFELT $
                                                                            14)
                                                                   (/
                                                                    (/ |dp|
                                                                       |s1|)
                                                                    |s2|)))
                                                                 (EXIT
                                                                  (SEQ
                                                                   (LETT
                                                                    |todo1|
                                                                    (CDR
                                                                     |todo1|)
                                                                    . #2#)
                                                                   (LETT
                                                                    |todo2|
                                                                    (CDR
                                                                     |todo2|)
                                                                    . #2#)
                                                                   (EXIT
                                                                    (COND
                                                                     ((NULL
                                                                       (NULL
                                                                        |todo1|))
                                                                      (SEQ
                                                                       (LETT
                                                                        |t|
                                                                        (|SPADfirst|
                                                                         |todo1|)
                                                                        . #2#)
                                                                       (EXIT
                                                                        (LETT
                                                                         |p|
                                                                         (|SPADfirst|
                                                                          |todo2|)
                                                                         . #2#)))))))))))
                                                              ('T
                                                               (COND
                                                                ((<
                                                                  (QREFELT $
                                                                           14)
                                                                  (/
                                                                   (/ |dp|
                                                                      |s1|)
                                                                   |s2|))
                                                                 (EXIT
                                                                  (SEQ
                                                                   (LETT
                                                                    |todo1|
                                                                    (CDR
                                                                     |todo1|)
                                                                    . #2#)
                                                                   (LETT
                                                                    |todo2|
                                                                    (CDR
                                                                     |todo2|)
                                                                    . #2#)
                                                                   (EXIT
                                                                    (COND
                                                                     ((NULL
                                                                       (NULL
                                                                        |todo1|))
                                                                      (SEQ
                                                                       (LETT
                                                                        |t|
                                                                        (|SPADfirst|
                                                                         |todo1|)
                                                                        . #2#)
                                                                       (EXIT
                                                                        (LETT
                                                                         |p|
                                                                         (|SPADfirst|
                                                                          |todo2|)
                                                                         . #2#))))))))))))))))
                                                         (COND
                                                          ((< (QREFELT $ 9)
                                                              |n|)
                                                           (PROGN
                                                            (LETT #1#
                                                                  |$NoValue|
                                                                  . #2#)
                                                            (GO #1#)))
                                                          ('T
                                                           (LETT |n| (+ |n| 1)
                                                                 . #2#)))
                                                         (LETT |st| (CDR |t|)
                                                               . #2#)
                                                         (EXIT
                                                          (COND
                                                           ((NULL
                                                             (CDR (CDR |st|)))
                                                            (SEQ
                                                             (LETT |tm|
                                                                   (/
                                                                    (+ |t0|
                                                                       |t1|)
                                                                    (FLOAT 2
                                                                           MOST-POSITIVE-DOUBLE-FLOAT))
                                                                   . #2#)
                                                             (LETT |tj| |tm|
                                                                   . #2#)
                                                             (SPADCALL |t|
                                                                       '|rest|
                                                                       (CONS
                                                                        |tj|
                                                                        (CDR
                                                                         |t|))
                                                                       (QREFELT
                                                                        $ 47))
                                                             (SPADCALL |p|
                                                                       '|rest|
                                                                       (CONS
                                                                        (SPADCALL
                                                                         |tj|
                                                                         |f|)
                                                                        (CDR
                                                                         |p|))
                                                                       (QREFELT
                                                                        $ 49))
                                                             (LETT |todo1|
                                                                   (SPADCALL
                                                                    |todo1| |t|
                                                                    (QREFELT $
                                                                             56))
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (SPADCALL
                                                                    |todo2| |p|
                                                                    (QREFELT $
                                                                             57))
                                                                   . #2#)
                                                             (LETT |t|
                                                                   (CDR |t|)
                                                                   . #2#)
                                                             (LETT |p|
                                                                   (CDR |p|)
                                                                   . #2#)
                                                             (LETT |todo1|
                                                                   (SPADCALL
                                                                    |todo1| |t|
                                                                    (QREFELT $
                                                                             56))
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (SPADCALL
                                                                    |todo2| |p|
                                                                    (QREFELT $
                                                                             57))
                                                                   . #2#)
                                                             (LETT |t|
                                                                   (CDR |t|)
                                                                   . #2#)
                                                             (LETT |p|
                                                                   (CDR |p|)
                                                                   . #2#)
                                                             (LETT |tm|
                                                                   (/
                                                                    (+ |t1|
                                                                       |t2|)
                                                                    (FLOAT 2
                                                                           MOST-POSITIVE-DOUBLE-FLOAT))
                                                                   . #2#)
                                                             (LETT |tj| |tm|
                                                                   . #2#)
                                                             (SPADCALL |t|
                                                                       '|rest|
                                                                       (CONS
                                                                        |tj|
                                                                        (CDR
                                                                         |t|))
                                                                       (QREFELT
                                                                        $ 47))
                                                             (SPADCALL |p|
                                                                       '|rest|
                                                                       (CONS
                                                                        (SPADCALL
                                                                         |tj|
                                                                         |f|)
                                                                        (CDR
                                                                         |p|))
                                                                       (QREFELT
                                                                        $ 49))
                                                             (LETT |todo1|
                                                                   (SPADCALL
                                                                    |todo1| |t|
                                                                    (QREFELT $
                                                                             56))
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (SPADCALL
                                                                    |todo2| |p|
                                                                    (QREFELT $
                                                                             57))
                                                                   . #2#)
                                                             (LETT |todo1|
                                                                   (CDR
                                                                    |todo1|)
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (CDR
                                                                    |todo2|)
                                                                   . #2#)
                                                             (EXIT
                                                              (COND
                                                               ((NULL
                                                                 (NULL
                                                                  |todo1|))
                                                                (SEQ
                                                                 (LETT |t|
                                                                       (|SPADfirst|
                                                                        |todo1|)
                                                                       . #2#)
                                                                 (EXIT
                                                                  (LETT |p|
                                                                        (|SPADfirst|
                                                                         |todo2|)
                                                                        . #2#))))))))
                                                           ('T
                                                            (SEQ
                                                             (LETT |tm|
                                                                   (/
                                                                    (+ |t0|
                                                                       |t1|)
                                                                    (FLOAT 2
                                                                           MOST-POSITIVE-DOUBLE-FLOAT))
                                                                   . #2#)
                                                             (LETT |tj| |tm|
                                                                   . #2#)
                                                             (SPADCALL |t|
                                                                       '|rest|
                                                                       (CONS
                                                                        |tj|
                                                                        (CDR
                                                                         |t|))
                                                                       (QREFELT
                                                                        $ 47))
                                                             (SPADCALL |p|
                                                                       '|rest|
                                                                       (CONS
                                                                        (SPADCALL
                                                                         |tj|
                                                                         |f|)
                                                                        (CDR
                                                                         |p|))
                                                                       (QREFELT
                                                                        $ 49))
                                                             (LETT |todo1|
                                                                   (SPADCALL
                                                                    |todo1| |t|
                                                                    (QREFELT $
                                                                             56))
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (SPADCALL
                                                                    |todo2| |p|
                                                                    (QREFELT $
                                                                             57))
                                                                   . #2#)
                                                             (LETT |t|
                                                                   (CDR |t|)
                                                                   . #2#)
                                                             (LETT |p|
                                                                   (CDR |p|)
                                                                   . #2#)
                                                             (LETT |todo1|
                                                                   (SPADCALL
                                                                    |todo1| |t|
                                                                    (QREFELT $
                                                                             56))
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (SPADCALL
                                                                    |todo2| |p|
                                                                    (QREFELT $
                                                                             57))
                                                                   . #2#)
                                                             (LETT |t|
                                                                   (CDR |t|)
                                                                   . #2#)
                                                             (LETT |p|
                                                                   (CDR |p|)
                                                                   . #2#)
                                                             (LETT |todo1|
                                                                   (CDR
                                                                    |todo1|)
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (CDR
                                                                    |todo2|)
                                                                   . #2#)
                                                             (LETT |tm|
                                                                   (/
                                                                    (+ |t1|
                                                                       |t2|)
                                                                    (FLOAT 2
                                                                           MOST-POSITIVE-DOUBLE-FLOAT))
                                                                   . #2#)
                                                             (LETT |tj| |tm|
                                                                   . #2#)
                                                             (SPADCALL |t|
                                                                       '|rest|
                                                                       (CONS
                                                                        |tj|
                                                                        (CDR
                                                                         |t|))
                                                                       (QREFELT
                                                                        $ 47))
                                                             (SPADCALL |p|
                                                                       '|rest|
                                                                       (CONS
                                                                        (SPADCALL
                                                                         |tj|
                                                                         |f|)
                                                                        (CDR
                                                                         |p|))
                                                                       (QREFELT
                                                                        $ 49))
                                                             (LETT |todo1|
                                                                   (SPADCALL
                                                                    |todo1| |t|
                                                                    (QREFELT $
                                                                             56))
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (SPADCALL
                                                                    |todo2| |p|
                                                                    (QREFELT $
                                                                             57))
                                                                   . #2#)
                                                             (LETT |t|
                                                                   (CDR |t|)
                                                                   . #2#)
                                                             (LETT |p|
                                                                   (CDR |p|)
                                                                   . #2#)
                                                             (LETT |todo1|
                                                                   (SPADCALL
                                                                    |todo1| |t|
                                                                    (QREFELT $
                                                                             56))
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (SPADCALL
                                                                    |todo2| |p|
                                                                    (QREFELT $
                                                                             57))
                                                                   . #2#)
                                                             (LETT |todo1|
                                                                   (CDR
                                                                    |todo1|)
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (CDR
                                                                    |todo2|)
                                                                   . #2#)
                                                             (EXIT
                                                              (COND
                                                               ((NULL
                                                                 (NULL
                                                                  |todo1|))
                                                                (SEQ
                                                                 (LETT |t|
                                                                       (|SPADfirst|
                                                                        |todo1|)
                                                                       . #2#)
                                                                 (EXIT
                                                                  (LETT |p|
                                                                        (|SPADfirst|
                                                                         |todo2|)
                                                                        . #2#)))))))))))))))
                                                    NIL #5# G191 (EXIT NIL)))
                                              #1# (EXIT #1#))
                                             (EXIT
                                              (COND
                                               ((< 0 |n|)
                                                (SEQ
                                                 (SETELT $ 10
                                                         (+ (QREFELT $ 10)
                                                            |n|))
                                                 (LETT |t| (QVELT |curve| 2)
                                                       . #2#)
                                                 (LETT |p| (QVELT |curve| 3)
                                                       . #2#)
                                                 (LETT |xRange|
                                                       (SPADCALL
                                                        (|PLOT;select| |p|
                                                         (ELT $ 51) (ELT $ 52)
                                                         $)
                                                        (|PLOT;select| |p|
                                                         (ELT $ 51) (ELT $ 53)
                                                         $)
                                                        (QREFELT $ 25))
                                                       . #2#)
                                                 (LETT |yRange|
                                                       (SPADCALL
                                                        (|PLOT;select| |p|
                                                         (ELT $ 54) (ELT $ 52)
                                                         $)
                                                        (|PLOT;select| |p|
                                                         (ELT $ 54) (ELT $ 53)
                                                         $)
                                                        (QREFELT $ 25))
                                                       . #2#)
                                                 (EXIT
                                                  (VECTOR (QVELT |curve| 0)
                                                          (LIST |tRange|
                                                                |xRange|
                                                                |yRange|)
                                                          |t| |p|))))
                                               (#3# |curve|))))))))))))))))))) 

(DEFUN |PLOT;basicPlot| (|f| |tRange| $)
  (PROG (|yRange| |xRange| |p| |t| |l| #1=#:G789 |i| |s| |h|)
    (RETURN
     (SEQ (|PLOT;checkRange| |tRange| $)
          (LETT |l| (SPADCALL |tRange| (QREFELT $ 24)) . #2=(|PLOT;basicPlot|))
          (LETT |h| (SPADCALL |tRange| (QREFELT $ 23)) . #2#)
          (LETT |t| (SPADCALL |l| (QREFELT $ 66)) . #2#)
          (LETT |p| (SPADCALL (SPADCALL |l| |f|) (QREFELT $ 67)) . #2#)
          (LETT |s|
                (/ (- |h| |l|)
                   (FLOAT (- (SPADCALL (QREFELT $ 30)) 1)
                          MOST-POSITIVE-DOUBLE-FLOAT))
                . #2#)
          (SEQ (LETT |i| 2 . #2#)
               (LETT #1# (- (SPADCALL (QREFELT $ 30)) 1) . #2#) G190
               (COND ((QSGREATERP |i| #1#) (GO G191)))
               (SEQ (LETT |l| (+ |l| |s|) . #2#)
                    (LETT |t| (CONS |l| |t|) . #2#)
                    (EXIT (LETT |p| (CONS (SPADCALL |l| |f|) |p|) . #2#)))
               (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191 (EXIT NIL))
          (LETT |t| (NREVERSE (CONS |h| |t|)) . #2#)
          (LETT |p| (NREVERSE (CONS (SPADCALL |h| |f|) |p|)) . #2#)
          (LETT |xRange|
                (SPADCALL (|PLOT;select| |p| (ELT $ 51) (ELT $ 52) $)
                          (|PLOT;select| |p| (ELT $ 51) (ELT $ 53) $)
                          (QREFELT $ 25))
                . #2#)
          (LETT |yRange|
                (SPADCALL (|PLOT;select| |p| (ELT $ 54) (ELT $ 52) $)
                          (|PLOT;select| |p| (ELT $ 54) (ELT $ 53) $)
                          (QREFELT $ 25))
                . #2#)
          (EXIT (VECTOR |f| (LIST |tRange| |xRange| |yRange|) |t| |p|)))))) 

(DEFUN |PLOT;zoom;$S$;27| (|p| |xRange| $)
  (VECTOR (QVELT |p| 0) (LIST |xRange| (SPADCALL (QVELT |p| 1) (QREFELT $ 28)))
          (QVELT |p| 2) (QVELT |p| 3) (QVELT |p| 4))) 

(DEFUN |PLOT;zoom;$2S$;28| (|p| |xRange| |yRange| $)
  (VECTOR (QVELT |p| 0) (LIST |xRange| |yRange|) (QVELT |p| 2) (QVELT |p| 3)
          (QVELT |p| 4))) 

(DEFUN |PLOT;basicRefine| (|curve| |nRange| $)
  (PROG (|yRange| |xRange| |p| |t| |pm| |tm| |f| |h| |l| |tRange|)
    (RETURN
     (SEQ
      (LETT |tRange| (|SPADfirst| (QVELT |curve| 1)) . #1=(|PLOT;basicRefine|))
      (LETT |curve|
            (VECTOR (QVELT |curve| 0) (QVELT |curve| 1) (QVELT |curve| 2)
                    (QVELT |curve| 3))
            . #1#)
      (LETT |t|
            (QSETVELT |curve| 2 (SPADCALL (QVELT |curve| 2) (QREFELT $ 70)))
            . #1#)
      (LETT |p|
            (QSETVELT |curve| 3 (SPADCALL (QVELT |curve| 3) (QREFELT $ 71)))
            . #1#)
      (LETT |l| (SPADCALL |nRange| (QREFELT $ 24)) . #1#)
      (LETT |h| (SPADCALL |nRange| (QREFELT $ 23)) . #1#)
      (LETT |f| (QVELT |curve| 0) . #1#)
      (SEQ G190
           (COND
            ((NULL
              (COND ((NULL (CDR |t|)) 'NIL) ('T (< (|SPADfirst| |t|) |h|))))
             (GO G191)))
           (SEQ
            (EXIT
             (COND
              ((< (SPADCALL |t| (QREFELT $ 45)) |l|)
               (SEQ (LETT |t| (CDR |t|) . #1#)
                    (EXIT (LETT |p| (CDR |p|) . #1#))))
              ('T
               (SEQ
                (LETT |tm|
                      (/ (+ (|SPADfirst| |t|) (SPADCALL |t| (QREFELT $ 45)))
                         (FLOAT 2 MOST-POSITIVE-DOUBLE-FLOAT))
                      . #1#)
                (LETT |pm| (SPADCALL |tm| |f|) . #1#)
                (SETELT $ 10 (+ (QREFELT $ 10) 1))
                (SPADCALL |t| '|rest| (CONS |tm| (CDR |t|)) (QREFELT $ 47))
                (LETT |t| (CDR (CDR |t|)) . #1#)
                (SPADCALL |p| '|rest| (CONS |pm| (CDR |p|)) (QREFELT $ 49))
                (EXIT (LETT |p| (CDR (CDR |p|)) . #1#)))))))
           NIL (GO G190) G191 (EXIT NIL))
      (LETT |t| (QVELT |curve| 2) . #1#) (LETT |p| (QVELT |curve| 3) . #1#)
      (LETT |xRange|
            (SPADCALL (|PLOT;select| |p| (ELT $ 51) (ELT $ 52) $)
                      (|PLOT;select| |p| (ELT $ 51) (ELT $ 53) $)
                      (QREFELT $ 25))
            . #1#)
      (LETT |yRange|
            (SPADCALL (|PLOT;select| |p| (ELT $ 54) (ELT $ 52) $)
                      (|PLOT;select| |p| (ELT $ 54) (ELT $ 53) $)
                      (QREFELT $ 25))
            . #1#)
      (EXIT
       (VECTOR (QVELT |curve| 0) (LIST |tRange| |xRange| |yRange|) |t| |p|)))))) 

(DEFUN |PLOT;refine;2$;30| (|p| $)
  (SPADCALL |p| (|PLOT;parametricRange| |p| $) (QREFELT $ 72))) 

(DEFUN |PLOT;refine;$S$;31| (|p| |nRange| $)
  (PROG (|yRange| |xRange| |curves| #1=#:G813 |c| #2=#:G812 |tlimit| #3=#:G811
         #4=#:G810 |tRange|)
    (RETURN
     (SEQ (SETELT $ 10 0)
          (LETT |tRange| (|PLOT;parametricRange| |p| $)
                . #5=(|PLOT;refine;$S$;31|))
          (LETT |nRange| (|PLOT;intersect| |tRange| |nRange| $) . #5#)
          (LETT |curves|
                (PROGN
                 (LETT #4# NIL . #5#)
                 (SEQ (LETT |c| NIL . #5#) (LETT #3# (QVELT |p| 4) . #5#) G190
                      (COND
                       ((OR (ATOM #3#) (PROGN (LETT |c| (CAR #3#) . #5#) NIL))
                        #6=(GO G191)))
                      (SEQ
                       (EXIT
                        (LETT #4#
                              (CONS (|PLOT;basicRefine| |c| |nRange| $) #4#)
                              . #5#)))
                      (LETT #3# (CDR #3#) . #5#) #7=(GO G190) G191
                      (EXIT (NREVERSE0 #4#))))
                . #5#)
          (LETT |xRange| (|PLOT;join| |curves| 1 $) . #5#)
          (LETT |yRange| (|PLOT;join| |curves| 2 $) . #5#)
          (COND
           ((SPADCALL (QREFELT $ 36))
            (SEQ
             (LETT |tlimit| (COND ((SPADCALL |p| (QREFELT $ 38)) 8) ('T 1))
                   . #5#)
             (LETT |curves|
                   (PROGN
                    (LETT #2# NIL . #5#)
                    (SEQ (LETT |c| NIL . #5#) (LETT #1# |curves| . #5#) G190
                         (COND
                          ((OR (ATOM #1#)
                               (PROGN (LETT |c| (CAR #1#) . #5#) NIL))
                           #6#))
                         (SEQ
                          (EXIT
                           (LETT #2#
                                 (CONS
                                  (|PLOT;adaptivePlot| |c| |nRange| |xRange|
                                   |yRange| |tlimit| $)
                                  #2#)
                                 . #5#)))
                         (LETT #1# (CDR #1#) . #5#) #7# G191
                         (EXIT (NREVERSE0 #2#))))
                   . #5#)
             (LETT |xRange| (|PLOT;join| |curves| 1 $) . #5#)
             (EXIT (LETT |yRange| (|PLOT;join| |curves| 2 $) . #5#)))))
          (EXIT
           (VECTOR (QVELT |p| 0) (QVELT |p| 1)
                   (LIST |tRange| |xRange| |yRange|) (QVELT |p| 3)
                   |curves|)))))) 

(DEFUN |PLOT;plot;$S$;32| (|p| |tRange| $)
  (PROG (|yRange| |xRange| |curves| #1=#:G824 |c| #2=#:G823 |tlimit| #3=#:G822
         #4=#:G821)
    (RETURN
     (SEQ (SETELT $ 10 0)
          (LETT |curves|
                (PROGN
                 (LETT #4# NIL . #5=(|PLOT;plot;$S$;32|))
                 (SEQ (LETT |c| NIL . #5#) (LETT #3# (QVELT |p| 4) . #5#) G190
                      (COND
                       ((OR (ATOM #3#) (PROGN (LETT |c| (CAR #3#) . #5#) NIL))
                        #6=(GO G191)))
                      (SEQ
                       (EXIT
                        (LETT #4#
                              (CONS (|PLOT;rangeRefine| |c| |tRange| $) #4#)
                              . #5#)))
                      (LETT #3# (CDR #3#) . #5#) #7=(GO G190) G191
                      (EXIT (NREVERSE0 #4#))))
                . #5#)
          (LETT |xRange| (|PLOT;join| |curves| 1 $) . #5#)
          (LETT |yRange| (|PLOT;join| |curves| 2 $) . #5#)
          (COND
           ((SPADCALL (QREFELT $ 36))
            (SEQ
             (LETT |tlimit| (COND ((SPADCALL |p| (QREFELT $ 38)) 8) ('T 1))
                   . #5#)
             (LETT |curves|
                   (PROGN
                    (LETT #2# NIL . #5#)
                    (SEQ (LETT |c| NIL . #5#) (LETT #1# |curves| . #5#) G190
                         (COND
                          ((OR (ATOM #1#)
                               (PROGN (LETT |c| (CAR #1#) . #5#) NIL))
                           #6#))
                         (SEQ
                          (EXIT
                           (LETT #2#
                                 (CONS
                                  (|PLOT;adaptivePlot| |c| |tRange| |xRange|
                                   |yRange| |tlimit| $)
                                  #2#)
                                 . #5#)))
                         (LETT #1# (CDR #1#) . #5#) #7# G191
                         (EXIT (NREVERSE0 #2#))))
                   . #5#)
             (LETT |xRange| (|PLOT;join| |curves| 1 $) . #5#)
             (EXIT (LETT |yRange| (|PLOT;join| |curves| 2 $) . #5#)))))
          (EXIT
           (VECTOR (QVELT |p| 0) (LIST |xRange| |yRange|)
                   (LIST |tRange| |xRange| |yRange|) (QVELT |p| 3)
                   |curves|)))))) 

(DEFUN |PLOT;pt| (|xx| |yy| $)
  (PROG (|l|)
    (RETURN (SPADCALL (LETT |l| (LIST |xx| |yy|) |PLOT;pt|) (QREFELT $ 75))))) 

(DEFUN |PLOT;myTrap| (|ff| |f| $)
  (PROG (|r| |s|)
    (RETURN
     (SEQ
      (LETT |s| (|trapNumericErrors| (SPADCALL |f| |ff|)) . #1=(|PLOT;myTrap|))
      (EXIT
       (COND ((QEQCAR |s| 1) 0.0)
             (#2='T
              (SEQ (LETT |r| (QCDR |s|) . #1#)
                   (EXIT
                    (COND
                     ((< MOST-POSITIVE-DOUBLE-FLOAT |r|)
                      MOST-POSITIVE-DOUBLE-FLOAT)
                     ((< |r| MOST-NEGATIVE-DOUBLE-FLOAT)
                      MOST-NEGATIVE-DOUBLE-FLOAT)
                     (#2# |r|))))))))))) 

(DEFUN |PLOT;plot;MS$;35| (|f| |xRange| $)
  (PROG (|r| |p|)
    (RETURN
     (SEQ
      (LETT |p|
            (|PLOT;basicPlot| (CONS #'|PLOT;plot;MS$;35!0| (VECTOR $ |f|))
             |xRange| $)
            . #1=(|PLOT;plot;MS$;35|))
      (LETT |r| (QVELT |p| 1) . #1#) (SETELT $ 10 (SPADCALL (QREFELT $ 30)))
      (COND
       ((SPADCALL (QREFELT $ 36))
        (SEQ
         (LETT |p|
               (|PLOT;adaptivePlot| |p| (|SPADfirst| |r|)
                (SPADCALL |r| (QREFELT $ 27)) (SPADCALL |r| (QREFELT $ 28)) 1
                $)
               . #1#)
         (EXIT (LETT |r| (QVELT |p| 1) . #1#)))))
      (EXIT (VECTOR 'NIL (CDR |r|) |r| NIL (LIST |p|))))))) 

(DEFUN |PLOT;plot;MS$;35!0| (|u1| $$)
  (PROG (|f| $)
    (LETT |f| (QREFELT $$ 1) . #1=(|PLOT;plot;MS$;35|))
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN (PROGN (|PLOT;pt| |u1| (|PLOT;myTrap| |f| |u1| $) $))))) 

(DEFUN |PLOT;plot;M2S$;36| (|f| |xRange| |yRange| $)
  (PROG (|p|)
    (RETURN
     (SEQ (LETT |p| (SPADCALL |f| |xRange| (QREFELT $ 77)) |PLOT;plot;M2S$;36|)
          (QSETVELT |p| 1 (LIST |xRange| (|PLOT;checkRange| |yRange| $)))
          (EXIT |p|))))) 

(DEFUN |PLOT;plot;2MS$;37| (|f| |g| |tRange| $)
  (PROG (|r| |p|)
    (RETURN
     (SEQ
      (LETT |p|
            (|PLOT;basicPlot| (CONS #'|PLOT;plot;2MS$;37!0| (VECTOR |g| $ |f|))
             |tRange| $)
            . #1=(|PLOT;plot;2MS$;37|))
      (LETT |r| (QVELT |p| 1) . #1#) (SETELT $ 10 (SPADCALL (QREFELT $ 30)))
      (COND
       ((SPADCALL (QREFELT $ 36))
        (SEQ
         (LETT |p|
               (|PLOT;adaptivePlot| |p| (|SPADfirst| |r|)
                (SPADCALL |r| (QREFELT $ 27)) (SPADCALL |r| (QREFELT $ 28)) 8
                $)
               . #1#)
         (EXIT (LETT |r| (QVELT |p| 1) . #1#)))))
      (EXIT (VECTOR 'T (CDR |r|) |r| NIL (LIST |p|))))))) 

(DEFUN |PLOT;plot;2MS$;37!0| (|z1| $$)
  (PROG (|f| $ |g|)
    (LETT |f| (QREFELT $$ 2) . #1=(|PLOT;plot;2MS$;37|))
    (LETT $ (QREFELT $$ 1) . #1#)
    (LETT |g| (QREFELT $$ 0) . #1#)
    (RETURN
     (PROGN
      (|PLOT;pt| (|PLOT;myTrap| |f| |z1| $) (|PLOT;myTrap| |g| |z1| $) $))))) 

(DEFUN |PLOT;plot;2M3S$;38| (|f| |g| |tRange| |xRange| |yRange| $)
  (PROG (|p|)
    (RETURN
     (SEQ
      (LETT |p| (SPADCALL |f| |g| |tRange| (QREFELT $ 79))
            |PLOT;plot;2M3S$;38|)
      (QSETVELT |p| 1
                (LIST (|PLOT;checkRange| |xRange| $)
                      (|PLOT;checkRange| |yRange| $)))
      (EXIT |p|))))) 

(DEFUN |PLOT;pointPlot;MS$;39| (|f| |tRange| $)
  (PROG (|r| |p|)
    (RETURN
     (SEQ
      (LETT |p| (|PLOT;basicPlot| |f| |tRange| $)
            . #1=(|PLOT;pointPlot;MS$;39|))
      (LETT |r| (QVELT |p| 1) . #1#) (SETELT $ 10 (SPADCALL (QREFELT $ 30)))
      (COND
       ((SPADCALL (QREFELT $ 36))
        (SEQ
         (LETT |p|
               (|PLOT;adaptivePlot| |p| (|SPADfirst| |r|)
                (SPADCALL |r| (QREFELT $ 27)) (SPADCALL |r| (QREFELT $ 28)) 8
                $)
               . #1#)
         (EXIT (LETT |r| (QVELT |p| 1) . #1#)))))
      (EXIT (VECTOR 'T (CDR |r|) |r| NIL (LIST |p|))))))) 

(DEFUN |PLOT;pointPlot;M3S$;40| (|f| |tRange| |xRange| |yRange| $)
  (PROG (|p|)
    (RETURN
     (SEQ
      (LETT |p| (SPADCALL |f| |tRange| (QREFELT $ 82))
            |PLOT;pointPlot;M3S$;40|)
      (QSETVELT |p| 1
                (LIST (|PLOT;checkRange| |xRange| $)
                      (|PLOT;checkRange| |yRange| $)))
      (EXIT |p|))))) 

(DEFUN |PLOT;plot;LS$;41| (|l| |xRange| $)
  (PROG (|yRange| |t| #1=#:G864 |f| #2=#:G865 |p| #3=#:G863 #4=#:G862
         #5=#:G861)
    (RETURN
     (SEQ (COND ((NULL |l|) (|error| "empty list of functions")))
          (LETT |t|
                (PROGN
                 (LETT #5# NIL . #6=(|PLOT;plot;LS$;41|))
                 (SEQ (LETT |f| NIL . #6#) (LETT #4# |l| . #6#) G190
                      (COND
                       ((OR (ATOM #4#) (PROGN (LETT |f| (CAR #4#) . #6#) NIL))
                        #7=(GO G191)))
                      (SEQ
                       (EXIT
                        (LETT #5#
                              (CONS
                               (|PLOT;basicPlot|
                                (CONS #'|PLOT;plot;LS$;41!0| (VECTOR $ |f|))
                                |xRange| $)
                               #5#)
                              . #6#)))
                      (LETT #4# (CDR #4#) . #6#) #8=(GO G190) G191
                      (EXIT (NREVERSE0 #5#))))
                . #6#)
          (LETT |yRange| (|PLOT;join| |t| 2 $) . #6#)
          (SETELT $ 10 (* (LENGTH |l|) (SPADCALL (QREFELT $ 30))))
          (COND
           ((SPADCALL (QREFELT $ 36))
            (SEQ
             (LETT |t|
                   (PROGN
                    (LETT #3# NIL . #6#)
                    (SEQ (LETT |p| NIL . #6#) (LETT #2# |t| . #6#)
                         (LETT |f| NIL . #6#) (LETT #1# |l| . #6#) G190
                         (COND
                          ((OR (ATOM #1#)
                               (PROGN (LETT |f| (CAR #1#) . #6#) NIL)
                               (ATOM #2#)
                               (PROGN (LETT |p| (CAR #2#) . #6#) NIL))
                           #7#))
                         (SEQ
                          (EXIT
                           (LETT #3#
                                 (CONS
                                  (|PLOT;adaptivePlot| |p| |xRange| |xRange|
                                   |yRange| 1 $)
                                  #3#)
                                 . #6#)))
                         (LETT #1# (PROG1 (CDR #1#) (LETT #2# (CDR #2#) . #6#))
                               . #6#)
                         #8# G191 (EXIT (NREVERSE0 #3#))))
                   . #6#)
             (EXIT (LETT |yRange| (|PLOT;join| |t| 2 $) . #6#)))))
          (EXIT
           (VECTOR 'NIL (LIST |xRange| |yRange|)
                   (LIST |xRange| |xRange| |yRange|) NIL |t|)))))) 

(DEFUN |PLOT;plot;LS$;41!0| (|z1| $$)
  (PROG (|f| $)
    (LETT |f| (QREFELT $$ 1) . #1=(|PLOT;plot;LS$;41|))
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN (PROGN (|PLOT;pt| |z1| (|PLOT;myTrap| |f| |z1| $) $))))) 

(DEFUN |PLOT;plot;L2S$;42| (|l| |xRange| |yRange| $)
  (PROG (|p|)
    (RETURN
     (SEQ (LETT |p| (SPADCALL |l| |xRange| (QREFELT $ 85)) |PLOT;plot;L2S$;42|)
          (QSETVELT |p| 1 (LIST |xRange| (|PLOT;checkRange| |yRange| $)))
          (EXIT |p|))))) 

(DEFUN |PLOT;plotPolar;MS$;43| (|f| |thetaRange| $)
  (PROG ()
    (RETURN
     (SPADCALL (CONS #'|PLOT;plotPolar;MS$;43!0| (VECTOR $ |f|))
               (CONS #'|PLOT;plotPolar;MS$;43!1| (VECTOR $ |f|)) |thetaRange|
               (QREFELT $ 79))))) 

(DEFUN |PLOT;plotPolar;MS$;43!1| (|v1| $$)
  (PROG (|f| $)
    (LETT |f| (QREFELT $$ 1) . #1=(|PLOT;plotPolar;MS$;43|))
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN
     (PROGN
      (SPADCALL (SPADCALL |v1| |f|) (SPADCALL |v1| (QREFELT $ 89))
                (QREFELT $ 88)))))) 

(DEFUN |PLOT;plotPolar;MS$;43!0| (|u1| $$)
  (PROG (|f| $)
    (LETT |f| (QREFELT $$ 1) . #1=(|PLOT;plotPolar;MS$;43|))
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN
     (PROGN
      (SPADCALL (SPADCALL |u1| |f|) (SPADCALL |u1| (QREFELT $ 87))
                (QREFELT $ 88)))))) 

(DEFUN |PLOT;plotPolar;M$;44| (|f| $)
  (SPADCALL |f|
            (SPADCALL 0.0
                      (SPADCALL 2 (FLOAT PI MOST-POSITIVE-DOUBLE-FLOAT)
                                (QREFELT $ 91))
                      (QREFELT $ 92))
            (QREFELT $ 90))) 

(DEFUN |PLOT;coerce;$Of;45| (|r| $)
  (PROG (|f| |l| #1=#:G880 |p| #2=#:G879 |h| |yRange| |xRange| #3=#:G878
         |curve| |tRange| |plotSymbol| |tSymbol| |ySymbol| |xSymbol| |spaces|)
    (RETURN
     (SEQ
      (LETT |spaces| (SPADCALL "   " (QREFELT $ 95))
            . #4=(|PLOT;coerce;$Of;45|))
      (LETT |xSymbol| "x = " . #4#) (LETT |ySymbol| "y = " . #4#)
      (LETT |tSymbol| "t = " . #4#) (LETT |plotSymbol| "PLOT" . #4#)
      (LETT |tRange| (SPADCALL (|PLOT;parametricRange| |r| $) (QREFELT $ 96))
            . #4#)
      (LETT |f| NIL . #4#)
      (SEQ (LETT |curve| NIL . #4#) (LETT #3# (QVELT |r| 4) . #4#) G190
           (COND
            ((OR (ATOM #3#) (PROGN (LETT |curve| (CAR #3#) . #4#) NIL))
             #5=(GO G191)))
           (SEQ
            (LETT |xRange|
                  (SPADCALL (SPADCALL (QVELT |curve| 1) (QREFELT $ 27))
                            (QREFELT $ 96))
                  . #4#)
            (LETT |yRange|
                  (SPADCALL (SPADCALL (QVELT |curve| 1) (QREFELT $ 28))
                            (QREFELT $ 96))
                  . #4#)
            (LETT |l| (LIST |xSymbol| |xRange| |spaces| |ySymbol| |yRange|)
                  . #4#)
            (COND
             ((SPADCALL |r| (QREFELT $ 38))
              (LETT |l|
                    (SPADCALL (LIST |tSymbol| |tRange| |spaces|) |l|
                              (QREFELT $ 98))
                    . #4#)))
            (LETT |h| (SPADCALL |l| (QREFELT $ 100)) . #4#)
            (LETT |l|
                  (PROGN
                   (LETT #2# NIL . #4#)
                   (SEQ (LETT |p| NIL . #4#) (LETT #1# (QVELT |curve| 3) . #4#)
                        G190
                        (COND
                         ((OR (ATOM #1#)
                              (PROGN (LETT |p| (CAR #1#) . #4#) NIL))
                          #5#))
                        (SEQ
                         (EXIT
                          (LETT #2# (CONS (SPADCALL |p| (QREFELT $ 101)) #2#)
                                . #4#)))
                        (LETT #1# (CDR #1#) . #4#) #6=(GO G190) G191
                        (EXIT (NREVERSE0 #2#))))
                  . #4#)
            (EXIT
             (LETT |f| (CONS (SPADCALL (CONS |h| |l|) (QREFELT $ 102)) |f|)
                   . #4#)))
           (LETT #3# (CDR #3#) . #4#) #6# G191 (EXIT NIL))
      (EXIT (SPADCALL "PLOT" (NREVERSE |f|) (QREFELT $ 103))))))) 

(DEFUN |Plot| #1=()
  (PROG #1#
    (RETURN
     (PROG (#2=#:G882)
       (RETURN
        (COND
         ((LETT #2# (HGET |$ConstructorCache| '|Plot|) . #3=(|Plot|))
          (|CDRwithIncrement| (CDAR #2#)))
         ('T
          (UNWIND-PROTECT
              (PROG1
                  (CDDAR
                   (HPUT |$ConstructorCache| '|Plot|
                         (LIST (CONS NIL (CONS 1 (|Plot;|))))))
                (LETT #2# T . #3#))
            (COND ((NOT #2#) (HREM |$ConstructorCache| '|Plot|))))))))))) 

(DEFUN |Plot;| ()
  (PROG (|dv$| $ |pv$|)
    (RETURN
     (PROGN
      (LETT |dv$| '(|Plot|) . #1=(|Plot|))
      (LETT $ (GETREFV 105) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|Plot| NIL (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6
                (|Record| (|:| |parametric| (|Boolean|))
                          (|:| |display| (|List| (|Segment| (|DoubleFloat|))))
                          (|:| |bounds| (|List| (|Segment| (|DoubleFloat|))))
                          (|:| |axisLabels| (|List| (|String|)))
                          (|:| |functions|
                               (|List|
                                (|Record|
                                 (|:| |source|
                                      (|Mapping| (|Point| (|DoubleFloat|))
                                                 (|DoubleFloat|)))
                                 (|:| |ranges|
                                      (|List| (|Segment| (|DoubleFloat|))))
                                 (|:| |knots| (|List| (|DoubleFloat|)))
                                 (|:| |points|
                                      (|List| (|Point| (|DoubleFloat|)))))))))
      (QSETREFV $ 7 'T)
      (QSETREFV $ 8 49)
      (QSETREFV $ 9 1000)
      (QSETREFV $ 10 0)
      (QSETREFV $ 11 500)
      (QSETREFV $ 14
                (COS
                 (SPADCALL (FLOAT 4 MOST-POSITIVE-DOUBLE-FLOAT)
                           (QREFELT $ 13))))
      (QSETREFV $ 15 'NIL)
      $)))) 

(MAKEPROP '|Plot| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL '|Rep| 'ADAPTIVE 'MINPOINTS 'MAXPOINTS
              'NUMFUNEVALS 'SCREENRES (|DoubleFloat|) (0 . |inv|) 'ANGLEBOUND
              'DEBUG (|Boolean|) (|Mapping| 16 12) (|Point| 12) (5 . |any?|)
              (|List| 48) |PLOT;listBranches;$L;3| (|Segment| 12) (11 . |hi|)
              (16 . |lo|) (21 . SEGMENT) (|List| 22) (27 . |second|)
              (32 . |third|) (|Integer|) |PLOT;minPoints;I;9|
              |PLOT;setMinPoints;2I;10| |PLOT;maxPoints;I;11|
              |PLOT;setMaxPoints;2I;12| |PLOT;screenResolution;I;13|
              |PLOT;setScreenResolution;2I;14| |PLOT;adaptive?;B;15|
              |PLOT;setAdaptive;2B;16| |PLOT;parametric?;$B;17|
              |PLOT;numFunEvals;I;18| |PLOT;debug;2B;19| |PLOT;xRange;$S;20|
              |PLOT;yRange;$S;21| |PLOT;tRange;$S;22| (|List| 12)
              (37 . |second|) '"rest" (42 . |setelt|) (|List| 18)
              (49 . |setelt|) (|PointPackage| 12) (56 . |xCoord|) (61 . |min|)
              (67 . |max|) (73 . |yCoord|) (|List| 44) (78 . |concat!|)
              (84 . |concat!|) (90 . |third|) (95 . |second|) (100 . |third|)
              (|PositiveInteger|) (105 . ^) (111 . |sqrt|) (|Fraction| 29)
              (116 . |Zero|) (120 . |list|) (125 . |list|) |PLOT;zoom;$S$;27|
              |PLOT;zoom;$2S$;28| (130 . |copy|) (135 . |copy|)
              |PLOT;refine;$S$;31| |PLOT;refine;2$;30| |PLOT;plot;$S$;32|
              (140 . |point|) (|Mapping| 12 12) |PLOT;plot;MS$;35|
              |PLOT;plot;M2S$;36| |PLOT;plot;2MS$;37| |PLOT;plot;2M3S$;38|
              (|Mapping| 18 12) |PLOT;pointPlot;MS$;39|
              |PLOT;pointPlot;M3S$;40| (|List| 76) |PLOT;plot;LS$;41|
              |PLOT;plot;L2S$;42| (145 . |cos|) (150 . *) (156 . |sin|)
              |PLOT;plotPolar;MS$;43| (161 . *) (167 . |segment|)
              |PLOT;plotPolar;M$;44| (|OutputForm|) (173 . |coerce|)
              (178 . |coerce|) (|List| 94) (183 . |concat!|) (|List| $)
              (189 . |hconcat|) (194 . |coerce|) (199 . |vconcat|)
              (204 . |prefix|) |PLOT;coerce;$Of;45|)
           '#(|zoom| 210 |yRange| 223 |xRange| 228 |tRange| 233
              |setScreenResolution| 238 |setMinPoints| 243 |setMaxPoints| 248
              |setAdaptive| 253 |screenResolution| 258 |refine| 262 |pointPlot|
              273 |plotPolar| 287 |plot| 298 |parametric?| 346 |numFunEvals|
              351 |minPoints| 355 |maxPoints| 359 |listBranches| 363 |debug|
              368 |coerce| 373 |adaptive?| 378)
           'NIL
           (CONS (|makeByteWordVec2| 1 '(0 0))
                 (CONS '#(NIL NIL)
                       (CONS
                        '#((|PlottablePlaneCurveCategory|) (|CoercibleTo| 94))
                        (|makeByteWordVec2| 104
                                            '(1 12 0 0 13 2 18 16 17 0 19 1 22
                                              12 0 23 1 22 12 0 24 2 22 0 12 12
                                              25 1 26 22 0 27 1 26 22 0 28 1 44
                                              12 0 45 3 44 0 0 46 0 47 3 48 0 0
                                              46 0 49 1 50 12 18 51 2 12 0 0 0
                                              52 2 12 0 0 0 53 1 50 12 18 54 2
                                              55 0 0 44 56 2 20 0 0 48 57 1 44
                                              12 0 58 1 48 18 0 59 1 48 18 0 60
                                              2 12 0 0 61 62 1 12 0 0 63 0 64 0
                                              65 1 44 0 12 66 1 48 0 18 67 1 44
                                              0 0 70 1 48 0 0 71 1 18 0 44 75 1
                                              12 0 0 87 2 12 0 0 0 88 1 12 0 0
                                              89 2 12 0 61 0 91 2 22 0 12 12 92
                                              1 94 94 0 95 1 22 94 0 96 2 97 0
                                              0 0 98 1 94 0 99 100 1 18 94 0
                                              101 1 94 0 99 102 2 94 0 0 99 103
                                              2 0 0 0 22 68 3 0 0 0 22 22 69 1
                                              0 22 0 42 1 0 22 0 41 1 0 22 0 43
                                              1 0 29 29 35 1 0 29 29 31 1 0 29
                                              29 33 1 0 16 16 37 0 0 29 34 2 0
                                              0 0 22 72 1 0 0 0 73 2 0 0 81 22
                                              82 4 0 0 81 22 22 22 83 2 0 0 76
                                              22 90 1 0 0 76 93 2 0 0 0 22 74 3
                                              0 0 76 76 22 79 5 0 0 76 76 22 22
                                              22 80 2 0 0 84 22 85 3 0 0 84 22
                                              22 86 2 0 0 76 22 77 3 0 0 76 22
                                              22 78 1 0 16 0 38 0 0 29 39 0 0
                                              29 30 0 0 29 32 1 0 20 0 21 1 0
                                              16 16 40 1 0 94 0 104 0 0 16
                                              36)))))
           '|lookupComplete|)) 

(MAKEPROP '|Plot| 'NILADIC T) 
