home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / teach.zip / TEACH5A.ATF < prev    next >
Text File  |  1997-09-18  |  77KB  |  940 lines

  1. XNÉIO 0 1                                                                      °
  2. XNÉCT 0 1E²13                                                                  °
  3. XCÉFC 1 6 .,*0_²                                                               °
  4. XNÉRL 0 16807                                                                  °
  5. XCÉPR 1 1                                                                      °
  6. XCÉLX 1 5 TEACH                                                                °
  7. *(1997 5 15 14 39 13 412)                                                      °
  8.  FCOMPLEX ÉFX 'COMPLEX;N;A;B;C;D;X'                                            °
  9.   'Σ Absolute value in the complex domain'                                     °
  10.   '''  ABSOLUTE VALUE OF COMPLEX NUMBERS'',r'                                  °
  11.   '''For real numbers, absolute value is defined as the distance from 0        °
  12.  to'''                                                                         °
  13.   '''the number. For complex numbers, we are not dealing with the real n       °
  14.  umber'''                                                                      °
  15.   '''axis, but rather with the complex plane. A simple euclidean approac       °
  16.  h''' '''to calculate absolute value will not work.'',r'                       °
  17.   'show ''X╜1J1'' ''X*2'' ''(1J0+0J1)*2'''                                     °
  18.   '''Squaring a complex number will generate another complex number.'''        °
  19.   'do' 'show ''(1J0*2)+0J1*2'''                                                °
  20.   '''Applying the theorem of Pythagoras also fails. In fact any point on       °
  21.   a''' '''45 degree slope of the complex plane will return a zero.'''          °
  22.   'do'                                                                         °
  23.   '''To obtain the distance from origin of a complex number, it is requi       °
  24.  red to'''                                                                     °
  25.   '''multiply X by its "complex conjugate". This number is defined to ha       °
  26.  ve'''                                                                         °
  27.   '''the same values in the real and complex axes, but with an opposite'       °
  28.  ''                                                                            °
  29.   '''sign in the complex axis. The absolute value then becomes the posit       °
  30.  ive''' '''square root of X times complex conjugate of X'''                    °
  31. X 'show ''(X⌡+X)*.5'' ''|X''' 'endd'                                           °
  32. *(1997 5 3 14 0 20 236)                                                        °
  33.  FCONVENTION ÉFX 'CONVENTION' 'Σ Origin of algebraic notation'                 °
  34.   '''In modern algebra a function of one variable is described by the'''       °
  35.   '''convention f(x). A function of two variables is written as f(x,y).'       °
  36.  ''                                                                            °
  37.   '''There are, however, some functions that are used so frequently, tha       °
  38.  t''' '''special symbols have been assigned to them:'',r'                      °
  39.   '''      + for plus(x,y)'',r,''      - for minus(x,y)'''                     °
  40.   '''      ⌡ for times(x,y)'',r,''      ÷ for divide(x,y)'',r'                 °
  41.   '''and so on.''' 'do'                                                        °
  42.   '''There are special symbols to denote functions in one variable:'',r'       °
  43.   '''      |x| for absolute_value(x)'',r,''       x! for factorial(x)'',       °
  44.  r' 'do'                                                                       °
  45.   '''On the other hand for some functions we do not have special symbols       °
  46.  :'',r' '''sin(x), cos(x), log(x) sinh(x) tanh(x)'',r' 'do'                    °
  47.   '''Many of these conventions date to the the beginnings of modern alge       °
  48.  bra.'''                                                                       °
  49.   '''In ancient Greece, mathematicians had no symbols other than letters       °
  50.   of'''                                                                        °
  51.   '''the alphabet. They relied on drawings of geometric figures, and on'       °
  52.  ''                                                                            °
  53.   '''a rhetorical argument in proving theorems. Starting in the third ce       °
  54.  ntury'''                                                                      °
  55.   '''A.D., a kind of shorthand was developed by Diophantus. The use of''       °
  56.  '                                                                             °
  57.   '''abbreviations in the expression of mathematical relationship is kno       °
  58.  wn''' '''as SYNCOPATED notation.'',r' 'do'                                    °
  59.   '''In the 16th century, there was a period of experimentation with way       °
  60.  s'''                                                                          °
  61.   '''to use letters, digits and special symbols to describe mathematical       °
  62.  '''                                                                           °
  63.   '''relationships. For example, two German friends of Kepler used symbo       °
  64.  ls'''                                                                         °
  65.   '''+ and - in place of the letters p. and m.. Robert Recorde adopted t       °
  66.  hese'''                                                                       °
  67.   '''symbols, and added = to denote equality. Some notation used by Viet       °
  68.  e,'''                                                                         °
  69.   '''Chouquet, Burgi, Stevin and Bombelli did not survive. The adoption        °
  70.  of'''                                                                         °
  71.   '''our modern symbolism was not immediate. Viete, for example did not        °
  72.  use'''                                                                        °
  73.   '''the symbol ⌡, and for division used a horizontal bar. The ⌡ symbol'       °
  74.  ''                                                                            °
  75.   '''was first used by William Oughtred, and Thomas Harriot introduced <       °
  76.  ''' '''and >.'',r' 'do'                                                       °
  77.   '''In the 17th century, Descartes adopted the exponential superscript.       °
  78.  '''                                                                           °
  79.   '''This was the first of many notational conventions that cannot be'''       °
  80.   '''represented in a linear form. With the advent of computers, we have       °
  81.  '''                                                                           °
  82.   '''limitations on the spatial arrangement of symbols. Most present day       °
  83.  '''                                                                           °
  84.   '''keyboards do not support subscripts and superscripts. Because of th       °
  85.  is,'''                                                                        °
  86.   '''mathematical notation had to be modified to comply with these'''          °
  87.   '''limitations. Much as in the 16th century, there has been a variety        °
  88.  of'''                                                                         °
  89.   '''proposals for expressing symbols in a linear form. In some prograqm       °
  90.  ming'''                                                                       °
  91.   '''languages, there has been a regression to a syncopated approach.'',       °
  92.  r' 'do'                                                                       °
  93.   '''For example assignment to a variable may be given by :=; exponentia       °
  94.  tion'''                                                                       °
  95.   '''may be given by ** and so on. APL and APL2 has adopted an entirely'       °
  96.  ''                                                                            °
  97.   '''different strategy. All commonly used functions are assigned specia       °
  98.  l'''                                                                          °
  99.   '''symbols. For monadic functions, the symbol ALWAYS preceeds the argu       °
  100.  ment.'''                                                                      °
  101.   '''For dyadic functions, the symbol is ALWAYS placed between the two''       °
  102. X' '''arguments.''' 'endd'                                                     °
  103. *(1997 9 14 12 30 44 504)                                                      °
  104. XFDISCLAIMER ÉFX 'DISCLAIMER' 'Σ Copyright statement' 'disclaimer'             °
  105. *(1996 4 6 16 1 57 400)                                                        °
  106.  FDISPLAY ÉFX 'D╜S DISPLAY A;ÉIO;R;C;HL;HC;HT;HB;VL;VB;V;W;N;B'                °
  107.   'Σ DISPLAY A GENERAL ARRAY IN PICTORIAL FORM'                                °
  108.   'Σ  NORMAL CALL IS MONADIC.  DYADIC CALL USED ONLY IN'                       °
  109.   'Σ    RECURSION TO SPECIFY DISPLAY RANK, SHAPE, AND DEPTH.' 'ÉIO╜0'          °
  110.   '»(0=ÉNC ''S'')/''S╜µA''' 'R╜╞µ,S                   Σ PSEUDO RANK.'          °
  111.   'C╜''┐┌└┘''                 Σ UR, UL, LL, AND LR CORNERS.'                   °
  112.   'HL╜''─''                   Σ HORIZONTAL LINE.'                              °
  113.   'HC╜HL,''Θ╕'',HL,''~+ε''      Σ HORIZONTAL BORDERS.'                         °
  114.   'HT╜HC[(0<R)⌡1+0<╞²1╞,S]' 'ΣW╜,0╧■╞0µΓ(1⌐µA)╞A'                              °
  115.   'HB╜HC[3+3╛(''2⌡~A╧«A'' ÉEA ''1+╞ε0⌡(1⌐⌡/µA)╞,A'')+3⌡1<µµS]'                 °
  116.   'VL╜''│''                   Σ VERTICAL LINE.'                                °
  117.   'VB╜VL,''Φ╟''               Σ VERTICAL BORDER.'                              °
  118.   'V╜VB[(1<R)⌡1+0<²1╞²1╟,S]'                                                   °
  119.   '»(0εµA)/''A╜(1⌐µA)µΓ╞A''   Σ SHOW PROTOTYPE OF EMPTIES.'                    °
  120.   '╕(1<╧A)/GEN' '╕(2<µµA)/D3'                                                  °
  121.   'D╜«A                     Σ SIMPLE ARRAYS.' 'W╜1╞µD╜(²2╞1 1,µD)µD'           °
  122.   'N╜²1+1╟µD' '╕(0=µµA)/SS'                                                    °
  123.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  124.  3]' '╕0' 'SS:HB╜((0 '' '')=╞0µΓA)/'' -'''                                     °
  125.   'D╜'' '',('' '',[0]D,[0]HB,Nµ'' ''),'' ''' '╕0'                              °
  126.   'GEN:D╜«DISPLAY■A          Σ ENCLOSED ...' 'N╜Dδ.⌠'' '''                     °
  127.   'D╜(Nδ~1ΦN)≡D' 'D╜(δ≡~''  ''╤D)/D' 'D╜((1,µS)µS)DISPLAY D'                   °
  128.   '╕(2≥µ,S)╟D3E,0' 'D3:D╜0 ²1╟0 1╟«ΓA         Σ MULT-DIMENSIONAL ...'          °
  129.   'W╜1╞µD' 'N╜²1+1╟µD'                                                         °
  130.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  131.  3]' 'D3E:N╜²2+µ,S'                                                            °
  132. X 'V╜C[Nµ1],[0]VB[1+0<²2╟,S],[0](((²3+╞µD),N)µVL),[0]C[Nµ2]' 'D╜V,D'           °
  133. *(1997 5 3 14 5 42 344)                                                        °
  134.  FDUAL ÉFX 'DUAL' 'Σ Concept of duality explained'                             °
  135.   '''APL functions, can be compared to Mathematical functions. Although'       °
  136.  ''                                                                            °
  137.   '''the same word FUNCTION is used, the meaning and usage need not be t       °
  138.  he'''                                                                         °
  139.   '''same. In general, most if not all Mathematical functions can be rea       °
  140.  dily'''                                                                       °
  141.   '''defined as APL2 functions. Certain APL2 functions, however, would b       °
  142.  e''' '''only marginally considered as mathematical.'',r'                      °
  143.   '''Catenation for example, where the expression A,B generates a vector       °
  144.   C'''                                                                         °
  145.   '''whose components are the elements of A and B would probably not be'       °
  146.  ''                                                                            °
  147.   '''considered a function in the strictest elementary algebraic sense.'       °
  148.  '' 'do'                                                                       °
  149.   '''In mathematics, a function of one variable x is denoted as f(x).'''       °
  150.   '''In APL2 such a function is called MONADIC. A function of two variab       °
  151.  les'''                                                                        °
  152.   '''x and y would be written as F(x,y). In APL2 this would be a DYADIC'       °
  153.  ''                                                                            °
  154.   '''function. However, the APL2 expression f/VECTOR, where f stands for       °
  155.  '''                                                                           °
  156.   '''any valid primitive APL2 function can be considered as a function o       °
  157.  f''' '''two variables, if VECTOR contains only two elements.''' 'do'          °
  158.   '''Both algebraic and APL2 functions can be separated into two groups:       °
  159.  '',r'                                                                         °
  160.   '''  1. There are functions that produce an irreversible result.'''          °
  161.   '''     An example is multiplication. 4⌡5 produces 20, but having the'       °
  162.  ''                                                                            °
  163.   '''     value of 20 we find that there is an infinity of number pairs'       °
  164.  ''                                                                            °
  165.   '''     whose product is 20. Therefore this function is not what is'''       °
  166.   '''     called a ONE TO ONE relationship.'',r'                               °
  167.   '''  2. There are some functions for which there is a unique inverse.        °
  168.  For'''                                                                        °
  169.   '''     example, if the product 4⌡5 returns 20 AND 4 (one of the facto       °
  170.  rs)'''                                                                        °
  171.   '''     then the second factor can be always recovered (with 20÷4).'',       °
  172.  r'                                                                            °
  173.   '''In the second example the expressions 4⌡5 and 20÷4 are called DUALS       °
  174.  ''' '''(with respect to 5 -- the second factor).'''                           °
  175.   '''Some APL2 primitive functions are self duals. This means that a sec       °
  176.  ond'''                                                                        °
  177.   '''application of the same function will reproduce the original value.       °
  178.  '',r' 'show ''-5'' ''--5'' ''÷7'' ''÷÷7'''                                    °
  179.   '''Why is the concept of duals so important? As we will see later, man       °
  180.  y'''                                                                          °
  181.   '''problems can be solved readily in a form that involves transformati       °
  182.  ons'''                                                                        °
  183.   '''requiring dual conversion. Consider the following problem.'',r'           °
  184.   '''PROBLEM: Adjust a fractional number to the nearest integer''' 'do'        °
  185.   '''Let us say that we have two numbers 3.24 and 6.87. Clearly the near       °
  186.  est'''                                                                        °
  187.   '''integer to the first one is 3, and the nearest integer to the secon       °
  188.  d'''                                                                          °
  189.   '''one is 7. This problem is solved with a technique called HALF ADJUS       °
  190.  T.''' '''We merely add one half and take the floor'',r'                       °
  191.   'show ''╛.5+3.24 6.87'''                                                     °
  192.   '''But now suppose we want to adjust 5.123 and 2.749 to the nearest on       °
  193.  e'''                                                                          °
  194.   '''hundreth. We solve this by applying ⌡100 and then its dual ÷100'',r       °
  195.  ' 'show ''(╛.5+100⌡5.123 2.749)÷100'''                                        °
  196.   '''Encode and decode are dual, provided the left argument is preserved       °
  197. X.''' 'endd'                                                                   °
  198. *(1996 4 6 16 1 57 400)                                                        °
  199.  FEXIT ÉFX 'EXIT' 'Σ Exit from function' '''To log off type:   )OFF'''         °
  200. X '╕'                                                                          °
  201. *(1996 4 6 16 1 57 400)                                                        °
  202.  FGO ÉFX 'GO;T;E;B' 'Σ Expression driver' 'L0:B╜E╜''''' 'æ╜''      '''         °
  203.   'T╜æ' '╕(^/'' ''=T)/L0' '╕((^/'')OFF ''=5╞6╟T)doif ''EXIT'')/0'              °
  204.   '╕(('':''εT)doif ''B╜evaldd (+/^\'''' ''''=T)╟T'')/L0'                       °
  205.   '''E╜ÉEM'' ÉEA T' '╕(0=µ,E)/L0' '╕B/L0'                                      °
  206.   '''This is not a valid APL2 expression''' 'æ╜''*'''                          °
  207. X '╕(''?''⌠╞1╟æ)/L0' 'E' '╕L0'                                                 °
  208. *(1997 8 12 12 29 51 516)                                                      °
  209.  FHELP ÉFX 'HELP;N;I;T' 'Σ Help to student' '''WHAT TO DO'',r'                 °
  210.   '''  ° To get out of the lesson''' '''       ENTER: EXIT'''                  °
  211.   '''  ° To log off APL2'''                                                    °
  212.   '''       FIRST, ENTER: EXIT  THEN ENTER: )OFF'''                            °
  213.   '''  ° To get help''' '''       ENTER: HELP'''                               °
  214.   '''  ° When you see the prompt on a blank line'''                            °
  215.   '''       ENTER AN APL2 EXPRESSION - OR JUST PRESS: ENTER''' 'do'            °
  216.   '''  ° If you get this line'',r'                                             °
  217.   '''This is not a valid APL2 expression'',r,''*'',r'                          °
  218.   '''        YOU CAN EITHER''' '''           A. PRESS: ENTER'''                °
  219.   '''           B. PRESS: ? and then ENTER to see what was incorrect'''        °
  220.   '''              in your expression causing that response'',r' 'do'          °
  221.   '''HINTS'',r'                                                                °
  222.   '''This lesson is made up of '',(«N╜7),'' components named TEACHx, whe       °
  223.  re''' '''the x stands for a digit:'',r' 'I╜0'                                 °
  224.   'L0:T╜''TEACH'',(«I╜I+1)' 'T,'' '',1╟notb(ÉCR T)[2;]' '╕(N>I)/L0'            °
  225.   'do'                                                                         °
  226.   '''You may review either of these components separately. To do that,''       °
  227.  '                                                                             °
  228.   '''first enter EXIT (and RETURN), then enter the name of the lesson.''       °
  229.  ' '''component (e.g. TEACH4).'',r'                                            °
  230.   '''To re-start the lesson, just enter TEACH'',r'                             °
  231.   '''When the screen fills up, it is a good idea to move the cursor to''       °
  232.  ' '''the start of a convenient paragraph, and press ENTER'',r'                °
  233.   '''You may also wish to press PAGE UP to review the prevous pages.'''        °
  234.   'do' '''RESOURCES'',r'                                                       °
  235.   '''You may also enter ONE of the following words at a time'',r'              °
  236.   'π''COMPLEX'' ''CONVENTION'' ''DUAL'' ''MODULO'' ''REVIEW'' ''RESIDUE'       °
  237. X'' 'endd'                                                                     °
  238. *(1997 5 3 14 6 3 192)                                                         °
  239.  FMODULO ÉFX 'MODULO;Y;X;Q5M13;Q13M5;Q13M17;Q17M13;Q3M5;Q5M3;Q3M7;Q7M3'        °
  240.   'Σ Describe modulo arithmetic'                                               °
  241.   '''Modulo arithmetic is a powerful tool in mathematics. Some of the'''       °
  242.   '''most fundamental proofs of Algebra require familiarity with modulo'       °
  243.  ''                                                                            °
  244.   '''arithmetic. Two numbers A and B are said to be CONGRUENT MODULO C''       °
  245.  '                                                                             °
  246.   '''if (C|A)=C|B. Modulo arithmetic can be derived from the following''       °
  247.  ' '''properties:'',r'                                                         °
  248.   'show ''(17|5+7)=17|7+5  Σ  Reflexive'' ''(17|27)=17|44'''                   °
  249.   'show ''(17|44)=17|27  Σ  Symmetric'' ''(17|10)=17|27'''                     °
  250.   'show ''(17|27)=17|44'' ''(17|10)=17|44  Σ  Transitive'''                    °
  251.   '''If the difference between two numbers A and B is divisible by C, th       °
  252.  en''' '''A and B are CONGRUENT MODULO C.'',r'                                 °
  253.   'show ''(17|44)-17|27   Σ  44 and 27 are CONGRUENT MODULO 17'''              °
  254.   '''which is the same as'',r' 'show ''17|44-27'''                             °
  255.   '''One of the most famous results in modulo arithmetic is the law of''       °
  256.  '                                                                             °
  257.   '''quadratic reciprocity. To show what this law means, let us first'''       °
  258.   '''define a quadratic residue: For any X, the result of the expression       °
  259.  '''                                                                           °
  260.   '''P|Q-X*2 is called a quadratic residue if it returns a ZERO. P and Q       °
  261.  ''' '''are assumed to be primes.'',r' 'show ''X╜76'' ''17|²13+X*2'''          °
  262.   '''Here (X*2) is a quadratic residue. There are actually many solution       °
  263.  s'''                                                                          °
  264.   '''to X. The theorem states that for the existence of X, the following       °
  265.  ''' '''situations may arise (For simplicity we set Y╜X*2):'',r'               °
  266.   ''' 1. if 4|P Q returns 3 3, then then Y exists only for one expressio       °
  267.  n''' '''             of the form'',r'                                         °
  268.   '''             P|Q+Y  or Q|P+Y'',r'                                         °
  269.   ''' 2. if 4|P Q returns 1 1 then '''                                         °
  270.   '''    a. there is no Y╜X*2 or'''                                            °
  271.   '''    b. there is such Y, and there are also values of Y╜X*2 such tha       °
  272.  t''' '''       both P|Q+Y and Q|P+Y are congruent'',r'                        °
  273.   ''' 3. if 4|P Q returns 3 1 or 1 3, there is no such Y'',r' 'do'             °
  274.   '''EXAMPLES''' '''Case 1'',r'                                                °
  275.   '''  We generate vectors Q3M7 and Q7M3, noting that 4|3 7 returns 3 3'       °
  276.  ',r'                                                                          °
  277.   'show ''Q3M7╜(0=3|²7+(∞200)*2)/∞200'' ''Q7M3╜(0=7|²3+(∞200)*2)/∞200'''       °
  278.   '''  then'',r' 'show ''µQ3M7'' ''µQ7M3''' '''Case 2a'''                      °
  279.   '''  First, we generate the following two vectors'',r'                       °
  280.   'show ''Q5M13╜(0=5|²13+(∞500)*2)/∞500'' ''Q13M5╜(0=13|²5+(∞500)*2)/∞50       °
  281.  0'''                                                                          °
  282.   '''  Since 4|5 13 returns 1 1 both or none has a solution. We have'',r       °
  283.  ' 'show ''µQ5M13'' ''µQ13M5''' '''  so 5 and 13 have no solution.'',r'        °
  284.   '''Case 2b'''                                                                °
  285.   'show ''Q13M17╜(0=13|²17+(∞800)*2)/∞800'' ''Q17M13╜(0=17|²13+(∞800)*2)       °
  286.  /∞800'''                                                                      °
  287.   'show ''µQ13M17'' ''µQ17M13'' ''X╜(Q13M17εQ17M13)/Q13M17'' ''X'''            °
  288.   '''  where vector X gives solutions to the law of quadratic reciprocit       °
  289.  y'',r' 'show ''13|²17+X*2'' ''17|²13+X*2''' '''Case 3'''                      °
  290.   '''  We generate vectors Q3M5 and Q5M3, noting that 4|3 5 returns 3 1'       °
  291.  ',r'                                                                          °
  292.   'show ''Q3M5╜(0=3|²5+(∞200)*2)/∞200'' ''Q5M3╜(0=5|²3+(∞200)*2)/∞200'''       °
  293. X '''  then'',r' 'show ''µQ3M5'' ''µQ5M3''' 'endd'                             °
  294. *(1996 4 6 16 1 58 404)                                                        °
  295.  FMORE ÉFX 'MORE W' 'Σ More on aspects of new concepts' '╕(W=1 2)/L1,L2'       °
  296.   '╕0' 'L1:''Both encode and decode accept negative numbers'',r'               °
  297.   'show ''²10 ²10 ²10ÿ234'' ''²10|234'' ''²10|(234-²6)÷²10'''                  °
  298.   'show ''²10|(234-²6+²4⌡²10)÷²10⌡²10'''                                       °
  299.   '''The reverse operation is not as clearcut, and is omitted. When the'       °
  300.  '' '''right argument is negative,'',r'                                        °
  301.   'show ''10 10 10ÿ²234'' ''10|²234'' ''10|(²234-6)÷10'' ''10|(²234-6+6⌡       °
  302.  10)÷10⌡10''' '''Finally, when both arguments are negative'',r'                °
  303.   'show ''²10 ²10 ²10ÿ²234'' ''²10|²234'' ''²10|(²234-²4)÷²10'''               °
  304.   'show ''²10|(²234-²4+²7⌡²10)÷²10⌡²10'''                                      °
  305.   '''Now consider decode with negative numbers'',r'                            °
  306.   'show ''10¥2 3 4'' ''(100⌡2) + (10⌡3) + 1⌡4'' ''10¥-2 3 4'''                 °
  307.   'show ''(100⌡²2)+(10⌡²3)+1⌡²4'' ''²10¥2 3 4'' ''(²10⌡²10⌡2) + (²10⌡3)        °
  308.  + 1⌡4''' 'show ''²10¥-2 3 4'' ''(²10⌡²10⌡²2) + (²10⌡²3) + 1⌡²4'''             °
  309.   'endd' '╕0'                                                                  °
  310.   'L2:''Decode can be used to solve polynomials. Consider the following'       °
  311.  ''                                                                            °
  312.   '''polynomial in X (we use APL notation instead of superscripts)'',r'        °
  313.   '''    (2⌡X*3) + (3⌡X*2) + (7⌡X) - 20'',r'                                   °
  314.   '''We can evaluate this polynomial for sample values of X'',r'               °
  315.   '''  X  F(X)''' '''  1    ²8''' '''  2    22''' ''' ²1   ²26''' 'do'         °
  316.   'show ''1¥2 3 7 ²20'' ''2¥2 3 7 ²20'' ''²1¥2 3 7 ²20'''                      °
  317.   '''Later we will learn how this process can be generalized to the'''         °
  318. X '''evaluation of F(X) where X is a vector''' 'endd'                          °
  319. *(1997 5 4 13 38 24 404)                                                       °
  320.  FRESIDUE ÉFX 'RESIDUE;i;M;VECTOR'                                             °
  321.   'Σ Residue applied to negative numbers'                                      °
  322.   '''Residue is easy to explain when we deal with integers. For positive       °
  323.  '''                                                                           °
  324.   '''numbers that are not integers (these are also called "real" numbers       °
  325.  )'''                                                                          °
  326.   '''the concept of residue is still simple, but also benefits from some       °
  327.  ''' '''additional explanation. Consider the numbers 5.35 and 12.8'',r'        °
  328.   'show ''5.35|12.8'' ''╛12.8÷5.35'' ''12.8-2⌡5.35'''                          °
  329.   '''Notice that we used the FLOOR of the ratio 12.8÷5.35 as the multipl       °
  330.  ier'''                                                                        °
  331.   '''in the last expression. In other words whatever the quantity in the       °
  332.  '''                                                                           °
  333.   '''left argument, it is multiplied an INTEGRAL number of times, such''       °
  334.  '                                                                             °
  335.   '''that the residue is less than that argument. Of course residue work       °
  336.  s''' '''with vector arguments'',r'                                            °
  337.   'show ''5.2|∞10'' ''5.2|0.3+∞10'' ''(∞5)|1+∞5'''                             °
  338.   '''What happens when we use negative numbers?'',r' 'show ''²5|7'''           °
  339.   '''This result requires more explanation. Let us assume that we are'''       °
  340.   '''looking at the X axis. To calculate the value 5|7, we mark a point'       °
  341.  ''                                                                            °
  342.   '''7 units to the right of the origin. Then we take the compass, and''       °
  343.  '                                                                             °
  344.   '''mark off the distance 5 as many times from the origin such that the       °
  345.  '''                                                                           °
  346.   '''compass point does not go past 7. We find that we fall short by 2''       °
  347.  ,r' '''    ╕                            x           x+2'''                    °
  348.   '''   |.....|.....|.....|.....|.....|.....|.....|'''                         °
  349.   '''   0     1     2     3     4     5     6     7'',r' 'show ''5|7'''        °
  350.   '''Now let us look at ²5|7. The value of ╛7÷²5 is ²2. This time, since       °
  351.  '''                                                                           °
  352.   '''the 5 is a negative number, we begin at the 7, and move 2 times to'       °
  353.  '' '''the left. This will give us the value of ²3.'',r'                       °
  354.   '''2x╜                           x╜                            ╜'''          °
  355.   ''' |.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|'''         °
  356.   '''²3    ²2    ²1     0     1     2     3     4     5     6     7'',r'       °
  357.   'show ''²5|7'''                                                              °
  358.   '''When we evaluate 5|²7, we get 3. As before, we mark ²7 to the left'       °
  359.  ''                                                                            °
  360.   '''of the origin, and since 5 is positive, we start at the 7, and move       °
  361.  ''' '''two times (╛²7÷5) to the right. This will reach point 3.'',r'          °
  362.   '''  ╕                            x                             2x'''        °
  363.   ''' |.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|'''         °
  364.   '''²7    ²6    ²5    ²4    ²3    ²2    ²1     0     1     2     3'',r'       °
  365.   'show ''5|²7'''                                                              °
  366.   '''Finally, when evaluating ²5|²7 note that ╛²7÷²5 is 1. Therefore we'       °
  367.  ''                                                                            °
  368.   '''move 5 units to the left, and note that we still are 2 units short'       °
  369.  ',r' '''             x                            ╜'''                        °
  370.   ''' |.....|.....|.....|.....|.....|.....|.....|'''                           °
  371.   '''²7    ²6    ²5    ²4    ²3    ²2    ²1     0'',r' 'show ''²5|²7'''        °
  372.   '''       RESIDUE AND COMPLEX NUMBERS'',r'                                   °
  373.   '''The same principle applies when the arguments to residue are comple       °
  374.  x''' '''numbers'',r' 'show ''i╜0J1'' ''i|2'''                                 °
  375.   '''The residue of dividing 2 by i is zero. Let us verify that'',r'           °
  376.   'show ''╛2÷i'' ''2-i⌡0J²2'''                                                 °
  377.   '''The residue of two complex numbers works the same way'',r'                °
  378.   'show ''M╜²9*÷3'' ''M'' ''i|M'' ''╛M÷i'' ''M-i⌡1J²1'''                       °
  379.   '''Here is another example'',r'                                              °
  380.   'show ''M|20J10'' ''╛20J10÷M'' ''20J10-M⌡9J²6'''                             °
  381.   '''Selective specification can also use the residue'',r'                     °
  382.   'show ''VECTOR╜∞10'' ''((2=5|VECTOR)/VECTOR)╜''''X'''''' ''VECTOR'''         °
  383. X 'endd'                                                                       °
  384. *(1996 4 6 16 1 58 404)                                                        °
  385.  FREVIEW ÉFX 'REVIEW W;V'                                                      °
  386.   'Σ Review reduction, logical and indexing functions'                         °
  387.   '╕(W=∞3)/L1,L2,L3' '╕0'                                                      °
  388.   'L1:''COMPRESSION:   boolean/vector'',r,''EXAMPLES'',r'                      °
  389.   'show ''0 1 1 0/∞4'' ''0 1 0 1 1 1 1 1 0 0 0/''''COMPRESSION'''''''          °
  390.   '''REPLICATION:  (integer vector)/vector'',r,''EXAMPLES'''                   °
  391.   'show ''(∞3)/∞3'' ''1 2 0 1 0 0 0 0 0 0 0/''''REPLICATION'''''''             °
  392.   '''N-WISE REDUCTION:  integer function/vector'',r,''EXAMPLES'',r'            °
  393.   'show ''3⌡/∞10'' ''2⌠/''''MISSING''''''' '╕L0'                               °
  394.   'L2:''The logical functions are NOT OR AND NOR NAND, and their'''            °
  395.   '''symbols are ~ δ ^ τ σ.'',r,''EXAMPLES '',r'                               °
  396.   'show ''~0 1'' ''0 1 0 1δ0 0 1 1'' ''0 1 0 1τ0 0 1 1'' ''0 1 0 1^0 0 1       °
  397.   1''' 'show ''0 1 0 1σ0 0 1 1''' '╕L0'                                        °
  398.   'L3:''Squad indexing is a primitive function using the ╙ symbol.'''          °
  399.   '''Bracket indexing is a notation to access elements of a vector'''          °
  400.   '''and can be used to the left of the assignment arrow.'',r,''EXAMPLES       °
  401.  '',r'                                                                         °
  402.   'show ''3╙∞5'' ''(1 3 5 7)[1+∞2]'' ''V╜''''TEST'''''' ''V[3 2 4]'''          °
  403. X 'L0:endd'                                                                    °
  404. *(1997 5 31 11 59 20 572)                                                      °
  405.  FRULE ÉFX 'V RULE W' 'Σ Display rules' '╕(2=ÉNC ''V'')/L0'                    °
  406. X '2 rule W ╪ ╕0' 'L0:V rule W'                                                °
  407. *(1997 7 4 11 32 9 320)                                                        °
  408.  FTEACH ÉFX 'TEACH' 'Σ Start fifth lesson in APL2 by Zdenek V JIZBA'           °
  409.   'exit ''TEACH''' 'initialize' 'TEACH1 Σ More primitive functions'            °
  410.   'TEACH2 Σ Lamp and direct definition of running average'                     °
  411.   'TEACH3 Σ Absolute value and residue' 'TEACH4 Σ Encode'                      °
  412.   'TEACH5 Σ Decode' 'TEACH6 Σ From arabic to roman, another way'               °
  413. X 'TEACH7 Σ The scan operator' 'problems'                                      °
  414. *(1997 5 3 11 48 5 356)                                                        °
  415.  FTEACH1 ÉFX 'TEACH1' 'Σ Review' 'exit ''TEACH1'''                             °
  416.   '''In lesson 4 we studied several forms of the reduction operator.'''        °
  417.   '''To refresh your memory, write some expressions to do COMPRESSION'''       °
  418.   '''REPLICATION, and N-WISE REDUCTION.''' 'do'                                °
  419.   '''Forgot what some of these are? Enter REVIEW 1 to see what these'''        °
  420.   '''terms mean.'',r' 'do'                                                     °
  421.   '''We also learned about logical functions. Do you recall what these''       °
  422.  ' '''are, and how they are used? If not, enter REVIEW 2.'',r' 'do'            °
  423.   '''Finally, we studied two different methods of INDEXING of components       °
  424.  '''                                                                           °
  425.   '''of vectors. Try some expressions using indexing, or enter REVIEW 3.       °
  426.  ''' 'do'                                                                      °
  427.   '''In this lesson we will study some more primitive functions. We will       °
  428.  '''                                                                           °
  429.   '''also produce a better solution to the problem of converting Arabic'       °
  430.  '' '''numerals to Roman.''' 'do'                                              °
  431.   '''We will also study another operator called SCAN, and a special symb       °
  432.  ol''' '''called LAMP to allow comments in defined functions.'',r'             °
  433.   '''  WARNING! If you are not mathematically gifted, do NOT try out the       °
  434.  '''                                                                           °
  435.   '''  suggested "detours" (i.e. upper case functions named in the text)       °
  436.  ,'''                                                                          °
  437.   '''  especially on a first reading of this lesson. Although some may g       °
  438.  ive'''                                                                        °
  439.   '''  historic information, they tend to be technical, and will be best       °
  440.  '''                                                                           °
  441.   '''  understood, only if you have some mathematical training. This add       °
  442.  itional'''                                                                    °
  443.   '''  information is NOT essential for your mastery of APL2.''' 'do'          °
  444.   '''Some of the functions described in this lesson are unconventional i       °
  445.  n the'''                                                                      °
  446.   '''sense that you are not likely to be familiar with them. As you read       °
  447.  '''                                                                           °
  448.   '''about these functions, you would do well to practice by entering yo       °
  449.  ur'''                                                                         °
  450.   '''own expressions whenever the prompt appears on a blank line.'''           °
  451. X 'endd'                                                                       °
  452. *(1997 5 3 11 50 19 420)                                                       °
  453.  FTEACH2 ÉFX 'TEACH2;RUNAV' 'Σ The lamp symbol' 'exit ''TEACH2'''              °
  454.   '''      COMMENTS'',r'                                                       °
  455.   '''There are occasions when it is desirable to write a line of comment       °
  456.  s.'''                                                                         °
  457.   '''Such a line is not to be considered to be part of an executable'''        °
  458.   '''expression. There is a special APL2 symbol called LAMP Σ. Here are        °
  459.  some''' '''examples of its usage:'',r'                                        °
  460.   '''You may write a comment on your screen to be ignored by APL2:'''          °
  461.   'show ''Σ This line is a comment line. it is not evaluated'''                °
  462.   '''You may follow an expression to be evaluated by a comment:'''             °
  463.   'show '' 5+/∞6     Σ Add the components of vector ∞6 5 elements at a t       °
  464.  ime''' '''You may include a comment in a defined function algorithm'''        °
  465.   '1 show ''RUNAV:(α+/∙)÷α        Σ Running average of length α on vecto       °
  466.  r ∙''' 'show ''5 RUNAV ∞7'''                                                  °
  467.   '''Incidentally, while IN THE LESSON, you can display a direct definit       °
  468.  ion''' '''function by entering just the function name and a colon:'''         °
  469.   '1 show ''RUNAV:'''                                                          °
  470.   '''The comment symbol is used most frequently as documentation of user       °
  471. X''' '''defined functions, as in the example of RUNAV.''' 'endd'               °
  472. *(1997 5 15 14 27 48 504)                                                      °
  473.  FTEACH3 ÉFX 'TEACH3' 'Σ Absolute value and residue' 'exit ''TEACH3'''         °
  474.   '''       ABSOLUTE VALUE'''                                                  °
  475.   '''Our modern mathematical notation is a collection of conventions'''        °
  476.   '''that have been adopted by mathematicians over the past 500 years.''       °
  477.  '                                                                             °
  478.   '''Even though these conventions have been very successful in providin       °
  479.  g a'''                                                                        °
  480.   '''vehicle for mathematical thought, they do have some inconsistencies       °
  481.  .'''                                                                          °
  482.   '''For a historic review of mathematical conventions, enter CONVENTION       °
  483.  .'',r' 'do'                                                                   °
  484.   '''One example of such an inconsistency is the commonly accepted notat       °
  485.  ion'''                                                                        °
  486.   '''to describe the absolute value of a number. Given a number A, its''       °
  487.  '                                                                             °
  488.   '''absolute value is described as |A|. Clearly, |A| is a function, and       °
  489.  '''                                                                           °
  490.   '''as such it is entitled to a symbol, namely |. But for internal APL2       °
  491.  '''                                                                           °
  492.   '''consistency, a single usage in front of the variable is called for.       °
  493.  '',r' 'VECTOR╜²1 7 ²3 0 6 ²1 ²5 6 ²3 2'                                       °
  494.   'show ''|²20'' ''VECTOR'' ''|VECTOR'''                                       °
  495.   '''Absolute value is a monadic arithmetic function. It has no meaning        °
  496.  for''' '''character data. Here are some examples of its usage:'',r'           °
  497.   '''To find the largest and smallest absolute value:'''                       °
  498.   'show ''⌐/|VECTOR'' ''╛/|VECTOR''' '''To extract selected entries:'''        °
  499.   'show ''(3<|VECTOR)/VECTOR'' ''(3>|VECTOR)/VECTOR'''                         °
  500.   '''Absolute value is also defined for complex numbers. Enter COMPLEX t       °
  501.  o''' '''see a discussion of this subject''' 'do'                              °
  502.   '''           RESIDUE'',r'                                                   °
  503.   '''The dyadic version of the | function is called RESIDUE. It returns'       °
  504.  ''                                                                            °
  505.   '''the residue after dividing the right argument by the left argument'       °
  506.  ',r'                                                                          °
  507.   'show ''5|14'' ''╛14÷5'' ''14-2⌡5'' ''912|42875'' ''╛42875÷912'' ''428       °
  508.  75-47⌡912'''                                                                  °
  509.   '''Residue can be applied to fractional, negative and complex numbers.       °
  510.  ''' '''To see about these aspects of residue, enter RESIDUE''' 'do'           °
  511.   '''Since residue is a dyadic function, it can be used in reduction'',r       °
  512.  ' 'show ''|/5 12'' ''|/1,VECTOR'''                                            °
  513.   '''Can you explain the result in the last expression?''' 'do'                °
  514.   '''Here are some more examples showing how RESIDUE can be used to sele       °
  515.  ct''' '''components of a vector.'',r'                                         °
  516.   'show ''VECTOR╜|VECTOR'' ''VECTOR'' ''(2=5|VECTOR)/VECTOR'' ''(2⌠5|VEC       °
  517.  TOR)/VECTOR'''                                                                °
  518.   '''In these last two examples all components of VECTOR with (=) and'''       °
  519.   '''WITHOUT (⌠) residue equal to two after dividing by five are removed       °
  520.  .'',r'                                                                        °
  521.   '''If you have studied College Algebra, you might recognize residue'''       °
  522.   '''as MODULO. It is the same thing. Enter MODULO to see an example of'       °
  523.  ''                                                                            °
  524.   '''the well known theorem by Gauss dealing with "quadratic residues".'       °
  525. X'' 'endd'                                                                     °
  526. *(1997 8 26 13 7 54 500)                                                       °
  527.  FTEACH4 ÉFX 'TEACH4' 'Σ Encode' 'exit ''TEACH4'''                             °
  528.   '''Most of the primitive arithmetic functions studied so far are eithe       °
  529.  r'''                                                                          °
  530.   '''well known or can be readily explained and understood by anyone who       °
  531.  '''                                                                           °
  532.   '''has minimal background in algebra. We will now introduce a primitiv       °
  533.  e'''                                                                          °
  534.   '''function that may be unfamiliar even to the most adept practitioner       °
  535.  s''' '''of algebraic manipulations.'',r' 'do'                                 °
  536.   '''The function is called ENCODE, and its symbol is(ÿ). Encode is a dy       °
  537.  adic'''                                                                       °
  538.   '''function, and it breaks down a number into residues after division'       °
  539.  ''                                                                            °
  540.   '''by cumulative products of the left argument. Here is an example'',r       °
  541.  ' 'show ''10 10 10ÿ234'''                                                     °
  542.   '''The process can be explained with the following sequence'',r'             °
  543.   'show ''10|234'' ''10|(234-4)÷10'' ''10|(234-4+10⌡3)÷10⌡10'''                °
  544.   '''The product of the elements of the left argument must equal or exce       °
  545.  ed'''                                                                         °
  546.   '''the value in the right argument. If this condition is satisfied, th       °
  547.  en'''                                                                         °
  548.   '''the result of this operation is a vector such that the following'''       °
  549.   '''expression reproduces the right argument'',r'                             °
  550.   'show ''(2⌡100)+(3⌡10)+4⌡1'''                                                °
  551.   '''To illustrate the generality of this concept, consider the followin       °
  552.  g'',r' 'show ''(3µ11.1)ÿ234''' '''This is equivalent to'',r'                  °
  553.   'show ''11.1|234'' ''11.1|(234-.9)÷11.1'' ''11.1|(234-.9+9.9⌡11.1)÷11.       °
  554.  1⌡11.1''' '''or'',r' 'show ''(1⌡11.1*2)+(9.9⌡11.1*1)+0.9⌡11.1*0'''            °
  555.   '''The actual computation should proceed from the rightmost element of       °
  556.   the'''                                                                       °
  557.   '''left argument. Here is another example to illustrate this'',r'            °
  558.   'show ''8 5 11ÿ234'' ''11|234'' ''5|(234-3)÷11'' ''8|(234-3+1⌡11)÷5⌡11       °
  559.  ''' '''This can be represented as'',r'                                        °
  560.   'show ''(4⌡5⌡11) + (1⌡11) + 3'''                                             °
  561.   '''Encode requires that the product of the elements in the left argume       °
  562.  nt'''                                                                         °
  563.   '''MUST equal or exceed the largest value in the right argument.'''          °
  564.   '''Notice that in this last example  234<8⌡5⌡11. If we had a vector as       °
  565.  '''                                                                           °
  566.   '''right argument, such that its product is less than 234, the encode'       °
  567.  '' '''would return an invalid result'',r'                                     °
  568.   'show ''⌡/3 5 11'' ''3 5 11|234'' ''(0⌡5⌡11) + (4⌡11) + 3'''                 °
  569.   '''One application of encode would be in the conversion of an angle in       °
  570.  ''' '''seconds to degrees, minutes and seconds'',r'                           °
  571. X 'show ''360 60 60ÿ12345'' ''(3⌡60⌡60)+(25⌡60)+45''' 'endd'                   °
  572. *(1997 5 3 13 57 35 520)                                                       °
  573.  FTEACH5 ÉFX 'TEACH5' 'Σ Decode' 'exit ''TEACH5'''                             °
  574.   '''Actually, the reverse problem is more likely to arise first. To'''        °
  575.   '''convert an angle in degrees, minutes and seconds to just seconds'''       °
  576.   '''minutes or degrees. Encode has an inverse operation (or DUAL), call       °
  577.  ed''' '''DECODE. It is represented by the symbol (¥)'',r'                     °
  578.   'show ''10¥10 10 10ÿ243'' ''60¥24 60 60ÿ12345'''                             °
  579.   '''The concept of a DUAL is important in mathematics as well as in'''        °
  580.   '''programming. If you want to find out more about it, enter DUAL.'''        °
  581.   'do'                                                                         °
  582.   '''The value in the left argument may be a single scalar if it is'''         °
  583.   '''repeated. However, when the encode left argument is not repeated,''       °
  584.  '                                                                             °
  585.   '''then the decode argument must contain a vector of the same lenth as       °
  586.  ''' '''that of the right argument'',r'                                        °
  587.   'show ''5 6 7ÿ123'' ''0 6 7¥5 6 7ÿ123'' ''5 6 7¥5 6 7ÿ123'''                 °
  588.   '''We will return to encode and decode again, when we study arrays.'''       °
  589.   '''Meanwhile, enter MORE 1 if you want to see more about these two'''        °
  590.   '''primitive functions''' 'do'                                               °
  591.   '''There is a relationship between decode and evaluation of polynomial       °
  592. Xs.''' '''If you have background in ALGEBRA, enter MORE 2''' 'endd'            °
  593. *(1997 5 3 13 57 20 460)                                                       °
  594.  FTEACH6 ÉFX 'TEACH6;T;ROMAN;RO;RX'                                            °
  595.   'Σ Converting Arabic to Roman numerals; comments' 'exit ''TEACH6'''          °
  596.   '''We can now rewrite the algorithm for the conversion of integers to'       °
  597.  ''                                                                            °
  598.   '''Roman numerals. This time we can do it for numbers up to 3999.'''         °
  599.   '''Beyond that, the Romans used symbols not in the alphabet. For'''          °
  600.   '''example 10000 was represented as Γ|π.'',r'                                °
  601.   '''We begin by defining function ROMAN'',r'                                  °
  602.   '1 show ''ROMAN:RO 10 10 10 10ÿ∙:∙>3999:''''This number is too large''       °
  603.  '''''                                                                         °
  604.   '''If the argument is less than 3999, the encode function converts the       °
  605.  ''' '''integer to a vector of digits'',r' 'show ''10 10 10 10ÿ2345'''         °
  606.   '''This vector then becomes the right argument to defined function RO.       °
  607.  ''' '''We can write function RO as'',r'                                       °
  608.   'T╜''RO:(∙[1]µ''''M''''),(''''CDM''''RX ∙[2]),(''''XLC''''RX ∙[3]),'''       °
  609.  'IVX''''RX ∙[4]''' '1 show T'                                                 °
  610.   '''Function RO catenates four expressions. The first one merely displa       °
  611.  ys'''                                                                         °
  612.   '''as many symbols M, as there are thousands. The next three expressio       °
  613.  ns''' '''each convert a digit into the apropriate Roman expression.'''        °
  614.   '''Function RX is defined by'',r'                                            °
  615.   '1 show ''RX:((∙>4)µα[2]),(5|∙)µα[1]:4=5|∙:α[1,2+∙=9]'''                     °
  616.   '''Since ∙ is a single digit value, RX tests if this value is 4 or 9.'       °
  617.  ''                                                                            °
  618.   '''This is done with the expression 4=5|∙. If this returns 1, then RX'       °
  619.  ''                                                                            °
  620.   '''returns the first symbol of the left argument, followed by the'''         °
  621.   '''second or third, depending whether it is a 4 or 9'',r'                    °
  622.   'show ''W╜9'' ''''''IVX''''[1,2+W=9]'' ''W╜4'' ''''''CDM''''[1,2+W=9]'       °
  623.  ''                                                                            °
  624.   '''If the digit is not 4 or 9, then the left expression is evaluated.'       °
  625.  '' '''In this case, if the value is greater than 4, then the second'''        °
  626.   '''symbol of the left argument is catenated to the first symbol of the       °
  627.  '''                                                                           °
  628.   '''left argument repeated a number of times equal to the remainder whe       °
  629.  n''' '''divided by 5'',r'                                                     °
  630.   'show ''W╜3'' ''''''XLC''''[((W>4)µ2),(5|W)µ1]'' ''W╜7'' ''''''IVX''''       °
  631.  [((W>4)µ2),(5|W)µ1]''' '''We can now test function ROMAN'''                   °
  632.   'show ''ROMAN 2345'' ''ROMAN 27'' ''ROMAN 1990'''                            °
  633.   '''This solution is not necesarily the shortest or even the best. As w       °
  634.  e'''                                                                          °
  635.   '''learn more about APL2, we may try to improve on this solution.'',r'       °
  636. X '''Now let us study a new operator''' 'endd'                                 °
  637. *(1997 5 4 13 59 44 568)                                                       °
  638.  FTEACH7 ÉFX 'TEACH7;V' 'Σ The scan operator' 'exit ''TEACH7'''                °
  639.   '''        THE SCAN OPERATOR'',r'                                            °
  640.   '''The reduce operator inserts a function between every pair of elemen       °
  641.  ts''' '''of a vector'',r' 'show ''+/(÷∞25)*3'' ''+/(÷∞50)*3'''                °
  642.   '''What if we want to see all the intermediate values of this computat       °
  643.  ion?'''                                                                       °
  644.   '''There is an operator that will do that. It is called the SCAN opera       °
  645.  tor.'''                                                                       °
  646.   '''The symbol is \ and it can be obtained by pressing the upper case /       °
  647.  .'',r' 'show ''+\∞5'' ''⌡\∞5'' ''÷\2 2 2 2 2 2 2 2'''                         °
  648.   '''The first example shows a sequence often called the triangular numb       °
  649.  ers.''' '''It arises from adding points from a triangular shape'',r'          °
  650.   '''      Ω'',r ''     Ω Ω'',r ''    Ω Ω Ω'',r,''    :  :  :'',r'             °
  651.   '''The second example is a special function, called the FACTORIAL. APL       °
  652.  2'''                                                                          °
  653.   '''has a special symbol for this function, but we will not study it no       °
  654.  w.''' 'do'                                                                    °
  655.   '''The third example illustrates the process of evaluation for scan.''       °
  656.  ,r' 'show ''÷\6µ2'' ''÷/2'' ''÷/2 2'' ''÷/2 2 2'' ''÷/2 2 2 2'''              °
  657.   '''and so on. Each element of the result is equivalent to the reductio       °
  658.  n'''                                                                          °
  659.   '''of the first N elements. You should recall that when a vector is'''       °
  660.   '''reduced, the evaluation proceeds from RIGHT TO LEFT. So for the'''        °
  661. X '''third element we do not get (2÷2)÷2, but rather 2÷(2÷2)!''' 'endd'        °
  662. XCa 1 3 IVX                                                                    °
  663. *(1997 7 13 12 28 49 504)                                                      °
  664.  Faddquote ÉFX 'u╜addquote w'                                                  °
  665.   'Σ Put quotes around a string, and double existing quotes'                   °
  666. X 'u╜ÉAV[40],((1+w=ÉAV[40])/w),ÉAV[40]'                                        °
  667. XCalpha 1 26 ABCDEFGHIJKLMNOPQRSTUVWXYZ                                        °
  668. *(1997 7 24 13 20 38 476)                                                      °
  669.  Fav ÉFX 'av;A;N;I;ÉIO' 'Σ Display characters in ÉAV' 'ÉIO╜0'                  °
  670.   'A╜22 78µ'' ''' 'N╜3 0«φ12 22µ1+∞356' 'A[;,(6⌡∞12)°.+2 3 4]╜N'               °
  671.   'A[;6+6⌡∞12]╜φ12 22µÉAV' 'ΣA[8 10 13;6]╜'' ''' 'A[13;6]╜'' '''               °
  672. X 'A[14+∞8;68 69 70 72]╜'' ''' 'A'                                             °
  673. XCb 1 0                                                                        °
  674.  Ac╜('R0')('(∙[1]µ''M''),(''CDM'' R1 ∙[2]),(''XLC'' R1 ∙[3]),''IVX'' R1        °
  675. X∙[4]')('ΣDD ')                                                                °
  676. XCd 0 ½                                                                        °
  677. *(1991 11 11 8 25 13 316)                                                      °
  678.  Fdate ÉFX 'u╜date w' 'Σ Format date and time of day' 'u╜«6╞w'                 °
  679. X 'u╜('' ''⌠u)Γu' 'u╜εu,■''-- .. '''                                           °
  680. XCdig 1 10 1234567890                                                          °
  681. *(1997 9 9 13 0 45 372)                                                        °
  682.  Fdisclaimer ÉFX 'disclaimer' 'Σ Copyright statement'                          °
  683.   '(10µ'' ''),''Copyright, Z. V. Jizba, 1995,1996,1997'',r'                    °
  684.   ''' This and subsequent workspaces labelled TEACHxx are made available       °
  685.  '''                                                                           °
  686.   '''at no cost to anyone who desires to learn how to use effectively'''       °
  687.   '''the IBM/OS2 version of APL2.'',r'                                         °
  688.   '''This software is provided "AS IS" with no WARRANTY of any kind, eit       °
  689.  her'''                                                                        °
  690.   '''express or implied. Any risk in its use resides with you, the user        °
  691.  of''' '''these tutorials.'',r' '''     ACKNOWLEDGEMENTS'',r'                  °
  692.   ''' In writing these tutorials, I am greatly indebted to Roy Sykes, wh       °
  693.  ose'''                                                                        °
  694.   '''excellent lectures increased my understanding of the language.'''         °
  695.   '''Discussions with the late Harry Bertucelli clarified a number of'''       °
  696.   '''concepts and caused me to change some improper terminology that was       °
  697.  '''                                                                           °
  698.   '''used in previous versions of these tutorials. Mr. Benjamin Archer''       °
  699.  '                                                                             °
  700.   '''kindly checked out a nearly final version, bringing to my attention       °
  701.  ''' '''some ommisions, misspellings, and invalid terminology.'',r'            °
  702. X '''(PRESS ENTER to continue)'''                                              °
  703. *(1997 7 13 12 28 50 508)                                                      °
  704.  Fdo ÉFX 'do;T;E' 'Σ Expression driver' 'E╜''''' 'æ╜''      ''' 'T╜æ'          °
  705.   '╕(^/'' ''=T)/0'                                                             °
  706.   '╕(('':''εT)doif ''B╜evaldd (+/^\'''' ''''=T)╟T'')/2'                        °
  707.   '''E╜ÉEM'' ÉEA T' '╕(0=µ,E)/2'                                               °
  708.   '''This is not a valid APL2 expression''' 'æ╜''*''' '╕(''?''⌠╞1╟æ)/2'        °
  709. X 'E' '╕2'                                                                     °
  710. *(1997 7 13 12 28 50 508)                                                      °
  711.  Fdoif ÉFX 'U╢╜V╢ doif W╢;t╢' 'Σ Rule' '╕(^/~U╢╜V╢)/0'                         °
  712. X '''U╢╜V╢ doif■ W╢'' ÉEA ''»V╢/W╢'''                                          °
  713. *(1997 9 9 12 50 14 444)                                                       °
  714.  Fendd ÉFX 'endd' 'Σ end of special feature' '20µ''²'' ╪ ╕(4<µÉLC)/0'          °
  715. X 'do'                                                                         °
  716. *(1997 8 12 12 26 34 436)                                                      °
  717.  Ferase ÉFX                                                                    °
  718.   'erase;T;EXIT;GO;HELP;DISPLAY;REVIEW;CONVENTION;MORE;DUAL;MODULO;RESID       °
  719.  UE;COMPLEX;RULE;DISCLAIMER'                                                   °
  720.   'Σ Erase all global functions and variables' 'T╜ÉNL 3'                       °
  721.   'T╜(~T^.εlc,'' '')≡T' 'T╜ÉEX(~T[;∞5]^.=''TEACH'')≡T' 'T╜ÉNL 2'               °
  722. X 'T╜ÉEX(~T^.εlc,'' '')≡T' 'T╜ÉNL 4' 'T╜ÉEX(~T^.εlc,'' '')≡T'                  °
  723. *(1997 7 27 13 47 41 608)                                                      °
  724.  Fevaldd ÉFX 'u╜evaldd w;c;n' 'Σ Evaluate direct definition' 'u╜0'             °
  725.   'n╜(w∞''Σ'')-1' 'c╜(((n╞w)⌠'':'')Γn╞w),Γ''ΣDD '',(n+1)╟w'                    °
  726.   '╕((1 label╞c)doif ''''''Invalid label'''''')/0'                             °
  727.   '╕((2=µc)doif ''u╜showdd 1╙c'')/0'                                           °
  728.   '╕((3=ÉNC╞c)doif ''u╜⌡µÉ╜(╞c),'''' is already defined.'''''')/0'             °
  729.   '╕((3=µc)doif ''u╜simdd c'')/0' 'c╜(Γ''α∙ aw'')replace■c'                    °
  730.   'u╜ε''u╜'',((''a''εεc[2 3 4])/''a ''),(╞c),'' w;t;b'''                       °
  731.   'u╜u(5πc)(''b╜(t╜'',(3πc),'')/'',addquote ''u╜'',4πc)'                       °
  732. X 'u╜u,''╕(t doif b)/0''(''u╜'',2πc)' 'u╜╧ÉFX u'                               °
  733. *(1997 7 25 13 27 52 564)                                                      °
  734.  Fexit ÉFX 'V exit W;T' 'Σ Exit if too many suspended functions'               °
  735.   '╕(0⌠ÉNC ''V'')/L0 ╪ V╜10' 'L0:╕(V>µÉLC)/0'                                  °
  736.   '''There are too many suspended functions''' '''Please enter '',W'           °
  737. X '╕'                                                                          °
  738. *(1997 7 26 12 33 39 536)                                                      °
  739.  Fget ÉFX 'U╜V get W;t;T;ÉPR' 'Σ Prompt for response from keyboard'            °
  740.   'ÉPR╜T╜ÉAV[ÉIO+255] ╪ ╕(0⌠ÉNC ''V'')/L0 ╪ V╜1' 'L0:V╜V╧1' 'æ╜W ╪ t╜æ'        °
  741.   'U╜(+/^\t=T)╟t' '╕(''╕''⌠╞U)/L1 ╪ ╕' 'L1:╕V/0' 't╜(U⌠'' '')ΓU'               °
  742. X 'U╜(µt),(ΓU),t'                                                              °
  743. *(1997 7 28 13 33 8 424)                                                       °
  744.  Fglobals ÉFX 'globals' 'Σ Initialize useful global variables'                 °
  745.   'uc╜''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''                                          °
  746.   'lc╜''abcdefghijklmnopqrstuvwxyz''' 'dig╜''1234567890'''                     °
  747. X 'r╜ÉAV[13+ÉIO]' 'q╜'''''''''                                                 °
  748. *(1997 7 3 12 47 6 368)                                                        °
  749.  Finitialize ÉFX 'initialize;T' 'Σ Initialize workspace'                       °
  750.   '''AT ALL TIMES, TO CONTINUE, PRESS RETURN!'',r'                             °
  751.   '''To see disclaimers enter:'',r,''    disclaimer''' 'do' 'erase'            °
  752.   'globals'                                                                    °
  753.   '''Make sure the CAP LOCK light on your keyboard (upper right) is ON!'       °
  754. X'' 'endd'                                                                     °
  755. *(1997 7 27 13 14 33 444)                                                      °
  756.  Flabel ÉFX 'u╜v label w'                                                      °
  757.   'Σ Return 1 if label w does not begin with a cap'                            °
  758.   '╕(0⌠ÉNC ''v'')/L0 ╪ v╜0' 'L0:v╜v╧1 ╪ w╜εw ╪ ╕v/L1 ╪ ╕(u╜0⌠ÉNC w)/0'         °
  759. X 'L1:╕(u╜~^/wεlc,uc,dig)/0' 'u╜w[1]εlc,dig'                                   °
  760. XClc 1 26 abcdefghijklmnopqrstuvwxyz                                           °
  761. XNn 0 59                                                                       °
  762. *(1997 7 13 12 28 55 528)                                                      °
  763.  Fnon ÉFX 'non;T;RC;ET;R' 'Σ Ignore keyboard entry' 'æ╜''      ''' 'T╜æ'       °
  764.   '╕(0=µ(T⌠'' '')/T)/0' '(RC ET R)╜ÉEC T' '╕(0=RC)/2'                          °
  765. X '╕((1=RC)doif ''R'')/2' '╕2'                                                 °
  766. *(1997 7 13 12 28 55 528)                                                      °
  767.  Fnotb ÉFX 'u╜notb w' 'Σ Remove trailing blanks'                               °
  768.   '╕((1<╧w)doif ''u╜notb■ w'')/0' '╕((1<µµw)doif ''u╜πnotb Γ[2]w'')/0'         °
  769. X 'u╜(1-(,'' ''⌠Φw)∞1)╟w'                                                      °
  770. XCp 1 2  "                                                                     °
  771. *(1997 7 27 12 55 6 496)                                                       °
  772.  Fproblems ÉFX 'problems' 'Σ Problems'                                         °
  773.   '''That is all for this lesson. Remember, if you want to practice,'''        °
  774.   '''and plan to use direct definitions, be sure to first enter GO.'''         °
  775.   '''Direct definitions will then be accepted. To exit GO, enter EXIT.''       °
  776.  ,r'                                                                           °
  777.   '''To erase a previously defined DIRECT DEFINITION FUNCTION, enter'',r       °
  778.  ' '''       )ERASE functionname'',r'                                          °
  779. X '''WARNING! do not use )ERASE on other labels.'',r'                          °
  780. XCq 0 '                                                                        °
  781. XCr 0                                                                         °
  782. *(1997 7 13 12 28 56 532)                                                      °
  783.  Freplace ÉFX 'u╜v replace u;i;r;s' 'Σ Replace elements in v in u'             °
  784.   'i╜Γ∞µu' 's╜2πv╜(v⌠'' '')Γv' 'i╜⌡r╜i⌡■Γ[1]u°.=╞v'                            °
  785. X 'u[(εi)/εr]╜s[(εi)/εi⌡■∞µs]'                                                 °
  786. *(1997 7 13 12 28 56 532)                                                      °
  787.  Fround ÉFX 'U╜V round W' 'Σ Half adjust to V th decimal'                      °
  788. X 'U╜(╛0.5+W⌡10*V)÷10*V'                                                       °
  789. *(1997 5 31 12 3 40 432)                                                       °
  790.  Frule ÉFX 'V rule W' 'Σ Additional remarks on rules'                          °
  791.   '╕(2=ÉNC ''V'')/L ╪ V╜0' 'L:╕(~(╞W)ε∞8)/LA ╪ V rulea╞W ╪ ╕L0'                °
  792.   'LA:╕((╞W)=8+∞3)/L9,L10,L11' '''This rule number is undefined'' ╪ ╕'         °
  793.   'L9:╕(V>1)/L9X'                                                              °
  794.   '''   RULE 9: To produce a quote inside a character string, enter'''         °
  795.   '''           the quote twice.'',2µr' '╕(0=V)/L0'                            °
  796.   'L9X:''This is used in most other programming languages.''' '╕L0'            °
  797.   'L10:╕(V>1)/L10X'                                                            °
  798.   ''' RULE 10: In replication the left argument must contain only'''           °
  799.   '''          integers. The length of the left argument must be'''            °
  800.   '''          the same as the length of the right argument.'',2µr'            °
  801.   '╕(0=V)/L0'                                                                  °
  802.   'L10X:''The left argument may also have negative integers. Only the nu       °
  803.  mber'''                                                                       °
  804.   '''of positive integers and zeros must add up to the length of the rig       °
  805.  ht'''                                                                         °
  806.   '''argument. Replicate with negative integers is not discussed here be       °
  807.  cause'''                                                                      °
  808.   '''the explanation requires concepts that have not yet been mentioned.       °
  809.  '',r' 'show ''1 1 2 ²1 0 1 1 1 ²1 1 0 1 1/''''CALIFORNIAN''''''' '╕L0'        °
  810.   'L11:╕(V>1)/L11X'                                                            °
  811.   '''   RULE 11: The expression inside square brackets must return'''          °
  812.   '''            positive integers in the range of the length of'''            °
  813.   '''            the indexed vector. If the expression is MISSING,'''          °
  814.   '''            the result is as if the brackets were missing.'',2µr'         °
  815.   '╕(0=V)/L0'                                                                  °
  816.   'L11X:''The expression in brackets need not be a vector. It could be a       °
  817.  n''' '''array as in the next example'',r'                                     °
  818.   'show ''''''CALIFORNIA''''[3 3µ?9µ10]'' ''(∞4)[3 3µ∞4]'''                    °
  819.   '''For rules not described in this lesson, see workspace INDEX'''            °
  820. X 'L0:do' '╕(0=µW╜1╟W)/0' '╕L'                                                 °
  821. *(1997 5 31 11 58 30 608)                                                      °
  822.  Frulea ÉFX 'V rulea W' 'Σ Additional remarks on rules'                        °
  823.   '╕(2=ÉNC ''V'')/L ╪ V╜0' 'L:╕(W=∞8)/L1,L2,L3,L4,L5,L6,L7,L8'                 °
  824.   '''For rules not described in this lesson, see workspace INDEX'''            °
  825.   '╕0' 'L1:╕(V>1)/L1X'                                                         °
  826.   '''RULE 1. For arithmetic operations a vector must be matched with a''       °
  827.  ' '''        scalar, or another vector of the same length.'',2µr'             °
  828.   '╕(0=V)/0'                                                                   °
  829.   'L1X:''This is the first of many rules dealing with the concept of'''        °
  830.   '''CONFORMABILITY. This means that elements to be processed by APL2'''       °
  831.   '''must in some ways match.''' '╕L0' 'L2:╕(V>1)/L1X'                         °
  832.   '''RULE 2. The reduction operator places the function, (specified to''       °
  833.  '                                                                             °
  834.   '''        its left), between all pairs of the vector. It then evaluat       °
  835.  es''' '''        the resulting expression.'',2µr' '╕(0=V)/0'                  °
  836.   'L2X:''There is more to this, but at this stage the rule is essentiall       °
  837.  y''' '''correct.''' '╕L0' 'L3:╕(V>1)/L1X'                                     °
  838.   '''RULE 3. All APL2 expressions are evaluated from right to left'',2µr       °
  839.  ' '╕(0=V)/0'                                                                  °
  840.   'L3X:''This rule is valid in APL, which is the earlier version of APL2       °
  841.  .'''                                                                          °
  842.   '''For APL2, the rule has been restated in a totally different way.'''       °
  843.   '''However until we introduce some concepts that are new to APL2, the'       °
  844.  '' '''newer form reduces to RULE 3 as stated.''' '╕L0' 'L4:╕(V>1)/L1X'        °
  845.   '''RULE 4. Vectors in APL2 can have lengths of zero and one.'',2µr'          °
  846.   '╕(0=V)/0'                                                                   °
  847.   'L4X:''This is the first concept that begins to introduce the idea tha       °
  848.  t no'''                                                                       °
  849.   '''matter what the APL expression, if it is valid, it must produce a''       °
  850.  '                                                                             °
  851.   '''valid APL2 object. (Shades of which came first, the chicken or the        °
  852.  egg)''' '╕L0' 'L5:╕(V>1)/L1X'                                                 °
  853.   '''RULE 5. The shape of a variable is a vector. The shape of a vector'       °
  854.  '' '''        is a vector of length 1. The shape of a scalar is a'''          °
  855.   '''        vector of length zero.'',2µr' '╕(0=V)/0'                          °
  856.   'L5X:''The left argument of RESHAPE is by definition a vector. If APL2       °
  857.   is'''                                                                        °
  858.   '''to be internally consistent, the inverse operation to RESHAPE (whic       °
  859.  h''' '''is indeed SHAPE) MUST return the same type of object.''' '╕L0'        °
  860.   'L6:╕(V>1)/L1X'                                                              °
  861.   '''RULE 6. Reduction of a scalar returns that scalar REGARDLESS of'''        °
  862.   '''        the function to the left of the reduction operator.'',2µr'        °
  863.   '╕(0=V)/0'                                                                   °
  864.   'L6X:''Reduction BY DEFINITION reduces the RANK by one. The exception        °
  865.  is'''                                                                         °
  866.   '''for objects whose rank is zero. Since there is no such thing as'''        °
  867.   '''negative rank, reduction is undefined for scalars, and therefore'''       °
  868.   '''the result is to leave the APL2 object unchanged.''' '╕L0'                °
  869.   'L7:╕(V>1)/L1X'                                                              °
  870.   '''RULE 7. The reduction of a null vector produces the identity'''           °
  871.   '''        element of the function.'',2µr' '╕(0=V)/0'                        °
  872.   'L7X:''A null vector may be empty, but it still has rank equal to one.       °
  873.  '''                                                                           °
  874.   '''Therefore its reduction MUST be a scalar. Since there is no data'''       °
  875.   '''in a null vector, the scalar must be such that it has no effect'''        °
  876.   '''on the operation performed by the function: Zero added to anything'       °
  877.  ''                                                                            °
  878.   '''has no effect in addition; one multiplied by anything has no effect       °
  879.  ''' '''in multiplication; and so on.''' '╕L0' 'L8:╕(V>1)/L1X'                 °
  880.   '''RULE 8. Parentheses can (and should) be used to modify the right'''       °
  881.   '''        to left rule to improve efficiency'',2µr' '╕(0=V)/0'              °
  882.   'L8X:''Parentheses are used in APL2 for other purposes as well, but fo       °
  883.  r'''                                                                          °
  884.   '''now, we will use them just to modify the right to left rule (RULE 3       °
  885.  ).'''                                                                         °
  886.   '''If you place parentheses where they are not needed, APL2 will ignor       °
  887. Xe''' '''them.''' 'L0:do' '╕(0=µW╜1╟W)/0' '╕L'                                 °
  888. XCs 1 2 "                                                                      °
  889. *(1997 7 13 12 28 57 536)                                                      °
  890.  Fshow ÉFX '╢V show ╢W;╢T;╢B' 'Σ Display and execute ╢W'                       °
  891.   '╢T╜(0=ÉNC ''╢V'')doif ''╢V╜0'''                                             °
  892.   '╕((0=╧╢W)doif ''show ╢W,'''' '''''')/0'                                     °
  893.   '╕((1<╧╢W)doif ''╢V show ■╢W'')/0' '''      '',╢W'                           °
  894. X '╕((╢V^'':''ε╢W)doif ''╢T╜evaldd ╢W'')/L0' '''ÉEM'' ÉEA ╢W' 'L0:do'          °
  895. *(1997 7 13 12 28 57 536)                                                      °
  896.  Fshowdd ÉFX 'u╜showdd w;a;b;c;r'                                              °
  897.   'Σ Display a direct definition function'                                     °
  898.   '╕((1=╧w)doif ''u╜showdd Γw'')/u╜0'                                          °
  899.   '╕((3⌠ÉNC╞w)doif ''(ε╞w),'''' is not a function'''''')/0'                    °
  900.   'c╜Γ[2]ÉCR╞w' 'c╜notb(2╞c),(Γ''aw α∙'')replace■2╟c'                          °
  901.   '╕((~''ΣDD''╧3╞2πc)doif ''''''Not a direct definition function'''''')/       °
  902.  0' 'u╜1' 'b╜('' ''⌠╞c)Γ╞c' 'a╜''      ''' 'r╜2╟3πc'                           °
  903.   '╕((3=µc)doif ''a,(╞w),'''':'''',r,(3<µ2πc)/''''   Σ'''',3╟2πc'')/0'         °
  904.   'a╜a,(╞w),'':'',(2╟5πc),'':''' 'b╜(+\r=''('')-+\r='')''' 'b╜b∞0'             °
  905. X 'a╜a,(²3╟(b-1)╞3╟r),'':'',2╟»(b+2)╟r' 'a,(3<µ2πc)/''  Σ'',3╟2πc'             °
  906. *(1997 7 13 12 28 57 536)                                                      °
  907.  Fshowfn ÉFX 'U╜V showfn W;F;N;T;ÉIO' 'Σ Simulate ╖W[É]'                       °
  908.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'ÉIO╜0'                                        °
  909.   'U╜r,''      '',''╖'',W,''[É]'',(╞V)╞''╖''' 'N╜1╞µF╜ÉCR W' 'N╜«∞N'           °
  910.   'N╜(N⌠'' '')ΓN' 'F╜(π''['',■N,■Γ''] ''),F'                                   °
  911.   'T╜(1<µ,V)doif ''F╜F[1╟V;]'' ''U╜''''''''''' 'U╜²1╟U,r,,F,r'                 °
  912. X 'U╜((-+/^\'' ''=ΦU)╟U),('' ╖'')[╞V],r'                                       °
  913. *(1997 7 13 12 28 58 540)                                                      °
  914.  Fsimdd ÉFX 'u╜simdd w;e' 'Σ Direct definition mode' 'u╜0'                     °
  915.   '╕((0⌠ÉNC╞w)doif ''''''Already defined'''''')/0' 'e╜''α''ε2πw'               °
  916.   'w[2]╜Γ''u╜'',''α∙ aw'' replace 2πw' 'w╜w[1 3 2]'                            °
  917. X 'w[1]╜Γε''u╜'',(e/''a ''),w[1],'' w''' 'u╜╧ÉFX w'                            °
  918. XNt 0 0                                                                        °
  919. *(1992 6 3 9 59 17 424)                                                        °
  920.  Ftab ÉFX 'U╜V tab W;T;A;B;C;D;E;F;G;M;ÉPW' 'Σ Tabulate list W'                °
  921.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'M╜''Invalid data for tabulation'''            °
  922.   'V╜4╞V' 'ÉPW╜130╛30⌐G╜V[2]+79⌡V[2]=0'                                        °
  923.   'L1:╕((1<╧W)doif ''''''W╜∞0'''' ÉEA ''''W╜πW'''''')/L1'                      °
  924.   '╕(((0=µεW)δ2<µµW)doif ''U╜(~V╧4╞0)/M'')/0'                                  °
  925.   'T╜(1≥µµU╜«W)doif ''U╜πW╜(U⌠'''' '''')ΓU'''                                  °
  926.   'T╜(0<V[1])doif ''U╜(«(Φ1,╞µW)µ(V[3]µ'''' ''''),∞(╞µW)-V[3]),'''' ''''       °
  927.  ,U''' '╕(G<30)/0' 'T╜(F╜µεV[4])+C╜1╟B╜µA╜(V[3],0)╟U'                          °
  928.   'T╜⌐(1╞B)÷1⌐╛(ÉPW+F)÷T' 'U╜(E╜(V[3],C)╞U),[1](B╜T,1╟B)╞A'                    °
  929.   '''D╜εV[4]'' ÉEA ''D╜ÉAV[εV[4]+33⌡V[4]=0]''' 'L0:A╜(T,0)╟A'                  °
  930. X '╕(0=1╞µA)/0' 'U╜U,(((T+V[3]),µD)µD),E,[1]B╞A' '╕L0'                         °
  931. *(1997 7 13 12 28 59 544)                                                      °
  932.  Ftest ÉFX 'U╜V test W;P'                                                      °
  933.   'Σ Describe problem in W, (correct answer in V)' 'U╜2' 'L1:W'                °
  934.   'É╜''      ''' 'P╜æ' '''╕L0'' ÉEA ''P╜»P''' '╕(V╧P)/0'                       °
  935. X 'L0:╕(0=U╜U-1)/0' '''Incorrect. Try again''' '╕L1'                           °
  936. XCu 1 2 IV                                                                     °
  937. XCuc 1 26 ABCDEFGHIJKLMNOPQRSTUVWXYZ                                           °
  938. XNw 0 5                                                                        °
  939. XCx 0 !                                                                        °
  940.