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

  1. XNÉIO 0 1                                                                      °
  2. XNÉCT 0 1E²13                                                                  °
  3. XCÉFC 1 6 .,*0_²                                                               °
  4. XNÉRL 0 1954899097                                                             °
  5. XCÉPR 1 1                                                                      °
  6. XCÉLX 1 5 TEACH                                                                °
  7. XNA 2 2 3 0 1 0 1 0 1                                                          °
  8. XNB 2 6 3 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0                                  °
  9. *(1996 4 6 16 4 50 384)                                                        °
  10.  FBIND ÉFX 'BIND' 'Σ Binding rules of APL2'                                    °
  11.   '''  1. Brackets bind to the left'''                                         °
  12.   '''  2. Left arrow binds to the left'''                                      °
  13.   '''  3. Dyadic operator binds to the right'''                                °
  14.   '''  4. Strand notation binding'''                                           °
  15.   '''  5. Operator binds to its left'''                                        °
  16.   '''  6. Function binds to its left'''                                        °
  17.   '''  7. Function binds to its right'''                                       °
  18. X '''  8. Left arrow binds to its right'',r'                                   °
  19. XNC 2 3 3 1 0 1 0 0 1 0 1 0                                                    °
  20. *(1997 9 14 12 30 44 504)                                                      °
  21. XFDISCLAIMER ÉFX 'DISCLAIMER' 'Σ Copyright statement' 'disclaimer'             °
  22. *(1996 4 6 16 4 50 384)                                                        °
  23.  FDISPLAY ÉFX 'D╜S DISPLAY A;ÉIO;R;C;HL;HC;HT;HB;VL;VB;V;W;N;B'                °
  24.   'Σ DISPLAY A GENERAL ARRAY IN PICTORIAL FORM'                                °
  25.   'Σ  NORMAL CALL IS MONADIC.  DYADIC CALL USED ONLY IN'                       °
  26.   'Σ    RECURSION TO SPECIFY DISPLAY RANK, SHAPE, AND DEPTH.' 'ÉIO╜0'          °
  27.   '»(0=ÉNC ''S'')/''S╜µA''' 'R╜╞µ,S                   Σ PSEUDO RANK.'          °
  28.   'C╜''┐┌└┘''                 Σ UR, UL, LL, AND LR CORNERS.'                   °
  29.   'HL╜''─''                   Σ HORIZONTAL LINE.'                              °
  30.   'HC╜HL,''Θ╕'',HL,''~+ε''      Σ HORIZONTAL BORDERS.'                         °
  31.   'HT╜HC[(0<R)⌡1+0<╞²1╞,S]' 'ΣW╜,0╧■╞0µΓ(1⌐µA)╞A'                              °
  32.   'HB╜HC[3+3╛(''2⌡~A╧«A'' ÉEA ''1+╞ε0⌡(1⌐⌡/µA)╞,A'')+3⌡1<µµS]'                 °
  33.   'VL╜''│''                   Σ VERTICAL LINE.'                                °
  34.   'VB╜VL,''Φ╟''               Σ VERTICAL BORDER.'                              °
  35.   'V╜VB[(1<R)⌡1+0<²1╞²1╟,S]'                                                   °
  36.   '»(0εµA)/''A╜(1⌐µA)µΓ╞A''   Σ SHOW PROTOTYPE OF EMPTIES.'                    °
  37.   '╕(1<╧A)/GEN' '╕(2<µµA)/D3'                                                  °
  38.   'D╜«A                     Σ SIMPLE ARRAYS.' 'W╜1╞µD╜(²2╞1 1,µD)µD'           °
  39.   'N╜²1+1╟µD' '╕(0=µµA)/SS'                                                    °
  40.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  41.  3]' '╕0' 'SS:HB╜((0 '' '')=╞0µΓA)/'' -'''                                     °
  42.   'D╜'' '',('' '',[0]D,[0]HB,Nµ'' ''),'' ''' '╕0'                              °
  43.   'GEN:D╜«DISPLAY■A          Σ ENCLOSED ...' 'N╜Dδ.⌠'' '''                     °
  44.   'D╜(Nδ~1ΦN)≡D' 'D╜(δ≡~''  ''╤D)/D' 'D╜((1,µS)µS)DISPLAY D'                   °
  45.   '╕(2≥µ,S)╟D3E,0' 'D3:D╜0 ²1╟0 1╟«ΓA         Σ MULT-DIMENSIONAL ...'          °
  46.   'W╜1╞µD' 'N╜²1+1╟µD'                                                         °
  47.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  48.  3]' 'D3E:N╜²2+µ,S'                                                            °
  49. X 'V╜C[Nµ1],[0]VB[1+0<²2╟,S],[0](((²3+╞µD),N)µVL),[0]C[Nµ2]' 'D╜V,D'           °
  50. *(1996 4 6 16 4 50 384)                                                        °
  51.  FEXIT ÉFX 'EXIT' 'Σ Exit from function' '''To log off type:   )OFF'''         °
  52. X '╕'                                                                          °
  53. *(1996 4 6 16 4 50 384)                                                        °
  54.  FGO ÉFX 'GO;T;E;B' 'Σ Expression driver' 'L0:B╜E╜''''' 'æ╜''      '''         °
  55.   'T╜æ' '╕(^/'' ''=T)/L0' '╕((^/'')OFF ''=5╞6╟T)doif ''EXIT'')/0'              °
  56.   '╕(('':''εT)doif ''B╜evaldd (+/^\'''' ''''=T)╟T'')/L0'                       °
  57.   '''E╜ÉEM'' ÉEA T' '╕(0=µ,E)/L0' '╕B/L0'                                      °
  58.   '''This is not a valid APL2 expression''' 'æ╜''*'''                          °
  59. X '╕(''?''⌠╞1╟æ)/L0' 'E' '╕L0'                                                 °
  60. *(1997 8 16 12 5 16 296)                                                       °
  61.  FHELP ÉFX 'HELP;N;I;T' 'Σ Help to student' '''WHAT TO DO'',r'                 °
  62.   '''  ° To get out of the lesson''' '''       ENTER: EXIT'''                  °
  63.   '''  ° To log off APL2'''                                                    °
  64.   '''       FIRST, ENTER: EXIT  THEN ENTER: )OFF'''                            °
  65.   '''  ° To get help''' '''       ENTER: HELP'''                               °
  66.   '''  ° When you see the prompt on a blank line'''                            °
  67.   '''       ENTER AN APL2 EXPRESSION - OR JUST PRESS: ENTER''' 'do'            °
  68.   '''  ° If you get this line'',r'                                             °
  69.   '''This is not a valid APL2 expression'',r,''*'',r'                          °
  70.   '''        YOU CAN EITHER''' '''           A. PRESS: ENTER'''                °
  71.   '''           B. PRESS: ? and then ENTER to see what was incorrect'''        °
  72.   '''              in your expression causing that response'',r' 'do'          °
  73.   '''HINTS'',r'                                                                °
  74.   '''This lesson is made up of '',(«N╜4),'' components named TEACHx, whe       °
  75.  re''' '''the x stands for a digit:'',r' 'I╜0'                                 °
  76.   'L0:T╜''TEACH'',(«I╜I+1)' 'T,'' '',1╟notb(ÉCR T)[2;]' '╕(N>I)/L0'            °
  77.   'do'                                                                         °
  78.   '''You may review either of these components separately. To do that,''       °
  79.  '                                                                             °
  80.   '''first enter EXIT (and RETURN), then enter the name of the lesson.''       °
  81.  ' '''component (e.g. TEACH4).'',r'                                            °
  82.   '''To re-start the lesson, just enter TEACH'',r'                             °
  83.   '''When the screen fills up, it is a good idea to move the cursor to''       °
  84.  ' '''the start of a convenient paragraph, and press ENTER'',r'                °
  85.   '''You may also wish to press PAGE UP to review the prevous pages.'''        °
  86.   'do' '''RESOURCES'',r'                                                       °
  87.   '''You may also enter ONE of the following words at a time'',r'              °
  88.   '''BIND   List of APL2 binding rules'''                                      °
  89.   '''LINEAR Brief comments on history of Algebra, Complex numbers'''           °
  90. X '''MATRIX Geometric interpretation of Matrix Algebra''' 'endd'               °
  91. XNI 2 2 2 1 0 0 1                                                              °
  92. *(1997 6 12 13 35 36 476)                                                      °
  93.  FLINEAR ÉFX 'LINEAR' 'Σ Linear algebra'                                       °
  94.   '''The ancient Greeks did not know Algebra, yet they were able to solv       °
  95.  e'''                                                                          °
  96.   '''simple algebraic problems using geometry. They were able to do this       °
  97.  '''                                                                           °
  98.   '''because they associated numbers with line segments. We will follow'       °
  99.  ''                                                                            °
  100.   '''this Greek tradition, and define what will be called the REAL AXIS.       °
  101.  '',r'                                                                         °
  102.   '''Consider a straight line that extends indefinitely in both directio       °
  103.  ns.'''                                                                        °
  104.   '''We mark one point on this line, and call it the ORIGIN. Next we mar       °
  105.  k'''                                                                          °
  106.   '''another point on the line in a direction we will call RIGHT, and ca       °
  107.  ll'''                                                                         °
  108.   '''this second point ONE. The half line from origin towards point one        °
  109.  is'''                                                                         °
  110.   '''called the positive axis. The half line in the opposite direction i       °
  111.  s''' '''the negative axis.'',r'                                               °
  112.   '''We can define addition, subtraction, multiplication and division'''       °
  113.   '''on this line in such a way that it produces results that can be mat       °
  114.  ched'''                                                                       °
  115.   '''with addition, subtraction, multiplication and division with real''       °
  116.  '                                                                             °
  117.   '''numbers. What we mean here is that for every result obtained with''       °
  118.  '                                                                             °
  119.   '''numbers, we can associate a specific and unique point on the line.'       °
  120.  '' 'do'                                                                       °
  121.   '''When we use the term REAL NUMBER, we mean it in the Mathematical'''       °
  122.   '''sense. However, if you are not familiar with that meaning, the usag       °
  123.  e'''                                                                          °
  124.   '''of the term is not central to this discussion. In modern terminolog       °
  125.  y'''                                                                          °
  126.   '''the association of numbers with points on a line is called MAPPING.       °
  127.  '''                                                                           °
  128.   '''To explain why all this trouble tying numbers with points on a line       °
  129.  ,'''                                                                          °
  130.   '''we must briefly describe the evolution of algebraic thought.'''           °
  131.   'do' '''     ALGEBRA'',r'                                                    °
  132.   '''The Renaissance in Western Europe brought renewed interest in the''       °
  133.  '                                                                             °
  134.   '''study of Mathematics. Although much interest was devoted to the'''        °
  135.   '''re-discovery of Greek Geometry, there was also much work done in'''       °
  136.   '''the development of Algebra. There was a great deal of interest in''       °
  137.  '                                                                             °
  138.   '''the solution of POLYNOMIAL equations. A polynomial is an algebraic'       °
  139.  ''                                                                            °
  140.   '''expression. It is a summation of distinct terms. We will mention he       °
  141.  re'''                                                                         °
  142.   '''only one type of polynomials, namely those containing one variable,       °
  143.  ''' '''which we will call ''''x''''.'',r'                                     °
  144.   '''A term is either a constant, or the product of a constant and a'''        °
  145.   '''positive and integral but finite power of x. In algebraic theory, t       °
  146.  he'''                                                                         °
  147.   '''constants are generally restricted to RATIONAL numbers. Specificall       °
  148.  y'''                                                                          °
  149.   '''excluded are the TRANSCENDENTAL numbers such as PI. A polynomial'''       °
  150.   '''equation is formed when a polynomial is equated to zero. There is o       °
  151.  nly a'''                                                                      °
  152.   '''limited number of values of x that satisfy a polynomial equation.''       °
  153.  ,r'                                                                           °
  154.   '''The highest power of X in the polynomial determines its DEGREE. The       °
  155.  '''                                                                           °
  156.   '''fundamental theorem of algebra, first proved by Karl Friedrich Gaus       °
  157.  s in'''                                                                       °
  158.   '''1799 states that every polynomial has at least one root. A conseque       °
  159.  nce'''                                                                        °
  160.   '''of this theorem is that every polynomial of degree N can be factore       °
  161.  d'''                                                                          °
  162.   '''as a product of N first degree polynomials of the form Ax+B, where        °
  163.  A and''' '''B are points on the COMPLEX PLANE.'',r' 'do'                      °
  164.   '''      COMPLEX NUMBERS'',r'                                                °
  165.   '''The mathematicians of the 16th century sought to find positive solu       °
  166.  tions'''                                                                      °
  167.   '''called ROOTS to polynomial equations. Gradually mathematicians bega       °
  168.  n'''                                                                          °
  169.   '''to also accept negative roots. There was a belief, that solutions s       °
  170.  hould''' '''be limited to numeric values along the real axis.'''              °
  171.   '''     (We now know that the solution set is limited, since "most"'''       °
  172.   '''      points on the real axis, the transcendentals, cannot be roots       °
  173.  ''' '''      of polynomials with rational coefficients.)'',r'                 °
  174.   '''This belief was shattered, when it was discovered (and eventually''       °
  175.  '                                                                             °
  176.   '''accepted, though with considerable resistance) that there exist'''        °
  177.   '''COMPLEX roots. Complex numbers, can best be described as number pai       °
  178.  rs.'''                                                                        °
  179.   '''The second number of this pair is a number multiplied by the square       °
  180.  '''                                                                           °
  181.   '''root of negative one. Therefore, the NUMBER SYSTEM that defines the       °
  182.  '''                                                                           °
  183.   '''solution set of polynomial equations is a plane. This plane is defi       °
  184.  ned'''                                                                        °
  185.   '''by two axes. One is the real axis that we described above. The seco       °
  186.  nd'''                                                                         °
  187.   '''axis is (improperly) called the IMAGINARY axis. A point on this pla       °
  188.  ne'''                                                                         °
  189.   '''is described by two numbers, and the pair is also known as a VECTOR       °
  190.  .'''                                                                          °
  191.   '''Complex numbers (or vectors on the complex plane) can be added,'''        °
  192.   '''subtracted, multiplied and divided just as real numbers can.'''           °
  193.   'do'                                                                         °
  194.   '''In the second half of the 19th century, mathematicians began to exp       °
  195.  lore'''                                                                       °
  196.   '''other number systems. William Hamilton, for example, tried to exten       °
  197.  d'''                                                                          °
  198.   '''complex numbers to three dimensions, and came up with QUATERNIONS.'       °
  199.  ''                                                                            °
  200.   '''Strangely enough, he discovered that this new number system no long       °
  201.  er'''                                                                         °
  202.   '''obeyed all the rules of arithmetic. In particular, if A and B are t       °
  203.  wo'''                                                                         °
  204.   '''numbers in his system, the product AB is not the same as BA. Techni       °
  205.  cally''' '''this property is called non-commutative.'',r'                     °
  206.   '''At this point other mathematicians entered the investigations. For'       °
  207.  ''                                                                            °
  208.   '''example, it was asked why should the two axes be distinct. Why shou       °
  209.  ld'''                                                                         °
  210.   '''we not allow all axes to be real numbers. This approach led to the'       °
  211.  ''                                                                            °
  212.   '''development of VECTOR algebra. Cayley and Sylvester went even furth       °
  213.  er.'''                                                                        °
  214.   '''They studied vectors of vectors, by forming tables of numbers with'       °
  215.  ''                                                                            °
  216.   '''fixed numbers of rows and columns. This led to the development of''       °
  217.  '                                                                             °
  218.   '''MATRIX algebra. Further extensions were also made, such as in TENSO       °
  219.  R'''                                                                          °
  220.   '''algebra. In the twentieth century, all of these developments have''       °
  221.  '                                                                             °
  222.   '''been generalized. The study of number systems that support addition       °
  223.  ''' '''and multiplication is now called LINEAR ALGEBRA.''' 'do'               °
  224.   '''APL2 has functions and operators that support the type of processes       °
  225. X''' '''that fall under the domain of linear algebra.''' 'endd'                °
  226. *(1996 4 6 16 4 50 384)                                                        °
  227.  FMATRIX ÉFX 'MATRIX;V' 'Σ Examples from matrix algebra'                       °
  228.   '''Let us look at vector V'',r' 'show ''V╜4 3'''                             °
  229.   '''We have already seen that the inner product of V with itself produc       °
  230.  es'''                                                                         °
  231.   '''the square of its individual components squared. If you were to plo       °
  232.  t'''                                                                          °
  233.   '''the point V on a graph, you should recognize that the three points'       °
  234.  ''                                                                            °
  235.   '''(0 0) (4 0) (4 3) form a right triangle. Therefore by the theorem''       °
  236.  '                                                                             °
  237.   '''of Pythagoras, the distance from (0 0) to (4 3) should be 25, which       °
  238.  '''                                                                           °
  239.   '''is indeed the result of the inner product. In vector algebra, the i       °
  240.  nner'''                                                                       °
  241.   '''product of two vectors (of same length) is called the DOT PRODUCT''       °
  242.  ,r' 'show ''1 2 3 4 5+.⌡5 4 3 2 1'''                                          °
  243.   '''If the two vectors are the same, the square root of its dot product       °
  244.  ''' '''is called the NORM'',r' 'show ''(1 2 2+.⌡1 2 2)*.5'''                  °
  245.   '''Now let us form the following array'',r'                                  °
  246.   'show ''R╜2 2µ.8 .6 ².6 .8'' ''R'' ''R+.⌡4 3'''                              °
  247.   '''The array R ROTATES the vector V so that it becomes aligned with'''       °
  248.   '''the X axis. To see even better how this works, we will add a second       °
  249.  ''' '''vector'',r' 'show ''A╜2 2µ4 3 ²3 4'' ''A'''                            °
  250.   '''The array A can be thought of as a collection of two rows, each'''        °
  251.   '''representing a vector in the plane. By construction, the two vector       °
  252.  s'''                                                                          °
  253.   '''are at right angles to each other. (You may wish to verify this by'       °
  254.  ''                                                                            °
  255.   '''plotting the two points (4 3) and (²3 4) on a graph, and by connect       °
  256.  ing''' '''each point to the origin.)''' 'do'                                  °
  257.   '''Now we can see what array R will do to array A'',r'                       °
  258.   'show ''R+.⌡φA'''                                                            °
  259.   '''Why did we have to transpose A? Because in matrix multiplication'''       °
  260.   '''it is the COLUMNS of the right argument that are applied to the'''        °
  261.   '''ROWS of the left argument!'',r'                                           °
  262.   '''For that reason we can reverse the product'',r' 'show ''A+.⌡φR'''         °
  263.   '''The equivalence of the last two expressions is not accidental.'''         °
  264.   '''In general, for arbitrary arrays, we have φ(A+.⌡B) is the same'''         °
  265.   '''as (φB)+.⌡φA'',r'                                                         °
  266.   'show ''B╜2 2µ3 4 ²4 3'' ''B'' ''φA+.⌡φB'' ''B+.⌡φA'''                       °
  267.   '''Now let us consider just R'',r' 'show ''R+.⌡φR'''                         °
  268.   '''When R is multiplied by itself, it generates I, the matrix that'''        °
  269.   '''leaves an array unchanged by multiplication. In a sense I is the'''       °
  270.   '''square of R, which leads to the interesting observation that in'''        °
  271.   '''matrix algebra the square root of unity is not unity.''' 'do'             °
  272.   '''In APL2 any numeric array can be multiplied by a scalar'',r'              °
  273.   'show ''3⌡A'' ''3⌡UNIT 2'' ''A+.⌡3⌡UNIT 2'''                                 °
  274.   '''The scalar is propagated on all elements of the array. In the secon       °
  275.  d'''                                                                          °
  276.   '''and third example we see that the I matrix times 2 acts the same as       °
  277.  '''                                                                           °
  278.   '''the scalar 2. A matrix that has non zero values only in the diagona       °
  279.  l'''                                                                          °
  280.   '''is called a DIAGONAL matrix. A diagonal matrix is also SYMMETRIC'''       °
  281.   '''because φD is the same as D'',r'                                          °
  282.   'show ''D╜2 2µ2 0 0 3'' ''D'' ''A+.⌡D'' ''D+.⌡A'''                           °
  283.   '''Notice that array D changes A by multiplying its first column by 2'       °
  284.  ''                                                                            °
  285.   '''and by multiplying its second column by 3. It is as if we changed''       °
  286.  ' '''the scales on the X and Y axes.''' 'do'                                  °
  287.   '''Applications of matrix algebra are countless. We will see some, as'       °
  288.  ''                                                                            °
  289.   '''we learn about other primitive APL2 functions. If you find this'''        °
  290.   '''subject interesting, you might want to read any one of many textboo       °
  291.  ks''' '''on the subject.'',r'                                                 °
  292. X '''We will cover more of this same material in lesson 21.''' 'endd'          °
  293. XAN╜('JOHN')('MARY')('TED')('FRED')('EVE')('ANN')                              °
  294. *(1997 7 4 12 5 54 396)                                                        °
  295.  FTEACH ÉFX 'TEACH' 'Σ Start lesson 10: APL2 by Zdenek V JIZBA'                °
  296.   'exit ''TEACH''' 'initialize' 'TEACH1 Σ Inner product'                       °
  297.   'TEACH2 Σ Using the inner product on character and numeric arrays'           °
  298.   'TEACH3 Σ Inner product and matrices'                                        °
  299. X 'TEACH4 Σ Matrix multiplication' 'problems'                                  °
  300. *(1997 8 30 11 5 26 388)                                                       °
  301.  FTEACH1 ÉFX 'TEACH1;NAMES;ATTEND;A' 'Σ APL2 inner product'                    °
  302.   'exit ''TEACH1'''                                                            °
  303.   '''In this lesson we will study one version of the DOT operator.'''          °
  304.   '''This operator is distinguished from the ones we have studied before       °
  305.  '''                                                                           °
  306.   '''by its dyadic functionality. Whenever the dot operator is used,'''        °
  307.   '''it must have both a left and a right function as an argument.'''          °
  308.   'do' '''    INNER PRODUCT'',r'                                               °
  309.   '''When the dot is preceeded by a function (and of course followed by'       °
  310.  ''                                                                            °
  311.   '''a function), it is called the ARRAY PRODUCT. This operator was desi       °
  312.  gned'''                                                                       °
  313.   '''initially to solve a specific type of mathematical problems. We wil       °
  314.  l'''                                                                          °
  315.   '''study these, but we will introduce the general principle of this'''       °
  316.   '''operator in a more mundane way.''' 'do'                                   °
  317.   '''Suppose that we have an vector of names called N'',r'                     °
  318.   'show ''N╜''''JOHN'''' ''''MARY'''' ''''TED'''' ''''FRED'''' ''''EVE''       °
  319.  '' ''''ANN'''''''                                                             °
  320.   '''We can convert this vector to an array, say NAMES'',r'                    °
  321.   'show ''NAMES╜πN'' ''DISPLAY NAMES'''                                        °
  322.   '''The array NAMES has 6 rows and 4 columns. Now, suppose these names'       °
  323.  ''                                                                            °
  324.   '''represent members of a group. If the group meets, it may be useful'       °
  325.  ''                                                                            °
  326.   '''to generate an attendance record. Let us suppose that the following       °
  327.  ''' '''individuals attended a meeting'',r'                                    °
  328.   'show ''A╜''''FRED'''' ''''MARY'''' ''''JIM'''''''                           °
  329.   '''We can also convert this vector to an array, say ATTEND'',r'              °
  330.   'show ''ATTEND╜πA'' ''DISPLAY ATTEND'''                                      °
  331.   '''The array ATTEND has 3 rows and 4 columns. What we would like to'''       °
  332.   '''obtain is a 6 by 3 boolean array. The six rows to represent members       °
  333.  '''                                                                           °
  334.   '''of the group, and the three columns to represent the individuals'''       °
  335.   '''attending the meeting'',r'                                                °
  336.   '('' '',Γ[2]ATTEND),[1](Γ[2]NAMES),[2]B╜NAMES^.=φATTEND' 'do'                °
  337.   'r,''The boolean array has a one only in those places where the row la       °
  338.  bel''' '''matches the column label. Let us call that array B'',r'             °
  339.   'show ''B'''                                                                 °
  340.   'r,''We can identify all members who attended meeting'',r'                   °
  341.   'show ''(δ/B)/N''' '''and all who are not members'',r'                       °
  342.   'show ''(~δ≡B)/A'''                                                          °
  343.   '''Clearly the array B is very useful. It can be generated with the he       °
  344.  lp''' '''of a special APL2 operator called ARRAY INNER PRODUCT'',r'           °
  345.   'show ''NAMES^.=φATTEND'''                                                   °
  346.   '''Let us now disect this particular expression. We begin with the'''        °
  347.   '''transpose of ATTEND'',r'                                                  °
  348.   'show ''φATTEND'' ''µNAMES'' ''µφATTEND'''                                   °
  349.   '''Array φATTEND has 4 rows and 3 columns. Therefore the last dimensio       °
  350.  n'''                                                                          °
  351.   '''of NAMES matches the first dimension of φATTEND. This is a critical       °
  352.  '''                                                                           °
  353.   '''requirement, because the inner product removes this dimension from'       °
  354.  ''                                                                            °
  355.   '''the final result. Now let us see what the ^.= compound function doe       °
  356.  s.''' 'do'                                                                    °
  357.   '''It begins with the first row of NAMES (JOHN), and applies the right       °
  358.  '''                                                                           °
  359.   '''function argument (which is =) to the columns of φARRAY producing''       °
  360.  ,r' '(4 1µ''JOHN'')(φATTEND)(4 3µ12╞0 0 1)'                                   °
  361.   'r,''Having done this, the left argument of the operator (^) is used t       °
  362.  o''' '''reduce the columns of this intermediate array'',r'                    °
  363.   '''       ^≡''(4 3µ12╞0 0 1)' '3µ0' 'do'                                     °
  364.   'r,''This result is then placed in the first row of B. Next, the secon       °
  365.  d'''                                                                          °
  366.   '''row of B (MARY) is applied with = to the right argument, producing'       °
  367.  ',r' '(4 1µ''MARY'')(φATTEND)(4 3µ0 1 0)'                                     °
  368.   'r,''When this intermediate array is reduced by the left function (^),       °
  369.   the''' '''result 0 1 0 is placed in the second row of B'',r'                 °
  370.   '''      ^≡''(4 3µ0 1 0)' '2 3µ0 0 0 0 1' 'do'                               °
  371.   '''This process is then continued until the array B is complete.'',r'        °
  372. X 'B' 'endd'                                                                   °
  373. *(1997 6 13 12 27 58 532)                                                      °
  374.  FTEACH2 ÉFX 'TEACH2;N;A;NAMES;ATTEND;X;Y;V'                                   °
  375.   'Σ inner product with vectors and arrays' 'exit ''TEACH2'''                  °
  376.   '''The application of inner product need not be used with arrays of th       °
  377.  e''' '''same rank.'',r'                                                       °
  378.   'N╜''JOHN'' ''MARY'' ''TED'' ''FRED'' ''EVE'' ''ANN''' 'NAMES╜πN'            °
  379.   'A╜''FRED'' ''MARY'' ''JIM''' 'ATTEND╜πA'                                    °
  380.   '''Suppose our array of names is very long, and we wish to find out if       °
  381.  ''' '''JACK is on that list. Then the expressions'',r'                        °
  382.   'show ''NAMES^.=''''JACK'''''' ''NAMES^.=''''FRED'''''''                     °
  383.   '''return boolean vectors. Note that the right argument in the above''       °
  384.  '                                                                             °
  385.   '''expressions is reduced with the second dimension in the left argume       °
  386.  nt.''' 'do' '''As an extreme case both arguments could be vectors'',r'        °
  387.   'show ''''''JACK''''^.=''''FRED'''''' ''''''JACK''''^.=''''JACK'''''''       °
  388.   '''these two expressions are then equivalent to'',r'                         °
  389.   'show ''^/''''JACK''''=''''FRED'''''' ''^/''''JACK''''=''''JACK'''''''       °
  390.   '''Going the other way, either one of the two arguments can have an'''       °
  391.   '''arbitrary rank, as long as the last dimension of the left argument'       °
  392.  '' '''is the same as the first dimension of the right argument'',r'           °
  393.   'show ''µNAMES'' ''µNAMES^.=4 2 3µATTEND'' ''µ(2 2 6µATTEND)^.=NAMES''       °
  394.  ' 'show ''µ(2 3 4µNAMES)^.=4 2 1 1 1µATTEND'''                                °
  395.   '''The inner product will work equally with numeric arguments'',r'           °
  396.   'show ''X╜?2 6µ20'' ''X'' ''Y╜?6 3µ20'' ''Y'' ''X^.=Y'''                     °
  397.   '''In the following section we will deal with numeric arrays called'''       °
  398.   '''MATRICES. For a background on these entities, enter LINEAR''' 'do'        °
  399.   '''Although we could develop this subject in an abstract way, it may''       °
  400.  '                                                                             °
  401.   '''be easier to understand if we associate matrices with geometric'''        °
  402.   '''concepts. We realize that this is an artificial crutch, but is a'''       °
  403.   '''necessary one if you do not have a great deal of mathematical'''          °
  404.   '''background.''' 'do'                                                       °
  405.   '''We will start with numeric vectors. Consider'',r'                         °
  406.   'show ''V╜12 345'''                                                          °
  407.   '''The question that one has to ask is what do these numbers represent       °
  408.  .'''                                                                          °
  409.   '''If these values mean weight and cost of an object, then it is clear       °
  410.  '''                                                                           °
  411.   '''that only a restricted set of arithmetic operations have meaning.''       °
  412.  '                                                                             °
  413.   '''Certainly the expression +/V is meaningless. On the other hand 2⌡V'       °
  414.  ''                                                                            °
  415.   '''has practical validity. We could plot the two components on a graph       °
  416.  .'''                                                                          °
  417.   '''Most likely weight has little or no relationship to cost, so a plot       °
  418.  '''                                                                           °
  419.   '''of weight (as the x coordinate) vs cost (as the y coordinate) for''       °
  420.  '                                                                             °
  421.   '''many instances of V, is likely to have points scattered all over th       °
  422.  e'''                                                                          °
  423.   '''plane. Furthermore, for any value of x, there may be more than one'       °
  424.  '' '''value of y. Mathematically, the pair (x,y) is not a function.'''        °
  425.   'do'                                                                         °
  426.   '''Suppose now that the two components of V represent time and distanc       °
  427.  e.'''                                                                         °
  428.   '''Then again +/V has no meaning, but we might be able to say that for       °
  429.  '''                                                                           °
  430.   '''every value of V[1], there is a corresponding value of V[2]. This''       °
  431.  '                                                                             °
  432.   '''would make the components of V a FUNCTION. In modern terminology'''       °
  433.   '''V[1], corresponds to the INDEPENDENT VARIABLE, and the set of'''          °
  434.   '''admissible values of V[1] the DOMAIN. By convention, this is drawn'       °
  435.  ''                                                                            °
  436.   '''on graphs as the x axis. The y axis corresponds to V[2], the DEPEND       °
  437.  ENT'''                                                                        °
  438.   '''VARIABLE. The set of permissible values of V[2] is called the RANGE       °
  439.  .'',r'                                                                        °
  440.   '''The origin of the coordinate system (time,distance) can be shifted'       °
  441.  ''                                                                            °
  442.   '''arbitrarily, but the shifted axes must remain parallel to the origi       °
  443.  nal''' '''ones if the graph is to remain meaningful.''' 'do'                  °
  444.   '''In APL2 the usage of the term VECTOR covers the above examples, but       °
  445.  '''                                                                           °
  446.   '''in Mathematics, the word VECTOR has a much more restricted meaning.       °
  447.  '''                                                                           °
  448.   '''It is unfortunate that APL2 has chosen a conflicting terminology.''       °
  449.  ' 'do'                                                                        °
  450.   '''When we come to arrays, the terminology is improved. In Mathematics       °
  451.  '''                                                                           °
  452.   '''a numeric APL2 array of rank 2 is called a MATRIX. We will now stud       °
  453.  y'''                                                                          °
  454.   '''the inner product operator as applied to VECTORS and MATRICES in th       °
  455. Xe''' '''mathematical sense.''' 'endd'                                         °
  456. *(1997 6 13 12 41 59 592)                                                      °
  457.  FTEACH3 ÉFX 'TEACH3;UNIT' 'Σ Vectors and matrices' 'exit ''TEACH3'''          °
  458.   '''A vector in the mathematical sense is a point in a cartesian space'       °
  459.  ''                                                                            °
  460.   '''SPANNED by coordinate axes. The location and orientation of the axe       °
  461.  s'''                                                                          °
  462.   '''is quite arbitrary. The unit dimension along any axis can be assume       °
  463.  d'''                                                                          °
  464.   '''to be the same. The origin of coordinates can not only be shifted,'       °
  465.  ''                                                                            °
  466.   '''but it can also be rotated. We can even transform the nature of the       °
  467.  '''                                                                           °
  468.   '''coordinates. For example, instead of using cartesian coordinates,''       °
  469.  ' '''we can use a polar coordinate system.''' 'do'                            °
  470.   '''Le us assume that we have'',r' 'show ''V╜4 3'''                           °
  471.   '''By the process of mapping, the vector V can be thought of as a poin       °
  472.  t on'''                                                                       °
  473.   '''the Euclidean plane. The straight line reaching this point from the       °
  474.  ''' '''origin is called a vector. We have'',r'                                °
  475.   'show ''V+.⌡V'' ''V+.⌡1 0'' ''V+.⌡0 1'''                                     °
  476.   '''The first expression returns the square of the length of the vector       °
  477.  .'''                                                                          °
  478.   '''The second and third expressions return the x and y component.'''         °
  479.   'do' '''We can combine the last two expressions'',r'                         °
  480.   'show ''I╜2 2µ1 0 0'' ''I'' ''V+.⌡I'''                                       °
  481.   '''The matrix I when applied as an inner product to V returns V. Let''       °
  482.  '                                                                             °
  483.   '''us see how this process works. The Vector V is first applied to the       °
  484.  '''                                                                           °
  485.   '''first column of I (1 0) with the right argument of the inner produc       °
  486.  t'''                                                                          °
  487.   '''(⌡), to produce (4 0). Then the left argument of the inner product'       °
  488.  ''                                                                            °
  489.   '''(+) reduces (4 0) to 4. Next V is applied to the second column of I       °
  490.  '''                                                                           °
  491.   '''to produce (0 3) and 3. The final result is the vector (4 3).'''          °
  492.   'do'                                                                         °
  493.   '''Clearly I is the matrix equivalent of 1 with respect to the inner''       °
  494.  '                                                                             °
  495.   '''product (+.⌡). If I leaves a vector unchanged, let us see how it'''       °
  496.   '''will transform an array'',r'                                              °
  497.   'show ''A╜2 2µ∞4'' ''A'' ''A+.⌡I'' ''I+.⌡A'''                                °
  498.   '''So, I leaves an array unchanged whether it ''''multiplies'''' A on        °
  499.  the'''                                                                        °
  500.   '''right or on the left. Since I is such a useful array, we will defin       °
  501.  e''' '''function UNIT to generate it'',r'                                     °
  502.   '1 show ''UNIT:(∙,∙)µ1,∙µ0:∙=1:1'' ''DISPLAY UNIT 1'' ''UNIT 5'''            °
  503.   '''Let us now apply the inner product to two distinct arrays A and B''       °
  504.  ,r' 'show ''B╜2 2µΦ∞4'' ''B'' ''A+.⌡B'' ''B+.⌡A'''                            °
  505.   '''It does make a great deal of difference in what SEQUENCE we form'''       °
  506.   '''the product. The property of having A⌡B return the same result as''       °
  507.  '                                                                             °
  508.   '''B⌡A is called the COMMUTATIVE property. Clearly matrix inner produc       °
  509.  t'''                                                                          °
  510.   '''is non-commutative. Since this is not a textbook on linear algebra,       °
  511.  '''                                                                           °
  512.   '''we will not pursue the matrix inner product mathematically. We will       °
  513.  ,'''                                                                          °
  514.   '''however, study how it can be applied as an APL2 compound function.'       °
  515.  ',r'                                                                          °
  516.   '''(If you are iterested in geometric interpretation of the inner'''         °
  517. X '''product +.⌡, enter MATRIX.)''' 'endd'                                     °
  518. *(1997 6 13 12 41 30 476)                                                      °
  519.  FTEACH4 ÉFX 'TEACH4' 'Σ The inner product process' 'exit ''TEACH4'''          °
  520.   '''We will now define arrays A and B in such a way that (µA) is the'''       °
  521.   '''same as ΦµB'',r'                                                          °
  522.   'show ''A╜2 3µ0 1 0 1'' ''B╜3 2µ1 1 0 0 0'' ''A'' ''B'' ''A+.⌡B'' ''B+       °
  523.  .⌡A'''                                                                        °
  524.   '''Because (µA)╜╕µφB, we were able to evaluate both inner products (A+       °
  525.  .⌡B)'''                                                                       °
  526.   '''and (B+.⌡A). Not only are the results different, but the dimensions       °
  527.  '''                                                                           °
  528.   '''are not the same! You should try to verify these results by doing t       °
  529.  he'''                                                                         °
  530.   '''process of multiplication by hand. You may use the following scheme       °
  531.  :''' 'do'                                                                     °
  532.   '''Place your left index finger on the first element of the first row'       °
  533.  ''                                                                            °
  534.   '''of the left argument, and your right index finger on the first elem       °
  535.  ent'''                                                                        °
  536.   '''of the first column on the right argument. Then as you move your le       °
  537.  ft'''                                                                         °
  538.   '''finger to the right, you move your right finger down, proceed to'''       °
  539.   '''cumulate the sum +/left⌡right. The sum is then placed in row 1,'''        °
  540.   '''column 1 of the resulting array. Next you return your left finger''       °
  541.  '                                                                             °
  542.   '''back to column 1 (of the same row), and place your right finger to'       °
  543.  ''                                                                            °
  544.   '''row 1 of column 2. Proceed as before, and place the sum in row 1'''       °
  545.   '''column 2 of the result. Continue this process until all columns of'       °
  546.  ''                                                                            °
  547.   '''the right argument have been evaluated. Then move your left finger'       °
  548.  ''                                                                            °
  549.   '''to the second row of the left argument, and repeat the procedure'''       °
  550.   '''to evaluate the second row of the result.''' 'do'                         °
  551.   '''If you have never done this, you should try it at least once. Get a       °
  552.  '''                                                                           °
  553.   '''piece of paper, and copy the values of A and B. Then use your index       °
  554.  ''' '''fingers to produce the result of A+.⌡B''' 'do'                         °
  555.   '''Once you have developed the technique, try to apply it to expressio       °
  556.  ns'''                                                                         °
  557.   '''with a different set of scalar functions. Since both A and B are'''       °
  558.   '''boolean, you can evaluate'',r' 'show ''Aδ.^B'' ''Bδ.^A'''                 °
  559.   '''Indeed, you should try other scalar functions'',r'                        °
  560.   'show ''A⌐.╛B'' ''B╛.⌐A'' ''A+.-B'' ''A-.+B'''                               °
  561.   '''Now let us recall binding rules'',r' 'BIND'                               °
  562.   '''We are now in a position to see how binding rule 3 works'',r'             °
  563.   'show ''+.⌡/A B'''                                                           °
  564.   '''By binding rule 3, the ⌡ is bound to the . operator. Then, by bindi       °
  565.  ng'''                                                                         °
  566.   '''rule 4, A and B are bound as a single vector. With binding rule 5 t       °
  567.  he'''                                                                         °
  568.   '''sub-expression +.⌡ becomes a compound function that is applied to''       °
  569.  '                                                                             °
  570.   '''the elements of the vector to the right of the reduction operator.'       °
  571.  '' '''To see that this usage is general consider'',r'                         °
  572.   'show ''C╜3 3µ1 0 1 0 0'' ''C'' ''+.⌡/C C'' ''+.⌡/C C C'' ''+.⌡/C C C        °
  573. XC''' 'endd'                                                                   °
  574. *(1996 4 6 16 4 50 384)                                                        °
  575.  FUNIT ÉFX 'u╜UNIT w;t;b' 'ΣDD' 'b╜(t╜w=1)/''u╜1''' '╕(t doif b)/0'            °
  576. X 'u╜(w,w)µ1,wµ0'                                                              °
  577. XNV 1 2 4 3                                                                    °
  578. *(1997 7 13 12 28 49 504)                                                      °
  579.  Faddquote ÉFX 'u╜addquote w'                                                  °
  580.   'Σ Put quotes around a string, and double existing quotes'                   °
  581. X 'u╜ÉAV[40],((1+w=ÉAV[40])/w),ÉAV[40]'                                        °
  582. *(1997 7 24 13 20 38 476)                                                      °
  583.  Fav ÉFX 'av;A;N;I;ÉIO' 'Σ Display characters in ÉAV' 'ÉIO╜0'                  °
  584.   'A╜22 78µ'' ''' 'N╜3 0«φ12 22µ1+∞356' 'A[;,(6⌡∞12)°.+2 3 4]╜N'               °
  585.   'A[;6+6⌡∞12]╜φ12 22µÉAV' 'ΣA[8 10 13;6]╜'' ''' 'A[13;6]╜'' '''               °
  586. X 'A[14+∞8;68 69 70 72]╜'' ''' 'A'                                             °
  587. *(1991 11 11 8 25 13 316)                                                      °
  588.  Fdate ÉFX 'u╜date w' 'Σ Format date and time of day' 'u╜«6╞w'                 °
  589. X 'u╜('' ''⌠u)Γu' 'u╜εu,■''-- .. '''                                           °
  590. XCdig 1 10 1234567890                                                          °
  591. *(1997 9 9 13 0 45 372)                                                        °
  592.  Fdisclaimer ÉFX 'disclaimer' 'Σ Copyright statement'                          °
  593.   '(10µ'' ''),''Copyright, Z. V. Jizba, 1995,1996,1997'',r'                    °
  594.   ''' This and subsequent workspaces labelled TEACHxx are made available       °
  595.  '''                                                                           °
  596.   '''at no cost to anyone who desires to learn how to use effectively'''       °
  597.   '''the IBM/OS2 version of APL2.'',r'                                         °
  598.   '''This software is provided "AS IS" with no WARRANTY of any kind, eit       °
  599.  her'''                                                                        °
  600.   '''express or implied. Any risk in its use resides with you, the user        °
  601.  of''' '''these tutorials.'',r' '''     ACKNOWLEDGEMENTS'',r'                  °
  602.   ''' In writing these tutorials, I am greatly indebted to Roy Sykes, wh       °
  603.  ose'''                                                                        °
  604.   '''excellent lectures increased my understanding of the language.'''         °
  605.   '''Discussions with the late Harry Bertucelli clarified a number of'''       °
  606.   '''concepts and caused me to change some improper terminology that was       °
  607.  '''                                                                           °
  608.   '''used in previous versions of these tutorials. Mr. Benjamin Archer''       °
  609.  '                                                                             °
  610.   '''kindly checked out a nearly final version, bringing to my attention       °
  611.  ''' '''some ommisions, misspellings, and invalid terminology.'',r'            °
  612. X '''(PRESS ENTER to continue)'''                                              °
  613. *(1997 7 13 12 28 50 508)                                                      °
  614.  Fdo ÉFX 'do;T;E' 'Σ Expression driver' 'E╜''''' 'æ╜''      ''' 'T╜æ'          °
  615.   '╕(^/'' ''=T)/0'                                                             °
  616.   '╕(('':''εT)doif ''B╜evaldd (+/^\'''' ''''=T)╟T'')/2'                        °
  617.   '''E╜ÉEM'' ÉEA T' '╕(0=µ,E)/2'                                               °
  618.   '''This is not a valid APL2 expression''' 'æ╜''*''' '╕(''?''⌠╞1╟æ)/2'        °
  619. X 'E' '╕2'                                                                     °
  620. *(1997 7 13 12 28 50 508)                                                      °
  621.  Fdoif ÉFX 'U╢╜V╢ doif W╢;t╢' 'Σ Rule' '╕(^/~U╢╜V╢)/0'                         °
  622. X '''U╢╜V╢ doif■ W╢'' ÉEA ''»V╢/W╢'''                                          °
  623. *(1997 9 9 12 50 14 444)                                                       °
  624.  Fendd ÉFX 'endd' 'Σ end of special feature' '20µ''²'' ╪ ╕(4<µÉLC)/0'          °
  625. X 'do'                                                                         °
  626. *(1997 8 16 11 56 54 648)                                                      °
  627.  Ferase ÉFX                                                                    °
  628.   'erase;t;EXIT;GO;HELP;DISPLAY;REVIEW;RULE;BIND;LINEAR;MATRIX;UNIT;DISC       °
  629.  LAIMER' 'Σ Erase all global functions and variables' 't╜ÉNL 3'                °
  630.   't╜(~t^.εlc,'' '')≡t' 't╜ÉEX(~t[;∞5]^.=''TEACH'')≡t' 't╜ÉNL 2'               °
  631. X 't╜ÉEX(~t^.εlc,'' '')≡t'                                                     °
  632. *(1997 7 27 13 47 41 608)                                                      °
  633.  Fevaldd ÉFX 'u╜evaldd w;c;n' 'Σ Evaluate direct definition' 'u╜0'             °
  634.   'n╜(w∞''Σ'')-1' 'c╜(((n╞w)⌠'':'')Γn╞w),Γ''ΣDD '',(n+1)╟w'                    °
  635.   '╕((1 label╞c)doif ''''''Invalid label'''''')/0'                             °
  636.   '╕((2=µc)doif ''u╜showdd 1╙c'')/0'                                           °
  637.   '╕((3=ÉNC╞c)doif ''u╜⌡µÉ╜(╞c),'''' is already defined.'''''')/0'             °
  638.   '╕((3=µc)doif ''u╜simdd c'')/0' 'c╜(Γ''α∙ aw'')replace■c'                    °
  639.   'u╜ε''u╜'',((''a''εεc[2 3 4])/''a ''),(╞c),'' w;t;b'''                       °
  640.   'u╜u(5πc)(''b╜(t╜'',(3πc),'')/'',addquote ''u╜'',4πc)'                       °
  641. X 'u╜u,''╕(t doif b)/0''(''u╜'',2πc)' 'u╜╧ÉFX u'                               °
  642. *(1997 7 25 13 27 52 564)                                                      °
  643.  Fexit ÉFX 'V exit W;T' 'Σ Exit if too many suspended functions'               °
  644.   '╕(0⌠ÉNC ''V'')/L0 ╪ V╜10' 'L0:╕(V>µÉLC)/0'                                  °
  645.   '''There are too many suspended functions''' '''Please enter '',W'           °
  646. X '╕'                                                                          °
  647. *(1997 7 26 12 33 39 536)                                                      °
  648.  Fget ÉFX 'U╜V get W;t;T;ÉPR' 'Σ Prompt for response from keyboard'            °
  649.   'ÉPR╜T╜ÉAV[ÉIO+255] ╪ ╕(0⌠ÉNC ''V'')/L0 ╪ V╜1' 'L0:V╜V╧1' 'æ╜W ╪ t╜æ'        °
  650.   'U╜(+/^\t=T)╟t' '╕(''╕''⌠╞U)/L1 ╪ ╕' 'L1:╕V/0' 't╜(U⌠'' '')ΓU'               °
  651. X 'U╜(µt),(ΓU),t'                                                              °
  652. *(1997 7 28 13 33 8 424)                                                       °
  653.  Fglobals ÉFX 'globals' 'Σ Initialize useful global variables'                 °
  654.   'uc╜''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''                                          °
  655.   'lc╜''abcdefghijklmnopqrstuvwxyz''' 'dig╜''1234567890'''                     °
  656. X 'r╜ÉAV[13+ÉIO]' 'q╜'''''''''                                                 °
  657. *(1997 7 3 12 47 6 368)                                                        °
  658.  Finitialize ÉFX 'initialize;T' 'Σ Initialize workspace'                       °
  659.   '''AT ALL TIMES, TO CONTINUE, PRESS RETURN!'',r'                             °
  660.   '''To see disclaimers enter:'',r,''    disclaimer''' 'do' 'erase'            °
  661.   'globals'                                                                    °
  662.   '''Make sure the CAP LOCK light on your keyboard (upper right) is ON!'       °
  663. X'' 'endd'                                                                     °
  664. *(1997 7 27 13 14 33 444)                                                      °
  665.  Flabel ÉFX 'u╜v label w'                                                      °
  666.   'Σ Return 1 if label w does not begin with a cap'                            °
  667.   '╕(0⌠ÉNC ''v'')/L0 ╪ v╜0' 'L0:v╜v╧1 ╪ w╜εw ╪ ╕v/L1 ╪ ╕(u╜0⌠ÉNC w)/0'         °
  668. X 'L1:╕(u╜~^/wεlc,uc,dig)/0' 'u╜w[1]εlc,dig'                                   °
  669. XClc 1 26 abcdefghijklmnopqrstuvwxyz                                           °
  670. *(1997 7 13 12 28 55 528)                                                      °
  671.  Fnon ÉFX 'non;T;RC;ET;R' 'Σ Ignore keyboard entry' 'æ╜''      ''' 'T╜æ'       °
  672.   '╕(0=µ(T⌠'' '')/T)/0' '(RC ET R)╜ÉEC T' '╕(0=RC)/2'                          °
  673. X '╕((1=RC)doif ''R'')/2' '╕2'                                                 °
  674. *(1997 7 13 12 28 55 528)                                                      °
  675.  Fnotb ÉFX 'u╜notb w' 'Σ Remove trailing blanks'                               °
  676.   '╕((1<╧w)doif ''u╜notb■ w'')/0' '╕((1<µµw)doif ''u╜πnotb Γ[2]w'')/0'         °
  677. X 'u╜(1-(,'' ''⌠Φw)∞1)╟w'                                                      °
  678. *(1997 7 27 12 55 6 496)                                                       °
  679.  Fproblems ÉFX 'problems' 'Σ Problems'                                         °
  680.   '''That is all for this lesson. Remember, if you want to practice,'''        °
  681.   '''and plan to use direct definitions, be sure to first enter GO.'''         °
  682.   '''Direct definitions will then be accepted. To exit GO, enter EXIT.''       °
  683.  ,r'                                                                           °
  684.   '''To erase a previously defined DIRECT DEFINITION FUNCTION, enter'',r       °
  685.  ' '''       )ERASE functionname'',r'                                          °
  686. X '''WARNING! do not use )ERASE on other labels.'',r'                          °
  687. XCq 0 '                                                                        °
  688. XCr 0                                                                         °
  689. *(1997 7 13 12 28 56 532)                                                      °
  690.  Freplace ÉFX 'u╜v replace u;i;r;s' 'Σ Replace elements in v in u'             °
  691.   'i╜Γ∞µu' 's╜2πv╜(v⌠'' '')Γv' 'i╜⌡r╜i⌡■Γ[1]u°.=╞v'                            °
  692. X 'u[(εi)/εr]╜s[(εi)/εi⌡■∞µs]'                                                 °
  693. *(1997 7 13 12 28 56 532)                                                      °
  694.  Fround ÉFX 'U╜V round W' 'Σ Half adjust to V th decimal'                      °
  695. X 'U╜(╛0.5+W⌡10*V)÷10*V'                                                       °
  696. *(1997 7 13 12 28 57 536)                                                      °
  697.  Fshow ÉFX '╢V show ╢W;╢T;╢B' 'Σ Display and execute ╢W'                       °
  698.   '╢T╜(0=ÉNC ''╢V'')doif ''╢V╜0'''                                             °
  699.   '╕((0=╧╢W)doif ''show ╢W,'''' '''''')/0'                                     °
  700.   '╕((1<╧╢W)doif ''╢V show ■╢W'')/0' '''      '',╢W'                           °
  701. X '╕((╢V^'':''ε╢W)doif ''╢T╜evaldd ╢W'')/L0' '''ÉEM'' ÉEA ╢W' 'L0:do'          °
  702. *(1997 7 13 12 28 57 536)                                                      °
  703.  Fshowdd ÉFX 'u╜showdd w;a;b;c;r'                                              °
  704.   'Σ Display a direct definition function'                                     °
  705.   '╕((1=╧w)doif ''u╜showdd Γw'')/u╜0'                                          °
  706.   '╕((3⌠ÉNC╞w)doif ''(ε╞w),'''' is not a function'''''')/0'                    °
  707.   'c╜Γ[2]ÉCR╞w' 'c╜notb(2╞c),(Γ''aw α∙'')replace■2╟c'                          °
  708.   '╕((~''ΣDD''╧3╞2πc)doif ''''''Not a direct definition function'''''')/       °
  709.  0' 'u╜1' 'b╜('' ''⌠╞c)Γ╞c' 'a╜''      ''' 'r╜2╟3πc'                           °
  710.   '╕((3=µc)doif ''a,(╞w),'''':'''',r,(3<µ2πc)/''''   Σ'''',3╟2πc'')/0'         °
  711.   'a╜a,(╞w),'':'',(2╟5πc),'':''' 'b╜(+\r=''('')-+\r='')''' 'b╜b∞0'             °
  712. X 'a╜a,(²3╟(b-1)╞3╟r),'':'',2╟»(b+2)╟r' 'a,(3<µ2πc)/''  Σ'',3╟2πc'             °
  713. *(1997 7 13 12 28 57 536)                                                      °
  714.  Fshowfn ÉFX 'U╜V showfn W;F;N;T;ÉIO' 'Σ Simulate ╖W[É]'                       °
  715.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'ÉIO╜0'                                        °
  716.   'U╜r,''      '',''╖'',W,''[É]'',(╞V)╞''╖''' 'N╜1╞µF╜ÉCR W' 'N╜«∞N'           °
  717.   'N╜(N⌠'' '')ΓN' 'F╜(π''['',■N,■Γ''] ''),F'                                   °
  718.   'T╜(1<µ,V)doif ''F╜F[1╟V;]'' ''U╜''''''''''' 'U╜²1╟U,r,,F,r'                 °
  719. X 'U╜((-+/^\'' ''=ΦU)╟U),('' ╖'')[╞V],r'                                       °
  720. *(1997 7 13 12 28 58 540)                                                      °
  721.  Fsimdd ÉFX 'u╜simdd w;e' 'Σ Direct definition mode' 'u╜0'                     °
  722.   '╕((0⌠ÉNC╞w)doif ''''''Already defined'''''')/0' 'e╜''α''ε2πw'               °
  723.   'w[2]╜Γ''u╜'',''α∙ aw'' replace 2πw' 'w╜w[1 3 2]'                            °
  724. X 'w[1]╜Γε''u╜'',(e/''a ''),w[1],'' w''' 'u╜╧ÉFX w'                            °
  725. *(1992 6 3 9 59 17 424)                                                        °
  726.  Ftab ÉFX 'U╜V tab W;T;A;B;C;D;E;F;G;M;ÉPW' 'Σ Tabulate list W'                °
  727.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'M╜''Invalid data for tabulation'''            °
  728.   'V╜4╞V' 'ÉPW╜130╛30⌐G╜V[2]+79⌡V[2]=0'                                        °
  729.   'L1:╕((1<╧W)doif ''''''W╜∞0'''' ÉEA ''''W╜πW'''''')/L1'                      °
  730.   '╕(((0=µεW)δ2<µµW)doif ''U╜(~V╧4╞0)/M'')/0'                                  °
  731.   'T╜(1≥µµU╜«W)doif ''U╜πW╜(U⌠'''' '''')ΓU'''                                  °
  732.   'T╜(0<V[1])doif ''U╜(«(Φ1,╞µW)µ(V[3]µ'''' ''''),∞(╞µW)-V[3]),'''' ''''       °
  733.  ,U''' '╕(G<30)/0' 'T╜(F╜µεV[4])+C╜1╟B╜µA╜(V[3],0)╟U'                          °
  734.   'T╜⌐(1╞B)÷1⌐╛(ÉPW+F)÷T' 'U╜(E╜(V[3],C)╞U),[1](B╜T,1╟B)╞A'                    °
  735.   '''D╜εV[4]'' ÉEA ''D╜ÉAV[εV[4]+33⌡V[4]=0]''' 'L0:A╜(T,0)╟A'                  °
  736. X '╕(0=1╞µA)/0' 'U╜U,(((T+V[3]),µD)µD),E,[1]B╞A' '╕L0'                         °
  737. *(1997 7 13 12 28 59 544)                                                      °
  738.  Ftest ÉFX 'U╜V test W;P'                                                      °
  739.   'Σ Describe problem in W, (correct answer in V)' 'U╜2' 'L1:W'                °
  740.   'É╜''      ''' 'P╜æ' '''╕L0'' ÉEA ''P╜»P''' '╕(V╧P)/0'                       °
  741. X 'L0:╕(0=U╜U-1)/0' '''Incorrect. Try again''' '╕L1'                           °
  742. XCuc 1 26 ABCDEFGHIJKLMNOPQRSTUVWXYZ                                           °
  743. *(1996 4 6 16 4 50 384)                                                        °
  744.  Fvec ÉFX 'U╜vec' 'Σ Draw 2d vector in plane'                                  °
  745.   'U╜r,r,''2-        +'',r '':      °'',r,''1-    °'',r'                       °
  746. X 'U╜U,'' :  °'',r,''0|....|....|'',r,'' 0    1    2'',r'                      °
  747.