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

  1. XNÉIO 0 1                                                                      °
  2. XNÉCT 0 1E²13                                                                  °
  3. XCÉFC 1 6 .,*0_²                                                               °
  4. XNÉRL 0 1817129560                                                             °
  5. XCÉPR 1 1                                                                      °
  6. XCÉLX 1 5 TEACH                                                                °
  7. XNA 2 4 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16                               °
  8.  NARRAY 3 3 4 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22       °
  9.   23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45         °
  10. X 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60                                 °
  11. *(1997 9 14 12 30 44 504)                                                      °
  12. XFDISCLAIMER ÉFX 'DISCLAIMER' 'Σ Copyright statement' 'disclaimer'             °
  13. *(1996 4 6 16 2 32 304)                                                        °
  14.  FDISPLAY ÉFX 'D╜S DISPLAY A;ÉIO;R;C;HL;HC;HT;HB;VL;VB;V;W;N;B'                °
  15.   'Σ DISPLAY A GENERAL ARRAY IN PICTORIAL FORM'                                °
  16.   'Σ  NORMAL CALL IS MONADIC.  DYADIC CALL USED ONLY IN'                       °
  17.   'Σ    RECURSION TO SPECIFY DISPLAY RANK, SHAPE, AND DEPTH.' 'ÉIO╜0'          °
  18.   '»(0=ÉNC ''S'')/''S╜µA''' 'R╜╞µ,S                   Σ PSEUDO RANK.'          °
  19.   'C╜''┐┌└┘''                 Σ UR, UL, LL, AND LR CORNERS.'                   °
  20.   'HL╜''─''                   Σ HORIZONTAL LINE.'                              °
  21.   'HC╜HL,''Θ╕'',HL,''~+ε''      Σ HORIZONTAL BORDERS.'                         °
  22.   'HT╜HC[(0<R)⌡1+0<╞²1╞,S]' 'ΣW╜,0╧■╞0µΓ(1⌐µA)╞A'                              °
  23.   'HB╜HC[3+3╛(''2⌡~A╧«A'' ÉEA ''1+╞ε0⌡(1⌐⌡/µA)╞,A'')+3⌡1<µµS]'                 °
  24.   'VL╜''│''                   Σ VERTICAL LINE.'                                °
  25.   'VB╜VL,''Φ╟''               Σ VERTICAL BORDER.'                              °
  26.   'V╜VB[(1<R)⌡1+0<²1╞²1╟,S]'                                                   °
  27.   '»(0εµA)/''A╜(1⌐µA)µΓ╞A''   Σ SHOW PROTOTYPE OF EMPTIES.'                    °
  28.   '╕(1<╧A)/GEN' '╕(2<µµA)/D3'                                                  °
  29.   'D╜«A                     Σ SIMPLE ARRAYS.' 'W╜1╞µD╜(²2╞1 1,µD)µD'           °
  30.   'N╜²1+1╟µD' '╕(0=µµA)/SS'                                                    °
  31.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  32.  3]' '╕0' 'SS:HB╜((0 '' '')=╞0µΓA)/'' -'''                                     °
  33.   'D╜'' '',('' '',[0]D,[0]HB,Nµ'' ''),'' ''' '╕0'                              °
  34.   'GEN:D╜«DISPLAY■A          Σ ENCLOSED ...' 'N╜Dδ.⌠'' '''                     °
  35.   'D╜(Nδ~1ΦN)≡D' 'D╜(δ≡~''  ''╤D)/D' 'D╜((1,µS)µS)DISPLAY D'                   °
  36.   '╕(2≥µ,S)╟D3E,0' 'D3:D╜0 ²1╟0 1╟«ΓA         Σ MULT-DIMENSIONAL ...'          °
  37.   'W╜1╞µD' 'N╜²1+1╟µD'                                                         °
  38.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  39.  3]' 'D3E:N╜²2+µ,S'                                                            °
  40. X 'V╜C[Nµ1],[0]VB[1+0<²2╟,S],[0](((²3+╞µD),N)µVL),[0]C[Nµ2]' 'D╜V,D'           °
  41. *(1996 4 6 16 2 32 304)                                                        °
  42.  FEXIT ÉFX 'EXIT' 'Σ Exit from function' '''To log off type:   )OFF'''         °
  43. X '╕'                                                                          °
  44. *(1996 4 6 16 2 32 304)                                                        °
  45.  FGO ÉFX 'GO;T;E;B' 'Σ Expression driver' 'L0:B╜E╜''''' 'æ╜''      '''         °
  46.   'T╜æ' '╕(^/'' ''=T)/L0' '╕((^/'')OFF ''=5╞6╟T)doif ''EXIT'')/0'              °
  47.   '╕(('':''εT)doif ''B╜evaldd (+/^\'''' ''''=T)╟T'')/L0'                       °
  48.   '''E╜ÉEM'' ÉEA T' '╕(0=µ,E)/L0' '╕B/L0'                                      °
  49.   '''This is not a valid APL2 expression''' 'æ╜''*'''                          °
  50. X '╕(''?''⌠╞1╟æ)/L0' 'E' '╕L0'                                                 °
  51. *(1997 8 14 12 49 25 500)                                                      °
  52.  FHELP ÉFX 'HELP;N;I;T' 'Σ Help to student' '''WHAT TO DO'',r'                 °
  53.   '''  ° To get out of the lesson''' '''       ENTER: EXIT'''                  °
  54.   '''  ° To log off APL2'''                                                    °
  55.   '''       FIRST, ENTER: EXIT  THEN ENTER: )OFF'''                            °
  56.   '''  ° To get help''' '''       ENTER: HELP'''                               °
  57.   '''  ° When you see the prompt on a blank line'''                            °
  58.   '''       ENTER AN APL2 EXPRESSION - OR JUST PRESS: ENTER''' 'do'            °
  59.   '''  ° If you get this line'',r'                                             °
  60.   '''This is not a valid APL2 expression'',r,''*'',r'                          °
  61.   '''        YOU CAN EITHER''' '''           A. PRESS: ENTER'''                °
  62.   '''           B. PRESS: ? and then ENTER to see what was incorrect'''        °
  63.   '''              in your expression causing that response'',r' 'do'          °
  64.   '''HINTS'',r'                                                                °
  65.   '''This lesson is made up of '',(«N╜6),'' components named TEACHx, whe       °
  66.  re''' '''the x stands for a digit:'',r' 'I╜0'                                 °
  67.   'L0:T╜''TEACH'',(«I╜I+1)' 'T,'' '',1╟notb(ÉCR T)[2;]' '╕(N>I)/L0'            °
  68.   'do'                                                                         °
  69.   '''You may review either of these components separately. To do that,''       °
  70.  '                                                                             °
  71.   '''first enter EXIT (and RETURN), then enter the name of the lesson.''       °
  72.  ' '''component (e.g. TEACH4).'',r'                                            °
  73.   '''To re-start the lesson, just enter TEACH'',r'                             °
  74.   '''When the screen fills up, it is a good idea to move the cursor to''       °
  75.  ' '''the start of a convenient paragraph, and press ENTER'',r'                °
  76.   '''You may also wish to press PAGE UP to review the prevous pages.'''        °
  77.   'do' '''RESOURCES'',r'                                                       °
  78.   '''You may also enter ONE of the following words at a time'',r'              °
  79.   '''RANK   Describes the concept of RANK using geometry'''                    °
  80.   '''TABLES A quick review of tables in the past'''                            °
  81. X '''REVIEW Review APL2 concepts studied in previous lesson''' 'endd'          °
  82.  NM 4 2 3 4 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22         °
  83.   23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45         °
  84.   46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68         °
  85.   69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91         °
  86.   92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110          °
  87. X 111 112 113 114 115 116 117 118 119 120                                      °
  88. XNNUMBERS 2 3 4 1 2 3 4 5 6 7 8 9 10 11 12                                     °
  89. *(1996 4 6 16 2 32 304)                                                        °
  90.  FRANK ÉFX 'RANK' 'Σ Rank, shape and dimension'                                °
  91.   '''We have introduced two concepts that at first glance appear to be''       °
  92.  '                                                                             °
  93.   '''related: RANK, and DIMENSION. The concept of RANK can be particular       °
  94.  ly'''                                                                         °
  95.   '''confusing, since the same word is used in mathematics with a simila       °
  96.  r''' '''but DISTINCT meaning.'',r'                                            °
  97.   '''These concepts can be best understood if we relate them to a subjec       °
  98.  t''' '''we all have studied in High School, namely Geometry.''' 'do'          °
  99.   '''We can begin with a single plane. A point in a plane has no width o       °
  100.  r'''                                                                          °
  101.   '''height. We say that a point has no dimensions. Two distinct points'       °
  102.  ''                                                                            °
  103.   '''in a plane can be connected by a straight line. If we assign to one       °
  104.  '''                                                                           °
  105.   '''of these points the value of zero, and to the other point the value       °
  106.   of'''                                                                        °
  107.   '''one, then we can specify any intermediate point of the line by a'''       °
  108.   '''number between zero and one. The line represents a single DIMENSION       °
  109.  ,'''                                                                          °
  110.   '''and the distance from point zero to any point on that line is a one       °
  111.  ''' '''dimensional VECTOR.''' 'do'                                            °
  112.   '''To describe a point in the plane but not on the line requires some'       °
  113.  ''                                                                            °
  114.   '''additional concepts. Suppose that we draw a second line from point        °
  115.  zero'''                                                                       °
  116.   '''in such a way that the two lines form an angle. We will call the'''       °
  117.   '''first line the X-axis, and the second line the Y-axis. We say that        °
  118.  these''' '''two axes SPAN the plane. What do we mean by that?''' 'do'         °
  119.   '''We mean that we can reach any point in the plane by drawing two'''        °
  120.   '''VECTORS. The first vector is along the X-axis, and the second vecto       °
  121.  r'''                                                                          °
  122.   '''is along a line parallel to the Y-axis. Since it takes a single'''        °
  123.   '''number to specify a point along one line, we will need two numbers'       °
  124.  ''                                                                            °
  125.   '''(one for X and one for Y) to specify an arbitrary point in a plane.       °
  126.  '',r'                                                                         °
  127.   '''Now consider a plane to be just a surface in three dimensions. We c       °
  128.  an'''                                                                         °
  129.   '''draw a third line from point zero in such a way that the points on'       °
  130.  ''                                                                            °
  131.   '''this line do not lie on the plane. We will call this line the Z-axi       °
  132.  s.''' 'do'                                                                    °
  133.   '''The three axes now SPAN three dimensional space. To find an arbitra       °
  134.  ry'''                                                                         °
  135.   '''point in space, we must specify three vectors. one along the X-axis       °
  136.  ,'''                                                                          °
  137.   '''one along a line parallel to the Y-axis, and finally, one parallel        °
  138.  to''' '''the Z-axis.'',r'                                                     °
  139.   '''Now let us relate these points in space to scalars, vectors and arr       °
  140.  ays''' 'do'                                                                   °
  141.   '''A scalar can be thought of as a point in space without reference to       °
  142.  '''                                                                           °
  143.   '''an axis. A vector is the distance from zero to a point. If this vec       °
  144.  tor'''                                                                        °
  145.   '''is made up of only one scalar component, we say it has one DIMENSIO       °
  146.  N.'''                                                                         °
  147.   '''If a vector has two scalar components, it specifies locations in a'       °
  148.  ''                                                                            °
  149.   '''TWO DIMENSIONAL plane. A three component vector specifies a point i       °
  150.  n''' '''three dimensional plane.''' 'do'                                      °
  151.   '''Now suppose that we have the vector (a,b). It represents a point th       °
  152.  at'''                                                                         °
  153.   '''can be reached by going first along the X-axis, and then going alon       °
  154.  g'''                                                                          °
  155.   '''a direction parallel to the Y-axis. In APL2 short-hand this can be'       °
  156.  '' '''written as'',r,r,''    (a⌡1 0) + b⌡0 1'',r'                             °
  157.   '''The first part says that we go a units in the first direction, and        °
  158.  b'''                                                                          °
  159.   '''units in the second direction. The vectors 1 0 and 0 1 have a speci       °
  160.  al'''                                                                         °
  161.   '''name in math. They are called the BASIS of the coordinate system.''       °
  162.  ' 'do'                                                                        °
  163.   '''Now suppose that we have a point in three dimensions. Following the       °
  164.  '''                                                                           °
  165.   '''same argument, we find that it takes three scalars (a,b,c) to defin       °
  166.  e''' '''a point in three dimensions. What about a line?'',r'                  °
  167.   '''In a plane, a line is defined by two points (a,b) and (d,e). In thr       °
  168.  ee'''                                                                         °
  169.   '''dimensions, a line is also specified by two points (a,b,c) and (d,e       °
  170.  ,f)''' 'do'                                                                   °
  171.   '''If the two points are distinct, the two vectors in either case not'       °
  172.  ''                                                                            °
  173.   '''only specify a line, but also SPAN a plane, namely the plane contai       °
  174.  ning'''                                                                       °
  175.   '''the two points AND the point zero. One way to represent such a plan       °
  176.  e''' '''is to write the two vectors as an ARRAY.'',r'                         °
  177.   '''         a b        a b c''' '''         d e   or   d e f'',r'            °
  178.   '''The APL2 RANK of these two arrays is 2. This is not the same as'''        °
  179.   '''MATHEMATICAL RANK. In LINEAR ALGEBRA (a field of mathematics), the'       °
  180.  ''                                                                            °
  181.   '''two arrays are called MATRICES. They also represent points in space       °
  182.  ,'''                                                                          °
  183.   '''but the concept of RANK deals not with the fact that a matrix is'''       °
  184.   '''rectangular. Instead, mathematical rank denotes the dimensionality'       °
  185.  ''                                                                            °
  186.   '''of the space spanned by the row (or column) vectors. If for example       °
  187.  '''                                                                           °
  188.   '''we have (m n)=k⌡a b, then the rank of the first matrix is 1, since'       °
  189.  '' '''the two vectors are co-linear.''' 'do'                                  °
  190.   '''Now, suppose that we wish to specify two distinct lines. If the sec       °
  191.  ond'''                                                                        °
  192.   '''pair of lines is given by (m,n) (p,q) in two dimensions, and by (m,       °
  193.  n,o)'''                                                                       °
  194.   '''(p,q,r) in three dimensions, we can combine all as arrays of APL2 r       °
  195.  ank 3'''                                                                      °
  196.   'r,''      a b      a b c'',r,''      d e      d e f'',r,''                  °
  197.  or''' '''      m n      m n o'',r,''      p q      p q r'',r'                 °
  198.   '''Here, the APL2 rank refers to the number of APL2 axes, and not to t       °
  199. Xhe''' '''geometric meaning of the underlying data.''' 'endd'                  °
  200. *(1996 4 6 16 2 32 304)                                                        °
  201.  FREVIEW ÉFX 'REVIEW;V' 'Σ Review lesson 5'                                    °
  202.   '''In lesson 5 we studied APL2 notation for absolute value, residue,''       °
  203.  ' '''encode and decode. We also introduced the scan operator.'',r'            °
  204.   '''The absolute value is expressed in APL2 with the symbol |'',r'            °
  205.   'show ''|²2 2'''                                                             °
  206.   '''Write now an expression that will produce numeric vector V with'''        °
  207.   '''positive and negative values. Then apply the monadic absolute value       °
  208.  ''' '''primitive:''' 'do'                                                     °
  209.   '''The residue of A when divided by B is given by B|A. It is also'''         °
  210.   '''called A MODULO B'',r' 'show ''5|2 4 6 8'''                               °
  211.   '''Now write an expression that will produce the residue of vector V''       °
  212.  ' '''modulo 2:''' 'do'                                                        °
  213.   '''Decode converts a decimal number into components in any other base'       °
  214.  ''                                                                            °
  215.   '''system. For example to convert 586 into hexadecimal, we would write       °
  216.  '',r' 'show ''16*1 2 3 4'' ''16 16 16ÿ586'''                                  °
  217.   '''Why did we evaluate expression 16*1 2 3 4 first?'',r'                     °
  218.   '''Since hexadecimal notation uses the symbols A B C D E F to represen       °
  219.  t''' '''respectively 10 11 12 13 14 15, we would have to write'',r'           °
  220.   'show ''''''0123456789ABCDEF''''[1+16 16 16ÿ586]'''                          °
  221.   '''For the decode, suppose you have an integer in the range (0,1000),'       °
  222.  '' '''say 586. Convert this integer to its octal representation:'''           °
  223.   'do'                                                                         °
  224.   '''The expression  L¥R where L is a scalar or a vector of length µR wi       °
  225.  ll'''                                                                         °
  226.   '''convert vector R back to its numeric representation in base L'',r'        °
  227.   'show ''5¥0 2 4 4'' ''10¥0 23 0'''                                           °
  228.   '''Now take 4 3 2 1, the representation of 586 to base 5, and use'''         °
  229.   '''decode to represent the integer in decimal notation.''' 'do'              °
  230.   '''The scan operator when applied to a vector, generates a vector of''       °
  231.  ' '''the same length. The Nth component of this vector contains the'''        °
  232.   '''result of applying the reduce operator to the first N elements of''       °
  233.  ' '''the vector'',r' 'show ''÷/6'' ''÷/6 3'' ''÷/6 3 2'' ''÷\6 3 2'''         °
  234.   '''For the scan operator, generate a vector whose Nth component is the       °
  235. X''' '''sum of the first N elements of V.''' 'do' 'endd'                       °
  236. *(1997 5 31 11 59 20 572)                                                      °
  237.  FRULE ÉFX 'V RULE W' 'Σ Display rules' '╕(2=ÉNC ''V'')/L0'                    °
  238. X '2 rule W ╪ ╕0' 'L0:V rule W'                                                °
  239. *(1997 5 24 12 27 15 400)                                                      °
  240.  FTABLES ÉFX 'TABLES' 'Σ History of tables'                                    °
  241.   '''One might ask, who invented tables? The answer is quite surprising.       °
  242.  '''                                                                           °
  243.   '''We find tables in the oldest mathematical documents in existence.''       °
  244.  ,r'                                                                           °
  245.   '''One of the earliest mathematical "textbooks" of Ancient Egypt'''          °
  246.   '''is the Ahmes Papyrus, dating to about 1650 BC. This document contai       °
  247.  ns'''                                                                         °
  248.   '''a table that converts fractions of the form A/B to unit fractions o       °
  249.  f''' '''the form 1/C'',r' '''For example  2/5 = 1/3 + 1/15'''                 °
  250.   '''             2/7 = 1/4 + 1/28'''                                          °
  251.   '''            2/13 = 1/8 + 1/52 + 1/104'',r'                                °
  252.   '''The Babylonian cuneiform tablets also contain examples of tables.''       °
  253.  ' '''These include multiplication tables with reciprocals in their'''         °
  254.   '''hexadecimal (base 60) system.''' 'do'                                     °
  255.   '''The Chinese were particularly fond of Magic Squares, namely square'       °
  256.  ''                                                                            °
  257.   '''integer arrays, such that the sum of rows or columns produced the''       °
  258.  ' '''same number'',r' '''  4 9 2''' '''  3 5 7''' '''  8 1 6'',r'             °
  259.   '''The sum of any row, column or diagonals is 15.'',r' 'do'                  °
  260.   '''Ptolemy, who lived in the second century A.D. in Alexandria, Egypt'       °
  261.  ''                                                                            °
  262.   '''was the earliest mathematician who published extensive tables.'''         °
  263.   '''In his book called the Almagest, there are tables for chords on a''       °
  264.  '                                                                             °
  265.   '''circle as a function of angle. This is the ancient equivalent of'''       °
  266.   '''trigonometric tables. In his book called Optics, he has a table of'       °
  267.  ''                                                                            °
  268.   '''angles of refraction from air to glass and from air to water.'',r'        °
  269.   '''The use of tables became an indispensable part of computations'''         °
  270.   '''with the publication by Briggs of the table of Napier''''s logarith       °
  271. Xms''' '''in 1614.''' 'endd'                                                   °
  272. *(1997 7 4 11 40 43 488)                                                       °
  273.  FTEACH ÉFX 'TEACH' 'Σ Start sixth lesson in APL2 by Zdenek V JIZBA'           °
  274.   'exit ''TEACH''' 'initialize' 'TEACH1 Σ Arrays and rank'                     °
  275.   'TEACH2 Σ Scalar functions' 'TEACH3 Σ IBM function DISPLAY'                  °
  276.   'TEACH4 Σ Non-scalar primitive functions'                                    °
  277.   'TEACH5 Σ Reduction operator and arrays'                                     °
  278. X 'TEACH6 Σ The scan operator and arrays' 'problems'                           °
  279. *(1997 8 28 12 11 30 424)                                                      °
  280.  FTEACH1 ÉFX 'TEACH1;A;MANY' 'Σ Study of ARRAYS' 'exit ''TEACH1'''             °
  281.   '''To review previous lesson, enter REVIEW.''' 'do'                          °
  282.   '''         APL ARRAYS'',r'                                                  °
  283.   '''So far we have studied APL2 objects called "scalars" and "vectors".       °
  284.  '''                                                                           °
  285.   '''Scalars are objects of rank 0, and vectors are objects of rank 1.''       °
  286.  '                                                                             °
  287.   '''In this lesson we will study objects of rank 2, 3 and higher. We'''       °
  288.   '''will see how all of the primitive functions studied so far work'''        °
  289.   '''on these higher rank objects. We will also see how to use the REDUC       °
  290.  E''' '''and SCAN operators on rank 2 or higher "arrays".'',r'                 °
  291.   '''We have used the concepts "scalar" and "vector", because these shou       °
  292.  ld'''                                                                         °
  293.   '''be familiar to you if you have some background in math. In APL, the       °
  294.  se'''                                                                         °
  295.   '''concepts are tolerated for that reason. However the proper name for       °
  296.  '''                                                                           °
  297.   '''a scalar is "RANK 0 ARRAY", and for a vector "RANK 1 ARRAY". The re       °
  298.  ason'''                                                                       °
  299.   '''for this is that in APL, ALL data are considered to be ARRAYS. With       °
  300.   this'''                                                                      °
  301.   '''understanding, we will continue to apply the term SCALAR to the two       °
  302.   types'''                                                                     °
  303.   '''of primitive data items: CHARACTERS and NUMBERS. We will also use t       °
  304.  he''' '''term VECTOR as a synonym of any rank 1 APL2 object.''' 'do'          °
  305.   '''To refresh your memory, SHAPE (µ) returns the way information is'''       °
  306.   '''stored in the array. This shape is ALWAYS a vector (i.e a rank 1 ar       °
  307.  ray).'''                                                                      °
  308.   '''The "shape of the shape" of an array is therefore a vector of lengt       °
  309.  h 1,'''                                                                       °
  310.   '''and is called RANK. A number (or a single character) belong to the'       °
  311.  ''                                                                            °
  312.   '''class of objects we call "rank 0 arrays". Here is an example'',r'         °
  313.   'show ''µ5'' ''µµ5'''                                                        °
  314.   '''The blank line below µ5 means that 5 has no length. It is a point i       °
  315.  n'''                                                                          °
  316.   '''space with no dimensions. However, µµ5 which is the same as µ(µ5) i       °
  317.  s'''                                                                          °
  318.   '''a vector. The zero tell us that (µ5) is an "empty vector"; one migh       °
  319.  t'''                                                                          °
  320.   '''say a "vector of length zero". Let us look at other examples'',r'         °
  321.   'show ''µ3.14159'' ''µ''''A'''''' ''µ''''5'''''' ''µ''''$'''''''             °
  322.   '''A single number no matter how large or small, is a "rank 0 array".'       °
  323.  ''                                                                            °
  324.   '''A single character, such as a letter, a digit in quotes or a specia       °
  325.  l'''                                                                          °
  326.   '''symbol is also a "rank 0 array" (scalar). We have seen that the com       °
  327.  ma'''                                                                         °
  328.   '''when applied monadically (called RAVEL), generates a "rank 1 array"       °
  329.   (a'''                                                                        °
  330.   '''vector). If we apply ravel to a scalar (rank 0 array), the resultin       °
  331.  g'''                                                                          °
  332.   '''vector will have only one element, so its SHAPE will be 1 and its R       °
  333.  ANK''' '''will also be 1'',r' 'show ''µ,3.14159'' ''µ(µ,3.14159)'''           °
  334.   '''The interpretation of scalars as opposed to length 1 vectors will v       °
  335.  ary.'''                                                                       °
  336.   '''You could, for example, think of ,3.14159 as a vector on the real n       °
  337.  umber'''                                                                      °
  338.   '''axis with its point 3.14159 units away from the origin.'',r'              °
  339.   ''' |.....|.....|.....|>''' ''' 0     1     2     3'',r'                     °
  340.   '''Now let us look at other rank 1 arrays (vectors)'',r'                     °
  341.   'show ''µ2 2'' ''µµ2 2'''                                                    °
  342.   '''We could think of 2 2 as a point in the plane two units to the righ       °
  343.  t''' '''of zero and two units above zero'',vec'                               °
  344.   '''On the other hand, it could be thought of merely as a LIST with two       °
  345.  '''                                                                           °
  346.   '''components, or a pair of points along one line. The interpretation'       °
  347.  ''                                                                            °
  348.   '''of what a rank 2 array means will depend on what the problem is.'',       °
  349.  r' '''Here are some more examples of shapes and ranks'',r'                    °
  350.   'show ''µ2 3 4'' ''µµ2 3 4'' ''µ''''ONE'''''' ''µµ''''ONE'''''''             °
  351.   '''Later we will see that rank can be thought as a the NUMBER OF AXES'       °
  352.  ''                                                                            °
  353.   '''it takes to display the object. From this point of view, ARRAYS are       °
  354.  '''                                                                           °
  355.   '''APL objects that have 0(scalars) 1(vectors) 2 or more axes. If all        °
  356.  of'''                                                                         °
  357.   '''this leaves you confused, you might try to look at a more geometric       °
  358.  al''' '''explanation by entering RANK.''' 'do'                                °
  359.   '''   GENERATING HIGHER RANK OBJECTS'',r'                                    °
  360.   '''You will recall that one way of generating APL2 objects is by using       °
  361.  ''' '''the dyadic form of (µ) called RESHAPE'',r' 'show ''3 4µ∞6'''           °
  362.   '''This example shows an array with 3 rows and 4 columns. Here is an''       °
  363.  ' '''array made up of characters only'',r'                                    °
  364.   'show ''2 4µ''''ONE TWO '''''''                                              °
  365.   '''This example shows an array with 2 rows and 4 columns, but we do'''       °
  366.   '''not see the fourth column, because it contains blanks. The next'''        °
  367.   '''array is called A, and it contains both numbers and text'',r'             °
  368.   'show ''A╜2 3 4µ(?12µ9),''''HANDHEADFOOT'''''' ''A'''                        °
  369.   '''This example is an array with 2 planes, 3 rows and 4 columns.'''          °
  370.   '''It has three axes, namely [depth, height, width].'',r'                    °
  371.   'show ''µA'' ''µµA'''                                                        °
  372.   '''By extension, it is possible to generate arrays with 4, 5, ... and'       °
  373.  ''                                                                            °
  374.   '''more axes. However, in practice, arrays with rank greater than 3'''       °
  375.   '''are seldom used. This is not because such arrays are not useful. It       °
  376.  '''                                                                           °
  377.   '''is that most of us just have not learned how to use them effectivel       °
  378.  y.''' 'do'                                                                    °
  379.   '''You can try generating objects with many axes like this'',r'              °
  380.   'show ''MANY╜2 3 4 5 6µ1'' ''µMANY'' ''µµMANY'''                             °
  381.   '''MANY has rank of 5, and if you display it it does not even fit'''         °
  382. X '''onto the screen.''' 'endd'                                                °
  383. *(1997 5 22 13 9 23 356)                                                       °
  384.  FTEACH2 ÉFX 'TEACH2;NUMBERS;TABLE' 'Σ Arrays and primitive functions'         °
  385.   'exit ''TEACH2'''                                                            °
  386.   '''Let us now study "two dimensional" arrays (rank =2)'',r'                  °
  387.   'show ''NUMBERS╜3 4µ∞12'' ''TABLE╜4 5µ''''  ONE  TWOTHREE FOUR'''''' '       °
  388.  'TABLE'''                                                                     °
  389.   '''Array NUMBERS contains only numbers, while array TABLE contains'''        °
  390.   '''only text. Let us first see what we can do with arrays of numbers''       °
  391.  ,r' 'show ''NUMBERS'' ''5+NUMBERS'' ''NUMBERS⌡2'''                            °
  392.   '''As with vectors, we can do arithmetic with numbers. Indeed, we can'       °
  393.  ''                                                                            °
  394.   '''use all the primitive numeric functions that we have studied so far       °
  395.  '',r' 'show ''NUMBERS*2'' ''3<NUMBERS'' ''4|NUMBERS'''                        °
  396.   '''Every primitive function that allows a scalar to be applied to ever       °
  397.  y'''                                                                          °
  398.   '''element of an array, is called a SCALAR FUNCTION. This includes all       °
  399.  '''                                                                           °
  400.   '''mathematical functions ( + - ⌡ ÷ * ⌐ ╛ ...), all relational functio       °
  401.  ns'''                                                                         °
  402.   ''' = ⌠ < ≥ ...) and all logical functions when applied to boolean arr       °
  403.  ays''' '''( δ ^ ~ ...).''' 'do'                                               °
  404.   '''Can we apply arrays to arrays of different ranks? (Yes, but we are        °
  405.  not'''                                                                        °
  406.   '''ready for that yet.) How about applying arrays to arrays of the sam       °
  407.  e rank?''' 'do'                                                               °
  408.   '''Yes. One way is if both arrays have the SAME SHAPE'',r'                   °
  409.   'show ''NUMBERS+NUMBERS'' ''NUMBERS÷NUMBERS'' ''NUMBERS⌡6<NUMBERS'''         °
  410.   '''What about arrays containing text?'',r'                                   °
  411.   'show ''TABLE'' ''TABLE⌠''''O'''''''                                         °
  412.   '''In other words, all the primitive functions that we have studied'''       °
  413.   '''so far can be also used with arrays without modification!'',r'            °
  414.   '''Of what use are arrays? In mathematics, rectangular arrays can be''       °
  415.  '                                                                             °
  416.   '''thought of as collections of vectors forming a table. These numeric       °
  417.  '''                                                                           °
  418.   '''arrays are at the foundation of many mathematical concepts. In'''         °
  419.   '''practical applications, numeric tables have been used for centuries       °
  420.  '''                                                                           °
  421.   '''to look up values of many functions (look up tables). For a brief''       °
  422.  ' '''summary of the history of tables, enter TABLES.'',r' 'do'                °
  423.   '''We have seen that APL2 arrays can be processed with primitive scala       °
  424.  r'''                                                                          °
  425.   '''functions. We can summarize our findings with the following rules''       °
  426. X,r' '1 RULE 12' 'do' '1 RULE 13' 'do' '1 RULE 14' 'endd'                      °
  427. *(1997 5 24 12 0 9 268)                                                        °
  428.  FTEACH3 ÉFX 'TEACH3;V;A' 'Σ Empty arrays' 'exit ''TEACH3'''                   °
  429.   '''     EMPTY ARRAYS AND THE FUNCTION "DISPLAY"'',r'                         °
  430.   '''We have seen that one way to generate arrays is to use dyadic resha       °
  431.  pe.'''                                                                        °
  432.   '''The left argument to reshape must be an integer vector, but zero is       °
  433.  ''' '''also allowed as a valid component of that vector.'',r'                 °
  434.   '''We will now study what it means to have zero in the left argument t       °
  435.  o''' '''reshape.''' 'do'                                                      °
  436.   '''As we have seen earlier, one example of a null vector is an APL2 ob       °
  437.  ject'''                                                                       °
  438.   '''that has the rank of a vector (1), but a shape of zero. A null vect       °
  439.  or can''' '''be generated in several ways'',r'                                °
  440.   'show ''µ5'' ''0µ5'' ''∞0'' '''''''''''' ''(2 3 4)[∞0]'''                    °
  441.   '''Since we cannot see a NULL vector, we cannot see its internal struc       °
  442.  ture.'''                                                                      °
  443.   '''Because it is important to be able to tell what ANY APL2 array cont       °
  444.  ains,'''                                                                      °
  445.   '''IBM provides a special utility function called DISPLAY'',r'               °
  446.   'show ''DISPLAY 0µ5'' ''DISPLAY '''''''''''                                  °
  447.   '''As you can see, not all nulls are the same. The first example shows       °
  448.  '''                                                                           °
  449.   '''a null numeric vector, while the second example shows a null charac       °
  450.  ter''' '''vector. Now let us generate some null arrays'',r'                   °
  451.   'show ''DISPLAY 0 0µ1'' ''DISPLAY 0 0µ''''X'''''''                           °
  452.   '''The symbols on top and side identify both axes to be null. (The sym       °
  453.  bol'''                                                                        °
  454.   '''at bottom distinguishes numeric from character vectors). A null arr       °
  455.  ay''' '''can have a non-null axis'',r'                                        °
  456.   'show ''DISPLAY 0 5µ5'' ''DISPLAY 5 0µ''''X'''''''                           °
  457.   '''The non null axis does exist, and indeed retains its shape.'',r'          °
  458.   '''What about arrays of rank greater than 2? Function DISPLAY has a'''       °
  459.   '''compact way to represent such arrays'',r'                                 °
  460.   'show ''DISPLAY 0 2 3µ1'' ''DISPLAY 2 0 3µ1'' ''DISPLAY 2 3 0µ1'''           °
  461.   '''One obvious question is why all this concern with empty arrays.'''        °
  462.   '''The technical answer is COMPLETENESS. Valid APL2 expressions should       °
  463.  '''                                                                           °
  464.   '''always return valid APL2 objects. To insure that this condition is'       °
  465.  ''                                                                            °
  466.   '''satisfied, we need to have empty arrays. A more practical answer is       °
  467.  '''                                                                           °
  468.   '''that empty arrays are useful. Here is a simple example. Suppose tha       °
  469.  t'''                                                                          °
  470.   '''your application consists of generating a vector by catenating data       °
  471.  '''                                                                           °
  472.   '''to an existing vector. To start the process, it is simple to begin'       °
  473.  '' '''with an empty vector'',r'                                               °
  474.   'show ''V╜0µ0'' ''DISPLAY V'' ''V╜V,∞2'' ''DISPLAY V'' ''V╜V,∞4'' ''DI       °
  475.  SPLAY V'''                                                                    °
  476.   '''Similarly, in other applications one may wish to begin with an arra       °
  477. Xy'',r' 'show ''A╜3 0µ1'' ''DISPLAY A'' ''DISPLAY A,3''' 'endd'                °
  478. *(1997 8 28 12 18 55 552)                                                      °
  479.  FTEACH4 ÉFX 'TEACH4' 'Σ Reduction and Scan operators on arrays'               °
  480.   'exit ''TEACH4'''                                                            °
  481.   '''What about non scalar primitive APL2 functions. We have already see       °
  482.  n'''                                                                          °
  483.   '''that the monadic ∞ works only with scalar integers, so clearly it i       °
  484.  s'''                                                                          °
  485.   '''not going to work with arrays. The dyadic ∞ requires the left argum       °
  486.  ent''' '''to be a VECTOR. The right argument can be any array'',r'            °
  487.   'show ''2 3 4∞5'' ''2 3 4∞3 4 5'' ''2 3 4∞3 4µ∞12'''                         °
  488.   '''We have already seen that the monadic shape by definition will work       °
  489.  '''                                                                           °
  490.   '''on any array, but reshape again requires the left argument to be a'       °
  491.  '' '''vector'',r' 'show ''2 3µ5'' ''2 3µ∞6'' ''2 3µ4 3µ∞12'''                 °
  492.   '''There is an exception: A scalar left argument is allowed, but it'''       °
  493.   '''is treated as a one element vector:'',r'                                  °
  494.   'show ''DISPLAY 5µ1 2 3'' ''DISPLAY (,5)µ1 2 3'''                            °
  495.   '''Can you explain the following expression?'',r'                            °
  496.   'show ''(∞0)µ2 2µ∞4'''                                                       °
  497.   '''Clearly the right argument of reshape can be an array, but the'''         °
  498.   '''elements are selected by rows. To understand why this is so, let us       °
  499.  '''                                                                           °
  500.   '''take a look at ravel. You will recall that ravel changes a scalar''       °
  501.  ' '''to a vector of length 1, and leaves a vector unchanged. For an'''        °
  502.   '''array, ravel will convert it into a vector exactly opposite to the'       °
  503.  '' '''way reshape converts a vector into an array'',r'                        °
  504.   'show ''∞6'' ''2 3µ∞6'' '',2 3µ∞6'''                                         °
  505.   '''The only other primitive non scalar function that we have studied''       °
  506.  ' '''is the indexing function (squad)'',r'                                    °
  507.   'show ''∞6'' ''3╙∞6'' ''(,3)╙∞6'''                                           °
  508.   '''In the above example, the scalar 3 or one element vector ,3 extract       °
  509.  s'''                                                                          °
  510.   '''the third element of the right argument vector. When the right'''         °
  511.   '''argument is an array, we need to specify as many directions in the'       °
  512.  '' '''left argument, as the number of axes (rank) of the array'',r'           °
  513.   'show ''2 3╙3 4µ∞12'' ''1 2 3╙3 3 3µ∞27'''                                   °
  514.   '''This brings us to BRACKET INDEXING. In lesson 4 we learned that an'       °
  515.  ''                                                                            °
  516.   '''expression inside brackets can be used to access selected elements'       °
  517.  ''                                                                            °
  518.   '''of a vector. The only requirement was that the expression MUST retu       °
  519.  rn'''                                                                         °
  520.   '''integers in the range of the vector length. We also learned that'''       °
  521.   '''NOTHING inside brackets produced the whole vector'',r'                    °
  522.   'show ''V╜∞3'' ''V[1 1 1 2 2 3]'' ''V[∞0]'' ''V[]'''                         °
  523.   '''Bracket indexing extends to arrays, but it requires additional'''         °
  524.   '''convention in notation. Suppose we generate an array A'',r'               °
  525.   'show ''A╜4 4µ∞16'''                                                         °
  526.   '''How should we specify the second row, second column? Clearly A[2 2]       °
  527.  '''                                                                           °
  528.   '''is inadequate because it is too limiting. (We would not be able to'       °
  529.  ''                                                                            °
  530.   '''extract more than one value at a time.) Since the array A has two''       °
  531.  '                                                                             °
  532.   '''axes, namely rows and columns, it makes sense to be able to write''       °
  533.  '                                                                             °
  534.   '''separate expressions for each axis. This is done by writing two'''        °
  535.   '''expressions separated by a semicolon'',r'                                 °
  536.   'show ''A[1 2;1 2]'' ''A[1;1 2 2 3 3 3 4 4 4 4]'''                           °
  537.   '''Let us now look at the shape of the results of bracket indexing of'       °
  538.  '' '''arrays. Recall that 1 is a scalar, but ,1 is a vector'',r'              °
  539.   'show ''µA[1;1 2 3]'' ''µA[,1;1 2 3]'' ''µA[2;3]'''                          °
  540.   '''When there is no expression in a slot reserved for an axis, this'''       °
  541.   '''NOTHING is interpreted as if that axis were to be taken whole'',r'        °
  542.   'show ''A[1 2;]'' ''A[;]'''                                                  °
  543.   '''The notation for higher order arrays is readily extended'',r'             °
  544.   'show ''M╜2 3 4 5µ∞120'' ''M[1;2 3;1 4;5]'' ''M[1;2;;]'''                    °
  545.   '''We have therefore'',r' '1 RULE 15' 'do'                                   °
  546.   '''Finally what if one or more expressions inside the brackets is a'''       °
  547.   '''null vector?'',r' 'show ''µA[∞0;2 3]'' ''DISPLAY A[∞0;2 3]'''             °
  548.   '''This gives us the following rule'',r' '1 RULE 16'                         °
  549.   '''Are we done with bracket notation and arrays? Not quite!''' 'do'          °
  550.   '''Suppose that one or more of the axis specifications is not a scalar       °
  551.  ''' '''or a vector, but an array'',r'                                         °
  552.   'show ''V[2 2µ∞3]'' ''A[1;2 2µ∞4]'' ''M[2;3;4;2 2µ∞4]'''                     °
  553. X '''Therefore'',r' '1 RULE 17' 'do' '1 RULE 18' 'endd'                        °
  554. *(1997 5 24 12 18 19 380)                                                      °
  555.  FTEACH5 ÉFX 'TEACH5'                                                          °
  556.   'Σ Reduction and Scan operators on arrays (continued)'                       °
  557.   'exit ''TEACH5'''                                                            °
  558.   '''We have seen how all primitive APL2 functions can be aplied to'''         °
  559.   '''arrays. In the same manner the use of APL2 operators can be also'''       °
  560.   '''extended to arrays.'',r'                                                  °
  561.   '''Before we try reduction to arrays, let us review how reduction work       °
  562.  s''' '''on scalars and vectors.'',r' 'show ''⌡/8'' ''µ⌡/8'' ''µµ⌡/8'''        °
  563.   '''The reduction of a scalar produces that scalar. In other words, as'       °
  564.  '' '''far as scalars are concerned, reduction has no effect'',r'              °
  565.   'show ''∞/''''A'''''' ''|/²3.14159'''                                        °
  566.   '''The reduction of a vector ALWAYS produces a scalar'',r'                   °
  567.   'show ''+/∞5'' ''µµ+/∞5'''                                                   °
  568.   '''Finally, the reduction of a null vector produces the identity value       °
  569.  ''' '''of the function'',r' 'show ''⌡/∞0'' ''╛/∞0'' ''=/'''''''''''           °
  570.   '''In the second example, we get the largest positive integer that APL       °
  571.  2'''                                                                          °
  572.   '''allows. Why? Because for arbitrary numeric arguments the minimum wi       °
  573.  ll'''                                                                         °
  574.   '''always be less than this value. The exception, of course, is when o       °
  575.  nly'''                                                                        °
  576.   '''null vectors are reduced. In some applications that possibility can       °
  577.  ''' '''arise, and APL2 must provide for.''' 'do'                              °
  578.   '''Now let us see how reduction works on arrays'',r'                         °
  579.   'show ''NUMBERS╜3 4µ∞12'' ''NUMBERS'' ''+/NUMBERS'' ''µ+/NUMBERS'''          °
  580.   '''NUMBERS is an array with three rows and four columns. When this tab       °
  581.  le'''                                                                         °
  582.   '''is reduced with the + function, we see a vector with three componen       °
  583.  ts.'''                                                                        °
  584.   '''The entries are the row sums. Let us see how reduction works in arr       °
  585.  ays''' '''of rank 3'',r'                                                      °
  586.   'show ''ARRAY╜3 4 5µ∞60'' ''µARRAY'' ''+/ARRAY'' ''µ+/ARRAY'''               °
  587.   '''The first two dimensions are left unchanged while the third one is'       °
  588.  '' '''reduced. Let us now try even higher rank arrays'',r'                    °
  589.   'show ''µ⌡/2 3 4 5µ1'' ''µδ/3 4 2 1 2 3 4µ0'''                               °
  590.   '''In each example it is the LAST dimension of the array that gets to        °
  591.  be''' '''reduced'',r' '1 RULE 19' 'do'                                        °
  592.   '''Why did we use the word "SIMPLE"? Because, as we will see shortly,'       °
  593.  '' '''it is possible to select the axis to be reduced.''' 'do'                °
  594.   '''Suppose that we desire to add the columns of array NUMBERS, instead       °
  595.  '''                                                                           °
  596.   '''of its rows. APL2 provides a special symbol that can be used to'''        °
  597.   '''specify reduction of the first axis'',r'                                  °
  598.   'show ''+≡NUMBERS'' ''µARRAY'' ''⌡≡ARRAY''' 'do'                             °
  599.   '''Since the first and last axis of a vector is the same, the ≡'''           °
  600.   '''symbol produces the same effect as the /'',r'                             °
  601.   'show ''+≡∞5'' ''+/∞5''' '''For arrays of rank greater than two'',r'         °
  602.   'show ''µ+≡2 3 4µ∞24'' ''µ⌡≡3 4 2 2 2µ∞2'''                                  °
  603.   '''For most application this alternate form of the reduction operator'       °
  604.  ''                                                                            °
  605.   '''is adequate. However, if you ever have an application where you use       °
  606.  ''' '''arrays of rank greater than 2, you might have a problem'',r'           °
  607.   'show ''µARRAY'''                                                            °
  608.   '''What do you do, if you want to reduce the middle axis of ARRAY, the       °
  609.  '''                                                                           °
  610.   '''one that has 4 rows? To handle this situation, APL2 supports a'''         °
  611.   '''syntactic feature called AXIS SPECIFICATION. Whenever you want to d       °
  612.  o'''                                                                          °
  613.   '''an operation that should be applied to a specific axis of an array,       °
  614.  '''                                                                           °
  615.   '''you can insert the value of that axis in square brackets between th       °
  616.  e''' '''function and the named array'',r'                                     °
  617.   'show ''⌐/[2]ARRAY'' ''⌐/[1]ARRAY'' ''⌐/[3]ARRAY'''                          °
  618.   '''Notice that the second and third examples are equivalent to ≡ and /       °
  619.  ''' '''respectively.''' 'do'                                                  °
  620.   '''Earlier it was pointed out that reduction of an EMPTY vector return       °
  621.  s'''                                                                          °
  622.   '''the IDENTITY value of a function. The same is true for empty arrays       °
  623.  '',r'                                                                         °
  624.   'show ''DISPLAY +/0 2 3µ∞30'' ''DISPLAY ⌐/0 2 0µ∞30'' ''DISPLAY ╛/3 4        °
  625.  0µ0'''                                                                        °
  626.   '''In the first example reduction over a non-null axis produced a null       °
  627.  '''                                                                           °
  628.   '''vector. The second example shows that a null array is left unchange       °
  629.  d'''                                                                          °
  630.   '''by reduction over a null axis. In the last example, reduction over        °
  631.  a'''                                                                          °
  632.   '''null axis produced the identity value for the non-null array.'''          °
  633. X 'endd'                                                                       °
  634. *(1997 8 28 12 22 15 408)                                                      °
  635.  FTEACH6 ÉFX 'TEACH6' 'Σ SCAN of arrays' 'exit ''TEACH6'''                     °
  636.   '''By now it should be obvious that SCAN when applied to arrays will''       °
  637.  ' '''work as one would expect by generalizing on what we learned in'''        °
  638.   '''reduction'',r' 'show ''3 4µ∞12'' ''⌡\3 4µ∞12'' ''⌡±3 4µ∞12'''             °
  639.   '''Scan does not change the shape of the array, and as in vectors,'''        °
  640.   '''the Nth element is the same as if the first N elements were reduced       °
  641.  '',r'                                                                         °
  642.   'show ''⌡\3 1µ1 5 9'' ''⌡\3 2µ1 2 5 6 9 10'' ''⌡\3 3µ1 2 3 5 6 7 9 10        °
  643.  11'''                                                                         °
  644.   '''Of course scan of empty vectors leaves the shape and rank unchanged       °
  645. X'',r' 'show ''DISPLAY 3 0µ∞3'' ''DISPLAY ⌡±3 0µ∞3''' 'endd'                   °
  646. XAV╜1 2 3                                                                      °
  647. *(1997 7 13 12 28 49 504)                                                      °
  648.  Faddquote ÉFX 'u╜addquote w'                                                  °
  649.   'Σ Put quotes around a string, and double existing quotes'                   °
  650. X 'u╜ÉAV[40],((1+w=ÉAV[40])/w),ÉAV[40]'                                        °
  651. *(1997 7 24 13 20 38 476)                                                      °
  652.  Fav ÉFX 'av;A;N;I;ÉIO' 'Σ Display characters in ÉAV' 'ÉIO╜0'                  °
  653.   'A╜22 78µ'' ''' 'N╜3 0«φ12 22µ1+∞356' 'A[;,(6⌡∞12)°.+2 3 4]╜N'               °
  654.   'A[;6+6⌡∞12]╜φ12 22µÉAV' 'ΣA[8 10 13;6]╜'' ''' 'A[13;6]╜'' '''               °
  655. X 'A[14+∞8;68 69 70 72]╜'' ''' 'A'                                             °
  656. *(1991 11 11 8 25 13 316)                                                      °
  657.  Fdate ÉFX 'u╜date w' 'Σ Format date and time of day' 'u╜«6╞w'                 °
  658. X 'u╜('' ''⌠u)Γu' 'u╜εu,■''-- .. '''                                           °
  659. XCdig 1 10 1234567890                                                          °
  660. *(1997 9 9 13 0 45 372)                                                        °
  661.  Fdisclaimer ÉFX 'disclaimer' 'Σ Copyright statement'                          °
  662.   '(10µ'' ''),''Copyright, Z. V. Jizba, 1995,1996,1997'',r'                    °
  663.   ''' This and subsequent workspaces labelled TEACHxx are made available       °
  664.  '''                                                                           °
  665.   '''at no cost to anyone who desires to learn how to use effectively'''       °
  666.   '''the IBM/OS2 version of APL2.'',r'                                         °
  667.   '''This software is provided "AS IS" with no WARRANTY of any kind, eit       °
  668.  her'''                                                                        °
  669.   '''express or implied. Any risk in its use resides with you, the user        °
  670.  of''' '''these tutorials.'',r' '''     ACKNOWLEDGEMENTS'',r'                  °
  671.   ''' In writing these tutorials, I am greatly indebted to Roy Sykes, wh       °
  672.  ose'''                                                                        °
  673.   '''excellent lectures increased my understanding of the language.'''         °
  674.   '''Discussions with the late Harry Bertucelli clarified a number of'''       °
  675.   '''concepts and caused me to change some improper terminology that was       °
  676.  '''                                                                           °
  677.   '''used in previous versions of these tutorials. Mr. Benjamin Archer''       °
  678.  '                                                                             °
  679.   '''kindly checked out a nearly final version, bringing to my attention       °
  680.  ''' '''some ommisions, misspellings, and invalid terminology.'',r'            °
  681. X '''(PRESS ENTER to continue)'''                                              °
  682. *(1997 7 13 12 28 50 508)                                                      °
  683.  Fdo ÉFX 'do;T;E' 'Σ Expression driver' 'E╜''''' 'æ╜''      ''' 'T╜æ'          °
  684.   '╕(^/'' ''=T)/0'                                                             °
  685.   '╕(('':''εT)doif ''B╜evaldd (+/^\'''' ''''=T)╟T'')/2'                        °
  686.   '''E╜ÉEM'' ÉEA T' '╕(0=µ,E)/2'                                               °
  687.   '''This is not a valid APL2 expression''' 'æ╜''*''' '╕(''?''⌠╞1╟æ)/2'        °
  688. X 'E' '╕2'                                                                     °
  689. *(1997 7 13 12 28 50 508)                                                      °
  690.  Fdoif ÉFX 'U╢╜V╢ doif W╢;t╢' 'Σ Rule' '╕(^/~U╢╜V╢)/0'                         °
  691. X '''U╢╜V╢ doif■ W╢'' ÉEA ''»V╢/W╢'''                                          °
  692. *(1997 9 9 12 50 14 444)                                                       °
  693.  Fendd ÉFX 'endd' 'Σ end of special feature' '20µ''²'' ╪ ╕(4<µÉLC)/0'          °
  694. X 'do'                                                                         °
  695. *(1997 8 14 12 37 28 464)                                                      °
  696.  Ferase ÉFX                                                                    °
  697.   'erase;t;EXIT;GO;HELP;DISPLAY;REVIEW;TABLES;RANK;RULE;DISCLAIMER'            °
  698.   'Σ Erase all global functions and variables' 't╜ÉNL 3'                       °
  699.   't╜(~t^.εlc,'' '')≡t' 't╜ÉEX(~t[;∞5]^.=''TEACH'')≡t' 't╜ÉNL 2'               °
  700. X 't╜ÉEX(~t^.εlc,'' '')≡t'                                                     °
  701. *(1997 7 27 13 47 41 608)                                                      °
  702.  Fevaldd ÉFX 'u╜evaldd w;c;n' 'Σ Evaluate direct definition' 'u╜0'             °
  703.   'n╜(w∞''Σ'')-1' 'c╜(((n╞w)⌠'':'')Γn╞w),Γ''ΣDD '',(n+1)╟w'                    °
  704.   '╕((1 label╞c)doif ''''''Invalid label'''''')/0'                             °
  705.   '╕((2=µc)doif ''u╜showdd 1╙c'')/0'                                           °
  706.   '╕((3=ÉNC╞c)doif ''u╜⌡µÉ╜(╞c),'''' is already defined.'''''')/0'             °
  707.   '╕((3=µc)doif ''u╜simdd c'')/0' 'c╜(Γ''α∙ aw'')replace■c'                    °
  708.   'u╜ε''u╜'',((''a''εεc[2 3 4])/''a ''),(╞c),'' w;t;b'''                       °
  709.   'u╜u(5πc)(''b╜(t╜'',(3πc),'')/'',addquote ''u╜'',4πc)'                       °
  710. X 'u╜u,''╕(t doif b)/0''(''u╜'',2πc)' 'u╜╧ÉFX u'                               °
  711. *(1997 7 25 13 27 52 564)                                                      °
  712.  Fexit ÉFX 'V exit W;T' 'Σ Exit if too many suspended functions'               °
  713.   '╕(0⌠ÉNC ''V'')/L0 ╪ V╜10' 'L0:╕(V>µÉLC)/0'                                  °
  714.   '''There are too many suspended functions''' '''Please enter '',W'           °
  715. X '╕'                                                                          °
  716. *(1997 7 26 12 33 39 536)                                                      °
  717.  Fget ÉFX 'U╜V get W;t;T;ÉPR' 'Σ Prompt for response from keyboard'            °
  718.   'ÉPR╜T╜ÉAV[ÉIO+255] ╪ ╕(0⌠ÉNC ''V'')/L0 ╪ V╜1' 'L0:V╜V╧1' 'æ╜W ╪ t╜æ'        °
  719.   'U╜(+/^\t=T)╟t' '╕(''╕''⌠╞U)/L1 ╪ ╕' 'L1:╕V/0' 't╜(U⌠'' '')ΓU'               °
  720. X 'U╜(µt),(ΓU),t'                                                              °
  721. *(1997 7 28 13 33 8 424)                                                       °
  722.  Fglobals ÉFX 'globals' 'Σ Initialize useful global variables'                 °
  723.   'uc╜''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''                                          °
  724.   'lc╜''abcdefghijklmnopqrstuvwxyz''' 'dig╜''1234567890'''                     °
  725. X 'r╜ÉAV[13+ÉIO]' 'q╜'''''''''                                                 °
  726. *(1997 7 3 12 47 6 368)                                                        °
  727.  Finitialize ÉFX 'initialize;T' 'Σ Initialize workspace'                       °
  728.   '''AT ALL TIMES, TO CONTINUE, PRESS RETURN!'',r'                             °
  729.   '''To see disclaimers enter:'',r,''    disclaimer''' 'do' 'erase'            °
  730.   'globals'                                                                    °
  731.   '''Make sure the CAP LOCK light on your keyboard (upper right) is ON!'       °
  732. X'' 'endd'                                                                     °
  733. *(1997 7 27 13 14 33 444)                                                      °
  734.  Flabel ÉFX 'u╜v label w'                                                      °
  735.   'Σ Return 1 if label w does not begin with a cap'                            °
  736.   '╕(0⌠ÉNC ''v'')/L0 ╪ v╜0' 'L0:v╜v╧1 ╪ w╜εw ╪ ╕v/L1 ╪ ╕(u╜0⌠ÉNC w)/0'         °
  737. X 'L1:╕(u╜~^/wεlc,uc,dig)/0' 'u╜w[1]εlc,dig'                                   °
  738. XClc 1 26 abcdefghijklmnopqrstuvwxyz                                           °
  739. *(1997 7 13 12 28 55 528)                                                      °
  740.  Fnon ÉFX 'non;T;RC;ET;R' 'Σ Ignore keyboard entry' 'æ╜''      ''' 'T╜æ'       °
  741.   '╕(0=µ(T⌠'' '')/T)/0' '(RC ET R)╜ÉEC T' '╕(0=RC)/2'                          °
  742. X '╕((1=RC)doif ''R'')/2' '╕2'                                                 °
  743. *(1997 7 13 12 28 55 528)                                                      °
  744.  Fnotb ÉFX 'u╜notb w' 'Σ Remove trailing blanks'                               °
  745.   '╕((1<╧w)doif ''u╜notb■ w'')/0' '╕((1<µµw)doif ''u╜πnotb Γ[2]w'')/0'         °
  746. X 'u╜(1-(,'' ''⌠Φw)∞1)╟w'                                                      °
  747. *(1997 7 27 12 55 6 496)                                                       °
  748.  Fproblems ÉFX 'problems' 'Σ Problems'                                         °
  749.   '''That is all for this lesson. Remember, if you want to practice,'''        °
  750.   '''and plan to use direct definitions, be sure to first enter GO.'''         °
  751.   '''Direct definitions will then be accepted. To exit GO, enter EXIT.''       °
  752.  ,r'                                                                           °
  753.   '''To erase a previously defined DIRECT DEFINITION FUNCTION, enter'',r       °
  754.  ' '''       )ERASE functionname'',r'                                          °
  755. X '''WARNING! do not use )ERASE on other labels.'',r'                          °
  756. XCq 0 '                                                                        °
  757. XCr 0                                                                         °
  758. *(1997 7 13 12 28 56 532)                                                      °
  759.  Freplace ÉFX 'u╜v replace u;i;r;s' 'Σ Replace elements in v in u'             °
  760.   'i╜Γ∞µu' 's╜2πv╜(v⌠'' '')Γv' 'i╜⌡r╜i⌡■Γ[1]u°.=╞v'                            °
  761. X 'u[(εi)/εr]╜s[(εi)/εi⌡■∞µs]'                                                 °
  762. *(1997 7 13 12 28 56 532)                                                      °
  763.  Fround ÉFX 'U╜V round W' 'Σ Half adjust to V th decimal'                      °
  764. X 'U╜(╛0.5+W⌡10*V)÷10*V'                                                       °
  765. *(1997 6 1 12 52 40 512)                                                       °
  766.  Frule ÉFX 'V rule W' 'Σ Additional remarks on rules'                          °
  767.   '╕(2=ÉNC ''V'')/L ╪ V╜0' 'L:╕(~(╞W)ε∞8)/LA ╪ V rulea╞W ╪ ╕L0'                °
  768.   'LA:╕(~(╞W)ε9 10 11)/LB ╪ V ruleb╞W ╪ ╕L0'                                   °
  769.   'LB:╕((11+∞8)=╞W)/L12,L13,L14,L15,L16,L17,L18,L19'                           °
  770.   '''This rule number is undefined'' ╪ ╕' 'L12:╕(V>1)/L12X'                    °
  771.   '''   RULE 12. A scalar function is one that will produce a result on'       °
  772.  ''                                                                            °
  773.   '''            every scalar element of a vector or array. EXAMPLES:'''       °
  774.   '''            + - ⌡ ÷ * are numeric scalar functions. , µ ∞ are NOT''       °
  775.  ' '''            scalar functions.'',r' '╕(0=V)/L0'                           °
  776.   'L12X:''This distinction will become clearer when we study more genera       °
  777.  lized''' '''arrays.''' '╕L0' 'L13:╕(V>1)/L13X'                                °
  778.   '''   RULE 13. Scalars that work with vectors also work with arrays.''       °
  779.  ,r' '╕(0=V)/L0'                                                               °
  780.   'L13X:''No problem with simple scalars, but this rule may need modific       °
  781.  ation'''                                                                      °
  782.   '''when we deal with "rank zero arrays" that are not simple scalars.''       °
  783.  ' '╕L0' 'L14:╕(V>1)/L14X'                                                     °
  784.   '''   RULE 14. Arrays with the same shape can be processed with scalar       °
  785.  ''' '''functions.'',r' '╕(0=V)/L0'                                            °
  786.   'L14X:''Arrays with distinct shapes can be processed as we shall see,        °
  787.  but'''                                                                        °
  788.   '''there will be restrictions, and we will use new operators.'''             °
  789.   '╕L0' 'L15:╕(V>1)/L15X'                                                      °
  790.   '''   RULE 15. The number of semicolons inside brackets must equal the       °
  791.  ''' '''            rank of the array MINUS 1.'',r' '╕(0=V)/L0'                °
  792.   'L15X:''There is no further generalization to this rule.''' '╕L0'            °
  793.   'L16:╕(V>1)/L16X'                                                            °
  794.   '''   RULE 16. An axis specification can be a scalar, a vector or a'''       °
  795.   '''            null vector.'',r' '╕(0=V)/L0'                                 °
  796.   'L16X:''Recall that null array is the ONLY bracket specification that'       °
  797.  ''                                                                            °
  798.   '''makes sense for a scalar. We will use that property when dealing wi       °
  799.  th''' '''rank 0 arrays.''' '╕L0' 'L17:╕(V>1)/L17X'                            °
  800.   '''   RULE 17. An axis specification can be any array containing'''          °
  801.   '''            valid integers.'',r' '╕(0=V)/L0'                              °
  802.   'L17X:''With this rule, you can generate an APL2 object of arbitrary''       °
  803.  ' '''rank.''' '╕L0' 'L18:╕(V>1)/L18X'                                         °
  804.   '''   RULE 18. The shape of the result of axis specification is the'''       °
  805.   '''            catenation of the shapes of expressions inside brackets       °
  806.  .'''                                                                          °
  807.   '''            If the expression for an axis is missing, the shape for       °
  808.  ''' '''            that axis is unchanged.'',r' '╕(0=V)/L0'                   °
  809.   'L18X:''This is merely the rule for implementation of rule 17.'''            °
  810.   '╕L0' 'L19:╕(V>1)/L19X'                                                      °
  811.   '''   RULE 19. Simple reduction of arrays removes its last dimension.'       °
  812.  ',r' '╕(0=V)/L0' 'L19X:''This is a generalization of rule 2.'''               °
  813. X 'L0:do' '╕(0=µW╜1╟W)/0' '╕L'                                                 °
  814. *(1997 6 1 12 42 53 524)                                                       °
  815.  Frulea ÉFX 'V rulea W' 'Σ Additional remarks on rules'                        °
  816.   '╕(2=ÉNC ''V'')/L ╪ V╜0' 'L:╕(W=∞8)/L1,L2,L3,L4,L5,L6,L7,L8'                 °
  817.   '''For rules not described in this lesson, see workspace INDEX'''            °
  818.   '╕0' 'L1:╕(V>1)/L1X'                                                         °
  819.   '''RULE 1. For arithmetic operations a vector must be matched with a''       °
  820.  ' '''        scalar, or another vector of the same length.'',2µr'             °
  821.   '╕(0=V)/0'                                                                   °
  822.   'L1X:''This is the first of many rules dealing with the concept of'''        °
  823.   '''CONFORMABILITY. This means that elements to be processed by APL2'''       °
  824.   '''must in some ways match.''' '╕0' 'L2:╕(V>1)/L1X'                          °
  825.   '''RULE 2. The reduction operator places the function, (specified to''       °
  826.  '                                                                             °
  827.   '''        its left), between all pairs of the vector. It then evaluat       °
  828.  es''' '''        the resulting expression.'',2µr' '╕(0=V)/0'                  °
  829.   'L2X:''There is more to this, but at this stage the rule is essentiall       °
  830.  y''' '''correct.''' '╕0' 'L3:╕(V>1)/L1X'                                      °
  831.   '''RULE 3. All APL2 expressions are evaluated from right to left'',2µr       °
  832.  ' '╕(0=V)/0'                                                                  °
  833.   'L3X:''This rule is valid in APL, which is the earlier version of APL2       °
  834.  .'''                                                                          °
  835.   '''For APL2, the rule has been restated in a totally different way.'''       °
  836.   '''However until we introduce some concepts that are new to APL2, the'       °
  837.  '' '''newer form reduces to RULE 3 as stated.''' '╕0' 'L4:╕(V>1)/L1X'         °
  838.   '''RULE 4. Vectors in APL2 can have lengths of zero and one.'',2µr'          °
  839.   '╕(0=V)/0'                                                                   °
  840.   'L4X:''This is the first concept that begins to introduce the idea tha       °
  841.  t no'''                                                                       °
  842.   '''matter what the APL expression, if it is valid, it must produce a''       °
  843.  '                                                                             °
  844.   '''valid APL2 object. (Shades of which came first, the chicken or the        °
  845.  egg)''' '╕0' 'L5:╕(V>1)/L1X'                                                  °
  846.   '''RULE 5. The shape of a variable is a vector. The shape of a vector'       °
  847.  '' '''        is a vector of length 1. The shape of a scalar is a'''          °
  848.   '''        vector of length zero.'',2µr' '╕(0=V)/0'                          °
  849.   'L5X:''The left argument of RESHAPE is by definition a vector. If APL2       °
  850.   is'''                                                                        °
  851.   '''to be internally consistent, the inverse operation to RESHAPE (whic       °
  852.  h''' '''is indeed SHAPE) MUST return the same type of object.''' '╕0'         °
  853.   'L6:╕(V>1)/L1X'                                                              °
  854.   '''RULE 6. Reduction of a scalar returns that scalar REGARDLESS of'''        °
  855.   '''        the function to the left of the reduction operator.'',2µr'        °
  856.   '╕(0=V)/0'                                                                   °
  857.   'L6X:''Reduction BY DEFINITION reduces the RANK by one. The exception        °
  858.  is'''                                                                         °
  859.   '''for objects whose rank is zero. Since there is no such thing as'''        °
  860.   '''negative rank, reduction is undefined for scalars, and therefore'''       °
  861.   '''the result is to leave the APL2 object unchanged.''' '╕0'                 °
  862.   'L7:╕(V>1)/L1X'                                                              °
  863.   '''RULE 7. The reduction of a null vector produces the identity'''           °
  864.   '''        element of the function.'',2µr' '╕(0=V)/0'                        °
  865.   'L7X:''A null vector may be empty, but it still has rank equal to one.       °
  866.  '''                                                                           °
  867.   '''Therefore its reduction MUST be a scalar. Since there is no data'''       °
  868.   '''in a null vector, the scalar must be such that it has no effect'''        °
  869.   '''on the operation performed by the function: Zero added to anything'       °
  870.  ''                                                                            °
  871.   '''has no effect in addition; one multiplied by anything has no effect       °
  872.  ''' '''in multiplication; and so on.''' '╕0' 'L8:╕(V>1)/L1X'                  °
  873.   '''RULE 8. Parentheses can (and should) be used to modify the right'''       °
  874.   '''        to left rule to improve efficiency'',2µr' '╕(0=V)/0'              °
  875.   'L8X:''Parentheses are used in APL2 for other purposes as well, but fo       °
  876.  r'''                                                                          °
  877.   '''now, we will use them just to modify the right to left rule (RULE 3       °
  878.  ).'''                                                                         °
  879.   '''If you place parentheses where they are not needed, APL2 will ignor       °
  880. Xe''' '''them.'''                                                              °
  881. *(1997 6 1 12 49 37 488)                                                       °
  882.  Fruleb ÉFX 'V ruleb W' 'Σ Additional remarks on rules'                        °
  883.   '╕(2=ÉNC ''V'')/L ╪ V╜0' 'L:╕(9 10 11=╞W)/L9,L10,L11 ╪ ╕0'                   °
  884.   'L9:╕(V>1)/L9X'                                                              °
  885.   '''   RULE 9: To produce a quote inside a character string, enter'''         °
  886.   '''           the quote twice.'',2µr' '╕(0=V)/0'                             °
  887.   'L9X:''This is used in most other programming languages.''' '╕0'             °
  888.   'L10:╕(V>1)/L10X'                                                            °
  889.   ''' RULE 10: In replication the left argument must contain only'''           °
  890.   '''          integers. The length of the left argument must be'''            °
  891.   '''          the same as the length of the right argument.'',2µr'            °
  892.   '╕(0=V)/0'                                                                   °
  893.   'L10X:''The left argument may also have negative integers. Only the nu       °
  894.  mber'''                                                                       °
  895.   '''of positive integers and zeros must add up to the length of the rig       °
  896.  ht'''                                                                         °
  897.   '''argument. Replicate with negative integers is not discussed here be       °
  898.  cause'''                                                                      °
  899.   '''the explanation requires concepts that have not yet been mentioned.       °
  900.  '',r' 'show ''1 1 2 ²1 0 1 1 1 ²1 1 0 1 1/''''CALIFORNIAN''''''' '╕0'         °
  901.   'L11:╕(V>1)/L11X'                                                            °
  902.   '''   RULE 11: The expression inside square brackets must return'''          °
  903.   '''            positive integers in the range of the length of'''            °
  904.   '''            the indexed vector. If the expression is MISSING,'''          °
  905.   '''            the result is as if the brackets were missing.'',2µr'         °
  906.   '╕(0=V)/0'                                                                   °
  907.   'L11X:''The expression in brackets need not be a vector. It could be a       °
  908.  n''' '''array as in the next example'',r'                                     °
  909. X 'show ''''''CALIFORNIA''''[3 3µ?9µ10]'' ''(∞4)[3 3µ∞4]'''                    °
  910. *(1997 7 13 12 28 57 536)                                                      °
  911.  Fshow ÉFX '╢V show ╢W;╢T;╢B' 'Σ Display and execute ╢W'                       °
  912.   '╢T╜(0=ÉNC ''╢V'')doif ''╢V╜0'''                                             °
  913.   '╕((0=╧╢W)doif ''show ╢W,'''' '''''')/0'                                     °
  914.   '╕((1<╧╢W)doif ''╢V show ■╢W'')/0' '''      '',╢W'                           °
  915. X '╕((╢V^'':''ε╢W)doif ''╢T╜evaldd ╢W'')/L0' '''ÉEM'' ÉEA ╢W' 'L0:do'          °
  916. *(1997 7 13 12 28 57 536)                                                      °
  917.  Fshowdd ÉFX 'u╜showdd w;a;b;c;r'                                              °
  918.   'Σ Display a direct definition function'                                     °
  919.   '╕((1=╧w)doif ''u╜showdd Γw'')/u╜0'                                          °
  920.   '╕((3⌠ÉNC╞w)doif ''(ε╞w),'''' is not a function'''''')/0'                    °
  921.   'c╜Γ[2]ÉCR╞w' 'c╜notb(2╞c),(Γ''aw α∙'')replace■2╟c'                          °
  922.   '╕((~''ΣDD''╧3╞2πc)doif ''''''Not a direct definition function'''''')/       °
  923.  0' 'u╜1' 'b╜('' ''⌠╞c)Γ╞c' 'a╜''      ''' 'r╜2╟3πc'                           °
  924.   '╕((3=µc)doif ''a,(╞w),'''':'''',r,(3<µ2πc)/''''   Σ'''',3╟2πc'')/0'         °
  925.   'a╜a,(╞w),'':'',(2╟5πc),'':''' 'b╜(+\r=''('')-+\r='')''' 'b╜b∞0'             °
  926. X 'a╜a,(²3╟(b-1)╞3╟r),'':'',2╟»(b+2)╟r' 'a,(3<µ2πc)/''  Σ'',3╟2πc'             °
  927. *(1997 7 13 12 28 57 536)                                                      °
  928.  Fshowfn ÉFX 'U╜V showfn W;F;N;T;ÉIO' 'Σ Simulate ╖W[É]'                       °
  929.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'ÉIO╜0'                                        °
  930.   'U╜r,''      '',''╖'',W,''[É]'',(╞V)╞''╖''' 'N╜1╞µF╜ÉCR W' 'N╜«∞N'           °
  931.   'N╜(N⌠'' '')ΓN' 'F╜(π''['',■N,■Γ''] ''),F'                                   °
  932.   'T╜(1<µ,V)doif ''F╜F[1╟V;]'' ''U╜''''''''''' 'U╜²1╟U,r,,F,r'                 °
  933. X 'U╜((-+/^\'' ''=ΦU)╟U),('' ╖'')[╞V],r'                                       °
  934. *(1997 7 13 12 28 58 540)                                                      °
  935.  Fsimdd ÉFX 'u╜simdd w;e' 'Σ Direct definition mode' 'u╜0'                     °
  936.   '╕((0⌠ÉNC╞w)doif ''''''Already defined'''''')/0' 'e╜''α''ε2πw'               °
  937.   'w[2]╜Γ''u╜'',''α∙ aw'' replace 2πw' 'w╜w[1 3 2]'                            °
  938. X 'w[1]╜Γε''u╜'',(e/''a ''),w[1],'' w''' 'u╜╧ÉFX w'                            °
  939. *(1992 6 3 9 59 17 424)                                                        °
  940.  Ftab ÉFX 'U╜V tab W;T;A;B;C;D;E;F;G;M;ÉPW' 'Σ Tabulate list W'                °
  941.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'M╜''Invalid data for tabulation'''            °
  942.   'V╜4╞V' 'ÉPW╜130╛30⌐G╜V[2]+79⌡V[2]=0'                                        °
  943.   'L1:╕((1<╧W)doif ''''''W╜∞0'''' ÉEA ''''W╜πW'''''')/L1'                      °
  944.   '╕(((0=µεW)δ2<µµW)doif ''U╜(~V╧4╞0)/M'')/0'                                  °
  945.   'T╜(1≥µµU╜«W)doif ''U╜πW╜(U⌠'''' '''')ΓU'''                                  °
  946.   'T╜(0<V[1])doif ''U╜(«(Φ1,╞µW)µ(V[3]µ'''' ''''),∞(╞µW)-V[3]),'''' ''''       °
  947.  ,U''' '╕(G<30)/0' 'T╜(F╜µεV[4])+C╜1╟B╜µA╜(V[3],0)╟U'                          °
  948.   'T╜⌐(1╞B)÷1⌐╛(ÉPW+F)÷T' 'U╜(E╜(V[3],C)╞U),[1](B╜T,1╟B)╞A'                    °
  949.   '''D╜εV[4]'' ÉEA ''D╜ÉAV[εV[4]+33⌡V[4]=0]''' 'L0:A╜(T,0)╟A'                  °
  950. X '╕(0=1╞µA)/0' 'U╜U,(((T+V[3]),µD)µD),E,[1]B╞A' '╕L0'                         °
  951. *(1997 7 13 12 28 59 544)                                                      °
  952.  Ftest ÉFX 'U╜V test W;P'                                                      °
  953.   'Σ Describe problem in W, (correct answer in V)' 'U╜2' 'L1:W'                °
  954.   'É╜''      ''' 'P╜æ' '''╕L0'' ÉEA ''P╜»P''' '╕(V╧P)/0'                       °
  955. X 'L0:╕(0=U╜U-1)/0' '''Incorrect. Try again''' '╕L1'                           °
  956. XCuc 1 26 ABCDEFGHIJKLMNOPQRSTUVWXYZ                                           °
  957. *(1996 4 6 16 2 32 304)                                                        °
  958.  Fvec ÉFX 'U╜vec' 'Σ Draw 2d vector in plane'                                  °
  959.   'U╜r,r,''2-        +'',r '':      °'',r,''1-    °'',r'                       °
  960. X 'U╜U,'' :  °'',r,''0|....|....|'',r,'' 0    1    2'',r'                      °
  961.