
(/VERSIONCHECK 2) 

(DEFUN |EXPRTUBE;getVariable| (|x| |y| |z| $)
  (PROG (|t2| |t1| #1=#:G1818 |varList3| |varList2| |varList1|)
    (RETURN
     (SEQ
      (LETT |varList1| (SPADCALL |x| (QREFELT $ 8))
            . #2=(|EXPRTUBE;getVariable|))
      (LETT |varList2| (SPADCALL |y| (QREFELT $ 8)) . #2#)
      (LETT |varList3| (SPADCALL |z| (QREFELT $ 8)) . #2#)
      (COND
       ((OR (< 1 (LENGTH |varList1|))
            (OR (< 1 (LENGTH |varList2|)) (< 1 (LENGTH |varList3|))))
        (EXIT (|error| "tubePlot: only one variable may be used"))))
      (EXIT
       (COND
        ((NULL |varList1|)
         (COND
          ((NULL |varList2|)
           (COND
            ((NULL |varList3|)
             (|error| "tubePlot: a variable must appear in functions"))
            (#3='T (|SPADfirst| |varList3|))))
          (#3#
           (SEQ (LETT |t2| (|SPADfirst| |varList2|) . #2#)
                (EXIT
                 (COND ((NULL |varList3|) |t2|)
                       (#3#
                        (SEQ
                         (EXIT
                          (COND
                           ((NULL (EQUAL (|SPADfirst| |varList3|) |t2|))
                            (PROGN
                             (LETT #1#
                                   (|error|
                                    "tubePlot: only one variable may be used")
                                   . #2#)
                             (GO #1#)))))
                         #1# (EXIT #1#)))))))))
        (#3#
         (SEQ (LETT |t1| (|SPADfirst| |varList1|) . #2#)
              (EXIT
               (COND
                ((NULL |varList2|)
                 (COND
                  ((OR (NULL |varList3|)
                       (NULL (NULL (EQUAL (|SPADfirst| |varList3|) |t1|))))
                   |t1|)
                  ('T (|error| "tubePlot: only one variable may be used"))))
                (#3#
                 (SEQ (LETT |t2| (|SPADfirst| |varList2|) . #2#)
                      (EXIT
                       (COND
                        ((NULL |varList3|)
                         (COND ((EQUAL |t1| |t2|) |t1|)
                               (#3#
                                (|error|
                                 "tubePlot: only one variable may be used"))))
                        (#3#
                         (SEQ
                          (COND
                           ((EQUAL (|SPADfirst| |varList3|) |t1|)
                            (COND
                             ((NULL (EQUAL |t2| |t1|))
                              (EXIT
                               (|error|
                                #4="tubePlot: only one variable may be used")))))
                           (#3# (EXIT (|error| #4#))))
                          (EXIT |t1|))))))))))))))))) 

(DEFUN |EXPRTUBE;tubePlot;3EMSMISTp;2|
       (|x| |y| |z| |colorFcn| |tRange| |radFcn| |n| |string| $)
  (PROG (|loopList| |lps| |bNorm| |bNormList| |pNorm| |pNormList| |curvePts|
         |ctr| |tvals| |tval| |cosSin| |parPlot| |BzFunc| |ByFunc| |BxFunc|
         |Bz| |By| |Bx| |NzFunc| |NyFunc| |NxFunc| |Nz| |Ny| |Nx| K |Tzp| |Typ|
         |Txp| |Tz| |Ty| |Tx| |sp| |zp| |yp| |xp| |zFunc| |yFunc| |xFunc| |t|
         |flag|)
    (RETURN
     (SEQ
      (COND ((< |n| 3) (|error| "tubePlot: n should be at least 3"))
            (#1='T
             (SEQ
              (LETT |flag|
                    (COND ((EQUAL |string| "closed") 'T)
                          ((EQUAL |string| "open") 'NIL)
                          (#1#
                           (|error|
                            "tubePlot: last argument should be open or closed")))
                    . #2=(|EXPRTUBE;tubePlot;3EMSMISTp;2|))
              (LETT |t| (|EXPRTUBE;getVariable| |x| |y| |z| $) . #2#)
              (LETT |xFunc| (SPADCALL |x| |t| (QREFELT $ 13)) . #2#)
              (LETT |yFunc| (SPADCALL |y| |t| (QREFELT $ 13)) . #2#)
              (LETT |zFunc| (SPADCALL |z| |t| (QREFELT $ 13)) . #2#)
              (LETT |xp| (SPADCALL |x| |t| (QREFELT $ 14)) . #2#)
              (LETT |yp| (SPADCALL |y| |t| (QREFELT $ 14)) . #2#)
              (LETT |zp| (SPADCALL |z| |t| (QREFELT $ 14)) . #2#)
              (LETT |sp|
                    (SPADCALL
                     (SPADCALL
                      (SPADCALL (SPADCALL |xp| 2 (QREFELT $ 16))
                                (SPADCALL |yp| 2 (QREFELT $ 16))
                                (QREFELT $ 17))
                      (SPADCALL |zp| 2 (QREFELT $ 16)) (QREFELT $ 17))
                     (QREFELT $ 18))
                    . #2#)
              (LETT |Tx| (SPADCALL |xp| |sp| (QREFELT $ 19)) . #2#)
              (LETT |Ty| (SPADCALL |yp| |sp| (QREFELT $ 19)) . #2#)
              (LETT |Tz| (SPADCALL |zp| |sp| (QREFELT $ 19)) . #2#)
              (LETT |Txp| (SPADCALL |Tx| |t| (QREFELT $ 14)) . #2#)
              (LETT |Typ| (SPADCALL |Ty| |t| (QREFELT $ 14)) . #2#)
              (LETT |Tzp| (SPADCALL |Tz| |t| (QREFELT $ 14)) . #2#)
              (LETT K
                    (SPADCALL
                     (SPADCALL
                      (SPADCALL (SPADCALL |Txp| 2 (QREFELT $ 16))
                                (SPADCALL |Typ| 2 (QREFELT $ 16))
                                (QREFELT $ 17))
                      (SPADCALL |Tzp| 2 (QREFELT $ 16)) (QREFELT $ 17))
                     (QREFELT $ 18))
                    . #2#)
              (LETT |Nx| (SPADCALL |Txp| K (QREFELT $ 19)) . #2#)
              (LETT |Ny| (SPADCALL |Typ| K (QREFELT $ 19)) . #2#)
              (LETT |Nz| (SPADCALL |Tzp| K (QREFELT $ 19)) . #2#)
              (LETT |NxFunc| (SPADCALL |Nx| |t| (QREFELT $ 13)) . #2#)
              (LETT |NyFunc| (SPADCALL |Ny| |t| (QREFELT $ 13)) . #2#)
              (LETT |NzFunc| (SPADCALL |Nz| |t| (QREFELT $ 13)) . #2#)
              (LETT |Bx|
                    (SPADCALL (SPADCALL |Ty| |Nz| (QREFELT $ 20))
                              (SPADCALL |Tz| |Ny| (QREFELT $ 20))
                              (QREFELT $ 21))
                    . #2#)
              (LETT |By|
                    (SPADCALL (SPADCALL |Tz| |Nx| (QREFELT $ 20))
                              (SPADCALL |Tx| |Nz| (QREFELT $ 20))
                              (QREFELT $ 21))
                    . #2#)
              (LETT |Bz|
                    (SPADCALL (SPADCALL |Tx| |Ny| (QREFELT $ 20))
                              (SPADCALL |Ty| |Nx| (QREFELT $ 20))
                              (QREFELT $ 21))
                    . #2#)
              (LETT |BxFunc| (SPADCALL |Bx| |t| (QREFELT $ 13)) . #2#)
              (LETT |ByFunc| (SPADCALL |By| |t| (QREFELT $ 13)) . #2#)
              (LETT |BzFunc| (SPADCALL |Bz| |t| (QREFELT $ 13)) . #2#)
              (LETT |parPlot|
                    (SPADCALL |xFunc| |yFunc| |zFunc| |colorFcn| |tRange|
                              (QREFELT $ 24))
                    . #2#)
              (LETT |tvals| (|SPADfirst| (SPADCALL |parPlot| (QREFELT $ 26)))
                    . #2#)
              (LETT |curvePts|
                    (|SPADfirst| (SPADCALL |parPlot| (QREFELT $ 28))) . #2#)
              (LETT |cosSin| (SPADCALL |n| (QREFELT $ 31)) . #2#)
              (LETT |loopList| NIL . #2#)
              (SEQ G190
                   (COND
                    ((NULL (COND ((NULL |tvals|) 'NIL) ('T 'T))) (GO G191)))
                   (SEQ (LETT |tval| (|SPADfirst| |tvals|) . #2#)
                        (LETT |tvals| (CDR |tvals|) . #2#)
                        (LETT |ctr| (|SPADfirst| |curvePts|) . #2#)
                        (LETT |curvePts| (CDR |curvePts|) . #2#)
                        (LETT |pNormList|
                              (LIST (SPADCALL |tval| |NxFunc|)
                                    (SPADCALL |tval| |NyFunc|)
                                    (SPADCALL |tval| |NzFunc|)
                                    (SPADCALL |tval| |colorFcn|))
                              . #2#)
                        (LETT |pNorm| (SPADCALL |pNormList| (QREFELT $ 34))
                              . #2#)
                        (LETT |bNormList|
                              (LIST (SPADCALL |tval| |BxFunc|)
                                    (SPADCALL |tval| |ByFunc|)
                                    (SPADCALL |tval| |BzFunc|)
                                    (SPADCALL |tval| |colorFcn|))
                              . #2#)
                        (LETT |bNorm| (SPADCALL |bNormList| (QREFELT $ 34))
                              . #2#)
                        (LETT |lps|
                              (SPADCALL |ctr| |pNorm| |bNorm|
                                        (SPADCALL |tval| |radFcn|) |cosSin|
                                        (QREFELT $ 37))
                              . #2#)
                        (EXIT (LETT |loopList| (CONS |lps| |loopList|) . #2#)))
                   NIL (GO G190) G191 (EXIT NIL))
              (EXIT
               (SPADCALL |parPlot| (NREVERSE |loopList|) |flag|
                         (QREFELT $ 40)))))))))) 

(DEFUN |EXPRTUBE;tubePlot;3EMSMITp;3|
       (|x| |y| |z| |colorFcn| |tRange| |radFcn| |n| $)
  (SPADCALL |x| |y| |z| |colorFcn| |tRange| |radFcn| |n| "open" (QREFELT $ 42))) 

(PUT '|EXPRTUBE;project| '|SPADreplace| '(XLAM (|x| |y|) |x|)) 

(DEFUN |EXPRTUBE;project| (|x| |y| $) |x|) 

(DEFUN |EXPRTUBE;constantToUnaryFunction;DfM;5| (|x| $)
  (PROG ()
    (RETURN
     (CONS #'|EXPRTUBE;constantToUnaryFunction;DfM;5!0| (VECTOR $ |x|))))) 

(DEFUN |EXPRTUBE;constantToUnaryFunction;DfM;5!0| (|s| $$)
  (PROG (|x| $)
    (LETT |x| (QREFELT $$ 1) . #1=(|EXPRTUBE;constantToUnaryFunction;DfM;5|))
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN (PROGN (|EXPRTUBE;project| |x| |s| $))))) 

(DEFUN |EXPRTUBE;tubePlot;3EMSDfISTp;6|
       (|x| |y| |z| |colorFcn| |tRange| |rad| |n| |s| $)
  (SPADCALL |x| |y| |z| |colorFcn| |tRange| (SPADCALL |rad| (QREFELT $ 44)) |n|
            |s| (QREFELT $ 42))) 

(DEFUN |EXPRTUBE;tubePlot;3EMSDfITp;7|
       (|x| |y| |z| |colorFcn| |tRange| |rad| |n| $)
  (SPADCALL |x| |y| |z| |colorFcn| |tRange| |rad| |n| "open" (QREFELT $ 45))) 

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

(DEFUN |ExpressionTubePlot;| ()
  (PROG (|dv$| $ |pv$|)
    (RETURN
     (PROGN
      (LETT |dv$| '(|ExpressionTubePlot|) . #1=(|ExpressionTubePlot|))
      (LETT $ (GETREFV 47) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|ExpressionTubePlot| NIL (CONS 1 $))
      (|stuffDomainSlots| $)
      $)))) 

(MAKEPROP '|ExpressionTubePlot| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|List| 11) (|Expression| 29)
              (0 . |variables|) (5 . |One|) (|Mapping| 36 36) (|Symbol|)
              (|MakeFloatCompiledFunction| 7) (9 . |makeFloatFunction|)
              (15 . |differentiate|) (|PositiveInteger|) (21 . ^) (27 . +)
              (33 . |sqrt|) (38 . /) (44 . *) (50 . -) (|Segment| 36)
              (|Plot3D|) (56 . |plot|) (|List| 32) (65 . |tValues|) (|List| 35)
              (70 . |listBranches|) (|Integer|) (|TubePlotTools|)
              (75 . |cosSinInfo|) (|List| 36) (|Point| 36) (80 . |point|)
              (|List| 33) (|DoubleFloat|) (85 . |loopPoints|) (|Boolean|)
              (|TubePlot| 23) (94 . |tube|) (|String|)
              |EXPRTUBE;tubePlot;3EMSMISTp;2| |EXPRTUBE;tubePlot;3EMSMITp;3|
              |EXPRTUBE;constantToUnaryFunction;DfM;5|
              |EXPRTUBE;tubePlot;3EMSDfISTp;6| |EXPRTUBE;tubePlot;3EMSDfITp;7|)
           '#(|tubePlot| 101 |constantToUnaryFunction| 147) 'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 46
                                                 '(1 7 6 0 8 0 7 0 9 2 12 10 7
                                                   11 13 2 7 0 0 11 14 2 7 0 0
                                                   15 16 2 7 0 0 0 17 1 7 0 0
                                                   18 2 7 0 0 0 19 2 7 0 0 0 20
                                                   2 7 0 0 0 21 5 23 0 10 10 10
                                                   10 22 24 1 23 25 0 26 1 23
                                                   27 0 28 1 30 25 29 31 1 33 0
                                                   32 34 5 30 35 33 33 33 36 25
                                                   37 3 39 0 23 27 38 40 7 0 39
                                                   7 7 7 10 22 10 29 43 8 0 39
                                                   7 7 7 10 22 10 29 41 42 8 0
                                                   39 7 7 7 10 22 36 29 41 45 7
                                                   0 39 7 7 7 10 22 36 29 46 1
                                                   0 10 36 44)))))
           '|lookupComplete|)) 

(MAKEPROP '|ExpressionTubePlot| 'NILADIC T) 
