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

  1. XNÉIO 0 1                                                                      °
  2. XNÉCT 0 1E²13                                                                  °
  3. XCÉFC 1 6 .,*0_²                                                               °
  4. XNÉRL 0 16807                                                                  °
  5. XCÉPR 1 1                                                                      °
  6. XCÉLX 1 5 TEACH                                                                °
  7. *(1996 4 6 16 10 36 352)                                                       °
  8.  FBIND ÉFX 'BIND' 'Σ Binding rules of APL2'                                    °
  9.   '''  1. Brackets bind to the left'''                                         °
  10.   '''  2. Left arrow binds to the left'''                                      °
  11.   '''  3. Dyadic operator binds to the right'''                                °
  12.   '''  4. Strand notation binding'''                                           °
  13.   '''  5. Operator binds to its left'''                                        °
  14.   '''  6. Function binds to its left'''                                        °
  15.   '''  7. Function binds to its right'''                                       °
  16. X '''  8. Left arrow binds to its right'',r'                                   °
  17. *(1997 9 14 12 30 44 504)                                                      °
  18. XFDISCLAIMER ÉFX 'DISCLAIMER' 'Σ Copyright statement' 'disclaimer'             °
  19. *(1996 4 6 16 10 36 352)                                                       °
  20.  FDISPLAY ÉFX 'D╜S DISPLAY A;ÉIO;R;C;HL;HC;HT;HB;VL;VB;V;W;N;B'                °
  21.   'Σ DISPLAY A GENERAL ARRAY IN PICTORIAL FORM'                                °
  22.   'Σ  NORMAL CALL IS MONADIC.  DYADIC CALL USED ONLY IN'                       °
  23.   'Σ    RECURSION TO SPECIFY DISPLAY RANK, SHAPE, AND DEPTH.' 'ÉIO╜0'          °
  24.   '»(0=ÉNC ''S'')/''S╜µA''' 'R╜╞µ,S                   Σ PSEUDO RANK.'          °
  25.   'C╜''┐┌└┘''                 Σ UR, UL, LL, AND LR CORNERS.'                   °
  26.   'HL╜''─''                   Σ HORIZONTAL LINE.'                              °
  27.   'HC╜HL,''Θ╕'',HL,''~+ε''      Σ HORIZONTAL BORDERS.'                         °
  28.   'HT╜HC[(0<R)⌡1+0<╞²1╞,S]' 'ΣW╜,0╧■╞0µΓ(1⌐µA)╞A'                              °
  29.   'HB╜HC[3+3╛(''2⌡~A╧«A'' ÉEA ''1+╞ε0⌡(1⌐⌡/µA)╞,A'')+3⌡1<µµS]'                 °
  30.   'VL╜''│''                   Σ VERTICAL LINE.'                                °
  31.   'VB╜VL,''Φ╟''               Σ VERTICAL BORDER.'                              °
  32.   'V╜VB[(1<R)⌡1+0<²1╞²1╟,S]'                                                   °
  33.   '»(0εµA)/''A╜(1⌐µA)µΓ╞A''   Σ SHOW PROTOTYPE OF EMPTIES.'                    °
  34.   '╕(1<╧A)/GEN' '╕(2<µµA)/D3'                                                  °
  35.   'D╜«A                     Σ SIMPLE ARRAYS.' 'W╜1╞µD╜(²2╞1 1,µD)µD'           °
  36.   'N╜²1+1╟µD' '╕(0=µµA)/SS'                                                    °
  37.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  38.  3]' '╕0' 'SS:HB╜((0 '' '')=╞0µΓA)/'' -'''                                     °
  39.   'D╜'' '',('' '',[0]D,[0]HB,Nµ'' ''),'' ''' '╕0'                              °
  40.   'GEN:D╜«DISPLAY■A          Σ ENCLOSED ...' 'N╜Dδ.⌠'' '''                     °
  41.   'D╜(Nδ~1ΦN)≡D' 'D╜(δ≡~''  ''╤D)/D' 'D╜((1,µS)µS)DISPLAY D'                   °
  42.   '╕(2≥µ,S)╟D3E,0' 'D3:D╜0 ²1╟0 1╟«ΓA         Σ MULT-DIMENSIONAL ...'          °
  43.   'W╜1╞µD' 'N╜²1+1╟µD'                                                         °
  44.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  45.  3]' 'D3E:N╜²2+µ,S'                                                            °
  46. X 'V╜C[Nµ1],[0]VB[1+0<²2╟,S],[0](((²3+╞µD),N)µVL),[0]C[Nµ2]' 'D╜V,D'           °
  47. *(1996 4 6 16 10 36 352)                                                       °
  48.  FEXIT ÉFX 'EXIT' 'Σ Exit from function' '''To log off type:   )OFF'''         °
  49. X '╕'                                                                          °
  50. *(1996 4 6 16 10 36 352)                                                       °
  51.  FGO ÉFX 'GO;T;E;B' 'Σ Expression driver' 'L0:B╜E╜''''' 'æ╜''      '''         °
  52.   'T╜æ' '╕(^/'' ''=T)/L0' '╕((^/'')OFF ''=5╞6╟T)doif ''EXIT'')/0'              °
  53.   '╕(('':''εT)doif ''B╜evaldd (+/^\'''' ''''=T)╟T'')/L0'                       °
  54.   '''E╜ÉEM'' ÉEA T' '╕(0=µ,E)/L0' '╕B/L0'                                      °
  55.   '''This is not a valid APL2 expression''' 'æ╜''*'''                          °
  56. X '╕(''?''⌠╞1╟æ)/L0' 'E' '╕L0'                                                 °
  57. *(1997 8 19 11 38 4 388)                                                       °
  58.  FHELP ÉFX 'HELP;N;I;T' 'Σ Help to student' '''WHAT TO DO'',r'                 °
  59.   '''  ° To get out of the lesson''' '''       ENTER: EXIT'''                  °
  60.   '''  ° To log off APL2'''                                                    °
  61.   '''       FIRST, ENTER: EXIT  THEN ENTER: )OFF'''                            °
  62.   '''  ° To get help''' '''       ENTER: HELP'''                               °
  63.   '''  ° When you see the cursor on a blank line'''                            °
  64.   '''       ENTER AN APL2 EXPRESSION - OR JUST PRESS: ENTER''' 'do'            °
  65.   '''  ° If you get this line'',r'                                             °
  66.   '''This is not a valid APL2 expression'',r,''*'',r'                          °
  67.   '''        YOU CAN EITHER''' '''           A. PRESS: ENTER'''                °
  68.   '''           B. PRESS: ? and then ENTER to see what was incorrect'''        °
  69.   '''              in your expression causing that response'',r' 'do'          °
  70.   '''HINTS'',r'                                                                °
  71.   '''This lesson is made up of '',(«N╜6),'' components named TEACHx, whe       °
  72.  re''' '''the x stands for a digit:'',r' 'I╜0'                                 °
  73.   'L0:T╜''TEACH'',(«I╜I+1)' 'T,'' '',1╟notb(ÉCR T)[2;]' '╕(N>I)/L0'            °
  74.   'do'                                                                         °
  75.   '''You may review either of these components separately. To do that,''       °
  76.  '                                                                             °
  77.   '''first enter EXIT (and RETURN), then enter the name of the lesson.''       °
  78.  ' '''component (e.g. TEACH4).'',r'                                            °
  79.   '''To re-start the lesson, just enter TEACH'',r'                             °
  80.   '''When the screen fills up, it is a good idea to move the cursor to''       °
  81.  ' '''the start of a convenient paragraph, and press ENTER'',r'                °
  82.   '''You may also wish to press PAGE UP to review the prevous pages.'''        °
  83.   'do' '''RESOURCES'',r'                                                       °
  84.   '''You may also enter ONE of the following words at a time'',r'              °
  85.   '''REVIEW    Review the previous lesson'''                                   °
  86. X '''V TIME W  Measure execution time of W evaluated V times''' 'endd'         °
  87. *(1997 8 19 11 40 23 472)                                                      °
  88. XFPASCAL ÉFX 'u╜PASCAL w' 'ΣDD' 'u╜(0,∞w)!w'                                   °
  89. XNRATES 1 6 0.04 0.05 0.06 0.07000000000000001 0.08 0.09                       °
  90. *(1997 7 18 13 38 26 476)                                                      °
  91.  FTEACH ÉFX 'TEACH' 'Σ Start lesson #19: APL2 by Zdenek V JIZBA'               °
  92.   'exit ''TEACH''' 'initialize'                                                °
  93.   'TEACH1 Σ Inconsistencies in mathematical notation'                          °
  94.   'TEACH2 Σ Simple and compound interest'                                      °
  95.   'TEACH3 Σ Abacus, multiplication, division and logarithms'                   °
  96.   'TEACH4 Σ Calculating compound interest rate'                                °
  97.   'TEACH5 Σ Pascal''s triangle' 'TEACH6 Σ Binomial coefficients'               °
  98. X 'problems'                                                                   °
  99. *(1997 7 18 13 17 58 520)                                                      °
  100.  FTEACH1 ÉFX 'TEACH1' 'Σ APL2 and mathematics'                                 °
  101.   '''       APL2 AND MATHEMATICS'',r'                                          °
  102.   '''In previous lessons we learned how to use APL2 to solve a variety o       °
  103.  f'''                                                                          °
  104.   '''fairly simple problems. Some of the problems were of a mathematical       °
  105.  ''' '''nature, but many were not. Ken Iverson, a mathematician, was'''        °
  106.   '''primarily interested in establishing a discipline of mathematical''       °
  107.  ' '''notation, when he invented the forerunner of APL2.'',r'                  °
  108.   '''In this and in the next three lessons we will learn more about the'       °
  109.  ''                                                                            °
  110.   '''mathematics of APL2. Even if you do not have extensive mathematical       °
  111.  '''                                                                           °
  112.   '''background, these lessons are well worth a careful study. We will t       °
  113.  ry'''                                                                         °
  114.   '''to present the material in as simple and straight forward way as'''       °
  115.   '''possible. Even then, there may be some portions of the text that yo       °
  116.  u'''                                                                          °
  117.   '''might find difficult to follow. Please do not be discouraged. In th       °
  118.  e'''                                                                          °
  119.   '''long run, your efforts at understanding will eventually be rewarded       °
  120.  .''' 'do'                                                                     °
  121.   '''We begin by reviewing the power function that we studied in lesson        °
  122.  3.'''                                                                         °
  123.   '''Recall that the primitive power function is defined by an asterisk        °
  124.  (*).'''                                                                       °
  125.   '''Why should APL2 use a new symbol, one not taught in algebra?'',r'         °
  126.   '''There are two answers to this question.  The simple answer is that        °
  127.  in'''                                                                         °
  128.   '''the mathematics classroom, power is usually defined by placing the'       °
  129.  ''                                                                            °
  130.   '''"exponent" in the upper right hand corner of the number.  Since'''        °
  131.   '''most computer implementations do not support these "superscripts",'       °
  132.  '' '''another solution had to be found.'',r'                                  °
  133.   '''There is yet another, more fundamental reason.  Most mathematical''       °
  134.  '                                                                             °
  135.   '''notation has evolved without much regard to internal consistency.''       °
  136.  '                                                                             °
  137.   '''Usually, when a mathematician first used a particular symbol to'''        °
  138.   '''define a concept, that symbol tended to be accepted by the math'''        °
  139.   '''community.  Because of such historical accidents, some primitive'''       °
  140.   '''functions are defined by special symbols to the right of the'''           °
  141.   '''argument (a!), some to the left (~B), some on both sides (|A|),'''        °
  142.   '''and some, such as power by the placement of one of the arguments.''       °
  143.  ' 'do'                                                                        °
  144.   '''When Ken Iverson was defining APL, he felt strongly that mathematic       °
  145.  al'''                                                                         °
  146.   '''notation should be consistent.  If a function has only one argument       °
  147.  ,'''                                                                          °
  148.   '''it''''s symbol should precede the argument.  If a function has two'       °
  149.  ''                                                                            °
  150.   '''arguments, it''''s symbol should be placed between the arguments.         °
  151.  Since'''                                                                      °
  152.   '''the power function is not represented by a symbol, but rather is'''       °
  153.   '''defined by position, he felt a symbol had to be invented.'',r'            °
  154.   'show ''5*2'''                                                               °
  155.   '''The expression 5*2 is therefore equivalent to the more familiar'''        °
  156.   '''notation we learn in school, where the 5 is followed by a smaller''       °
  157.  '                                                                             °
  158.   '''superscript 2. To make things even more confusing, this is by no'''       °
  159.   '''means a universally accepted notation. In some programming language       °
  160.  s'''                                                                          °
  161.   '''the * stands for the multiplication symbol. The power symbol may'''       °
  162.   '''be represented by **, by ╞ or even by other symbols.''' 'do'              °
  163.   '''(In this and subsequent lessons we may find it useful to fall back'       °
  164.  '' '''to more "conventional" algebraic notation. However, lacking'''          °
  165.   '''superscripts, we may represent the power of X as an implicit produc       °
  166.  t.'''                                                                         °
  167.   '''For example XX will represent X square and XXX will stand for X*3.)       °
  168. X''' 'endd'                                                                    °
  169. *(1997 7 18 13 21 32 432)                                                      °
  170.  FTEACH2 ÉFX 'TEACH2' 'Σ Compound interest' 'a╜ÉAV[38]'                        °
  171.   '''SIMPLE AND COMPOUND INTEREST'',r'                                         °
  172.   '''One of the most common applications of the power function in modern       °
  173.  '''                                                                           °
  174.   '''society is in the calculation of interest. Money lending is an'''         °
  175.   '''occupation that has been around since ancient times. If person A'''       °
  176.   '''needs money, person B will lend it, but after some period of time,'       °
  177.  ''                                                                            °
  178.   '''B will demand back not only the amount that was borrowed, but also'       °
  179.  '' '''some extra quantity for the favor.'',r'                                 °
  180.   '''The rate of change per unit time is called INTEREST, and is usually       °
  181.  ''' '''described as PERCENT. This word "percent" derives from latin'''        °
  182.   '''meaning a change for every 100. The expression 5'',a,'' means that        °
  183.  for'''                                                                        °
  184.   '''every 100 units, also called the PRINCIPAL, there is a change of 5'       °
  185.  ''                                                                            °
  186.   '''units of INTEREST. The calculation can be simplified if we divide''       °
  187.  '                                                                             °
  188.   '''the 5 by 100, and then use the value of 0.05 as the RATE of change.       °
  189.  ''' '''We can express this formula as an equation'',r'                        °
  190.   'pause ''(PRINCIPAL + INTEREST) = PRINCIPAL ⌡ (1 + RATE)'''                  °
  191.   '''In this way, if we invest 134 dollars at 5'',a,'' in SIMPLE interes       °
  192.  t,''' '''then at the end of the year we will have'',r'                        °
  193.   'show ''134⌡1.05'''                                                          °
  194.   '''If we keep the amount at the same rate for two years, then we will'       °
  195.  '' '''end up with'',r' 'show ''(134⌡1.05)⌡1.05'''                             °
  196.   '''Of course this is the same as'',r' 'show ''134⌡1.05*2'''                  °
  197.   '''We can always recover the amount of simple interest from this'''          °
  198.   '''formula'',r'                                                              °
  199.   'pause ''(PRINCIPAL+INTEREST)=PRINCIPAL⌡(1+RATE)*TIME'''                     °
  200.   '''By dividing both sides by PRINCIPAL, and by taking the root 1÷TIME'       °
  201.  '' '''we can recover the simple interest'',r'                                 °
  202.   'show ''(147.735÷134)*÷2'''                                                  °
  203.   '''The next question one might ask, is how much will we have after one       °
  204.  ''' '''year and six months?''' 'do' 'show ''134⌡1.05*1.5'''                   °
  205.   '''With APL2 this calculation is done easily, but before we had such''       °
  206.  '                                                                             °
  207.   '''powerful computers, it would have been quite difficult to calculate       °
  208.  '''                                                                           °
  209.   '''1.05 raised to the power 1.5. The computation would be even more'''       °
  210.   '''difficult if we credited the interest every day. This process is ca       °
  211.  lled'''                                                                       °
  212.   '''COMPOUNDING. COMPOUND INTEREST is now a very common form of money''       °
  213.  '                                                                             °
  214.   '''lending. If you put your money in a money market fund, the interest       °
  215.  '''                                                                           °
  216.   '''may be credited to you every day. Supposing a year has 356 days,'''       °
  217.   '''then your daily interest will be'',r' 'show ''0.05÷356'''                 °
  218.   '''Therefore this calculation wil be done 356 times in a year'',r'           °
  219.   'show ''134⌡(1+0.05÷356)*356'''                                              °
  220.   '''By this compounding, instead of earning 140.7, you get 140.87.'''         °
  221.   '''So compound interest gives you a somewhat greater return than the''       °
  222.  '                                                                             °
  223.   '''NOMINAL interest rate. How can we find out what is the EFFECTIVE'''       °
  224.   '''simple interest rate that would produce 140.87 in one year?'',r'          °
  225.   'show ''140.8698323÷134'''                                                   °
  226.   '''Now you try to calculate the SIMPLE interest, given that after'''         °
  227. X '''356 days compounded daily, 134 dollars grew to 140.87!''' 'endd'          °
  228. *(1997 7 18 13 25 11 364)                                                      °
  229.  FTEACH3 ÉFX 'TEACH3' 'Σ Invention of logarithms'                              °
  230.   '''       LOGARITHMS'',r'                                                    °
  231.   '''In ancient times knowhow about multiplication of large numbers'''         °
  232.   '''was very rare. (Try to multiply the Roman CXVII times XXIV!)'''           °
  233.   '''Even with the invention of the arabic numerals, the process is'''         °
  234.   '''time consuming'',r' '''         4279''' '''        ⌡5167'''               °
  235.   '''       ²²²²²²''' '0 1 2 3Φ13 0«4 1µ4279°.⌡7 6 1 5'                        °
  236.   '''  ²²²²²²²²²²²''' '13 0«4279⌡5167' 'do'                                    °
  237.   '''A long division such as 4279÷5167 would have been even more difficu       °
  238.  lt.'''                                                                        °
  239.   '''Actually the ancients were quite ingenious. They solved these probl       °
  240.  ems'''                                                                        °
  241.   '''at least partially by inventing a variety of mechanical devices. Ma       °
  242.  ny'''                                                                         °
  243.   '''ancient civilizations seemed to have been familiar with such device       °
  244.  s.'''                                                                         °
  245.   '''A form of ABACUS has been used by millenia, as attested by the word       °
  246.  s'''                                                                          °
  247.   '''in many languages describing this device: the Turkish COULBA, the''       °
  248.  '                                                                             °
  249.   '''Armenian CHOREB, the Chinese SUAN-PAN, the Japanese SOROBAN, the'''       °
  250.   '''Russian SCHOTY, and many others. Even the South American Incas used       °
  251.  ''' '''a like device with grains of corn (or wheat) as the beads.'',r'        °
  252.   '''An early form of the ABACUS was also used by the Greeks and by the'       °
  253.  ''                                                                            °
  254.   '''Romans. It was a piece of slate (or even bronze) with grooves. The'       °
  255.  ''                                                                            °
  256.   '''beads, called CALCULI were used as counters. The word itself comes'       °
  257.  '' '''from "calc" meaning a pebble of limestone. Today, when we use'''        °
  258.   '''the word "calculation" (or calculus) we are no longer aware that'''       °
  259.   '''these words date back to days when people used limestone pebbles'''       °
  260.   '''to do their taxes.''' 'do'                                                °
  261.   '''In 1642 Blaise Pascal invented a mechanical device composed of whee       °
  262.  ls'''                                                                         °
  263.   '''and rachets, that was capable of multiplying numbers. This was the'       °
  264.  ''                                                                            °
  265.   '''first known calculating machine, but its use did not catch on until       °
  266.  ''' '''centuries later. Instead, a number of mathematicians of the'''         °
  267.   '''Renaisance became aware of the properties of certain mathematical''       °
  268.  '                                                                             °
  269.   '''formulas. In Denmark for example, astronomers developed tables to''       °
  270.  '                                                                             °
  271.   '''simplify multiplication. These tables were based on trigonometric''       °
  272.  ' '''formulas already known to Archimedes.''' 'do'                            °
  273.   '''In Scotland, John Napier, a mathematician published in 1614 a table       °
  274.  '''                                                                           °
  275.   '''of logarithms. The basic idea for this table arose from the followi       °
  276.  ng'''                                                                         °
  277.   '''simple concept: Given the sequence 2 4 8 16 32 64 ... we can draw''       °
  278.  ' '''two straight lines:'',r' '''  2     4     8    16    32    64'''         °
  279.   '''  |-----|-----|-----|-----|-----|--   and'',r'                            °
  280.   '''  1     2     3     4     5     6'''                                      °
  281.   '''  |-----|-----|-----|-----|-----|--'',r'                                  °
  282.   '''The top line represents the natural numbers, while the bottom one''       °
  283.  '                                                                             °
  284.   '''represents the corresponding powers of two. He reasoned that there'       °
  285.  ''                                                                            °
  286.   '''should be a way to convert numbers to a form, where multiplication'       °
  287.  '' '''can be substituted by addition, and division substituted by'''          °
  288.   '''subtraction.''' 'do'                                                      °
  289.   '''This can be done with a function caled LOGARITHM. Before we proceed       °
  290.  '''                                                                           °
  291.   '''to describe how APL2 handles this function, let us go back to the''       °
  292.  '                                                                             °
  293.   '''example of Compound interest. Suppose we desire to calculate the'''       °
  294.   '''simple interest, given that after 5 years, the sum of 134 dollars''       °
  295. X' '''has grown to say 215 dollars.''' 'endd'                                  °
  296. *(1997 7 18 13 31 19 420)                                                      °
  297.  FTEACH4 ÉFX 'TEACH4' 'Σ The log function'                                     °
  298.   '''To answer that question, we look at the theoretical equation for'''       °
  299.   '''interest rate'',r'                                                        °
  300.   'pause ''(PRINCIPAL+INTEREST)=PRINCIPAL⌡(1+RATE)*TIME'''                     °
  301.   '''To solve for rate, we transform this equation by taking logarithms'       °
  302.  ',r'                                                                          °
  303.   'pause '' (log PRINCIPAL+INTEREST)=(log PRINCIPAL)+TIME⌡(log 1+RATE)''       °
  304.  ' '''By subtracting (log PRINCIPAL) from both sides, we get'',r'              °
  305.   'pause ''(log PRINCIPAL+INTEREST)-(log PRINCIPAL)=TIME⌡(log 1+RATE)'''       °
  306.   '''And now the left hand side can be re-written as'',r'                      °
  307.   'pause ''(log (PRINCIPAL+INTEREST)÷PRINCIPAL)=TIME⌡(log 1+RATE)'''           °
  308.   '''Now dividing both sides by TIME, we get'',r'                              °
  309.   'pause ''(log (PRINCIPAL+INTEREST)÷PRINCIPAL)÷TIME=log 1+RATE'''             °
  310.   '''At this point we no longer need the logarithms, so we revert back''       °
  311.  ' '''to its DUAL function (let us call it "exp").'',r'                        °
  312.   'pause ''(exp (log (PRINCIPAL+INTEREST)÷PRINCIPAL)÷TIME)=1+RATE'''           °
  313.   '''Subtracting 1 from this result should give us the actual rate.'''         °
  314.   'do'                                                                         °
  315.   '''The last equation seems simple enough, but how do we calculate'''         °
  316.   '''logarithms?''' 'do'                                                       °
  317.   '''The answer is very simple. APL2 supports a primitive function'''          °
  318.   '''called logarithm. Its symbol is ╡, and it exists both as a'''             °
  319.   '''monadic and dyadic function. The logarithm function is defined'''         °
  320.   '''with respect to a BASE. In its dyadic form, the left argument'''          °
  321.   '''specifies the base of the logarithm. In its monadic form, the base'       °
  322.  ''                                                                            °
  323.   '''is a default value, namely the number "e", also called the NATURAL'       °
  324.  '' '''NUMBER (2.718281828)'',r'                                               °
  325.   'show ''10╡10 100 1000'' ''2╡1 2 4 8 16'' ''╡2 10 16'''                      °
  326.   '''The log function is the dual of the power function. Recall that a''       °
  327.  '                                                                             °
  328.   '''DUAL function is the inverse of the first function. This is shown''       °
  329.  ' '''in the following examples'',r'                                           °
  330.   'show ''10*10╡10 100 1000'' ''2*2╡1 2 4 8 16'' ''*╡2 10 16'''                °
  331.   '''Before we had computers, it was common to use tables of logarithms'       °
  332.  ''                                                                            °
  333.   '''for extensive multiplication. Many such tables were available,'''         °
  334.   '''including logarithms of various TRANSCENDENTAL functions. The most'       °
  335.  ''                                                                            °
  336.   '''popular base was 10. With APL2 we can still take advantage of the''       °
  337.  '                                                                             °
  338.   '''base 10 dyadic log function, but it is much simpler to use the mona       °
  339.  dic''' '''(or natural) base'',r' 'show ''*(╡215÷134)÷5'''                     °
  340.   '''This last example shows that if we invest 134 dollars, and five'''        °
  341.   '''years later collect 215 dollars, the annual simple interest rate'''       °
  342.   '''is 9.91'',a' 'do' '''Recalling the interest rate formula,'',r'            °
  343.   '''      (log (PRINCIPAL+INTEREST)÷PRINCIPAL)=TIME⌡(log 1+RATE)'',r'         °
  344.   '''we can estimate the time it takes to double your investment'',r'          °
  345.   'show ''É╜RATES╜.01⌡3+∞6'' ''TIMES╜(╡2)÷╡1+RATES'''                          °
  346.   '''There is the well known "rule of 72"'',r'                                 °
  347. X 'show ''╛(.5+100⌡TIMES⌡RATES)''' 'endd'                                      °
  348. *(1997 7 18 13 35 10 400)                                                      °
  349.  FTEACH5 ÉFX 'TEACH5' 'Σ Pascal triangle'                                      °
  350.   '''      PASCAL''''S TRIANGLE'',r'                                           °
  351.   '''In the interest rate formula, we raised the quantity 1+RATE to a'''       °
  352.   '''power. Let us now take another look at this process, but we will'''       °
  353.   '''do it in a more abstract way. We will abbreviate the RATE to just R       °
  354.  .'''                                                                          °
  355.   '''In the calculation of interest after two years, we raise (1 + R) to       °
  356.  ''' '''the power 2'',r' '''           1 + R1'''                               °
  357.   '''          ⌡1 + R2''' '''      ²²²²²²²²²²²'''                              °
  358.   '''        R2 + R1R2''' '''   1 +  R1''' '''  ²²²²²²²²²²²²²²²'''             °
  359.   '''   1+(R1+R2)+R1R2''' 'do'                                                 °
  360.   '''We see that after two years, the PRINCIPAL + INTEREST is made up'''       °
  361.   '''of three parts:''' '''   1. 1 (representing the principal)'''             °
  362.   '''   2. R1+R2 the (simple) interest for year one plus year two'''           °
  363.   '''   3. R1R2 the (compounded) 2d year interest on the 1st year intere       °
  364.  st''' 'do'                                                                    °
  365.   '''If we now multiply this result again by (1 + R) to get the third'''       °
  366.   '''year interest we get'',r' '''            1 +  R1 +  R2 +R1R2'''           °
  367.   '''                     ⌡   1 + R3'''                                        °
  368.   '''          ²²²²²²²²²²²²²²²²²²²²²²'''                                       °
  369.   '''       R3 + R1R3 + R2R3 + R1R2R3''' '''  1 +  R1 +   R2 + R1R2'''         °
  370.   '''  ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²'''                                      °
  371.   '''  1 + (R1+R2+R3) + (R1R2+R1R3+R2R3) + R1R2R3''' 'do'                      °
  372.   '''There is a pattern here. We can look at the coefficients (i.e. the'       °
  373.  '' '''number of entries in parentheses):'',r'                                 °
  374.   '''  POWER          COEFFICIENTS''' ''' (1 + R)           1  1'''            °
  375.   ''' (1 + R)*2         1  2  1''' ''' (1 + R)*3         1  3  3  1'''         °
  376.   ''' (1 + R)*4         1  4  6  4  1'',r'                                     °
  377.   '''We can extend this table in a simple way: We start with a 1 in a'''       °
  378.   '''new row. Then we add the number above (1) to the number to its'''         °
  379.   '''left (4) and place this sum (5) to the right of of the one. In the'       °
  380.  ''                                                                            °
  381.   '''same way we add 4+6 for the next number. Proceeding in this way,'''       °
  382.   '''we generate the next row in the table: 1 5 10 10 5 1'',r'                 °
  383.   '''This pattern is now called the PASCAL TRIANGLE. Although Pascal'''        °
  384.   '''did not discover this pattern (it was known to several ancient'''         °
  385.   '''civilizations), he did find the formula for the general term.'''          °
  386.   'do'                                                                         °
  387.   '''Before we describe this formula, we will look at a derivation'''          °
  388.   '''of Pascal''''s triangle from yet another point of view. Then we wil       °
  389.  l'''                                                                          °
  390.   '''introduce a new primitive function (monadic FACTORIAL, and dyadic''       °
  391.  ' '''BINOMIAL).''' 'do' '''         SETS AND SUBSETS'',r'                     °
  392.   '''A SET is by definition a collection of objects. For example, the'''       °
  393.   '''digits 1, 2 and 3 form a set of three. We will use the following'''       °
  394.   '''notation to describe a set (with apology to sticklers in math notat       °
  395.  ion).'''                                                                      °
  396.   '''The elements of a set will be enclosed by curly brackets. Here is a       °
  397.  n''' '''example of the set we will call FOUR'',r' '4 sset 4'                  °
  398.   'r,''A SUBSET is a set of elements that also belong to the set. Two or       °
  399.  ''' '''more subsets will be separated by commas in our notation'',r'          °
  400.   '1 sset 4'                                                                   °
  401.   'r,''The line above shows four subsets of FOUR, each containing only''       °
  402.  ' '''one element.''' 'do'                                                     °
  403.   '''We will include the EMPTY set as a subset of FOUR too'',r'                °
  404.   '0 sset 5' 'r,''Let us now look at all of the subsets of FOUR'',r'           °
  405.   '(0 sset 4),(1 sset 4),(2 sset 4),(3 sset 4),4 sset 4' 'do'                  °
  406.   '''If we count the number of elements in each collection of subsets'''       °
  407.   '''we get 1 4 6 4 1, a line in Pascal''''s triangle. What is more, the       °
  408.  '''                                                                           °
  409.   '''total number of subsets of set FOUR is 16 (or 2*4). You can verify'       °
  410.  ''                                                                            °
  411.   '''that in general, a set of N elements has 2*N subsets, and the numbe       °
  412.  r'''                                                                          °
  413.   '''of sets with K elements are given by the (1+K)th column of the Nth'       °
  414.  '' '''row of Pascal''''s triangle.'',r'                                       °
  415.   '''The formula we are seeking describes the number of different ways''       °
  416. X' '''of taking K objects out of a collection of N objects.''' 'endd'          °
  417. *(1997 7 19 12 4 56 460)                                                       °
  418.  FTEACH6 ÉFX 'TEACH6' 'Σ Factorial, Gamma and binomial'                        °
  419.   '''      FACTORIAL, GAMMA AND BINOMIAL'',r'                                  °
  420.   '''Since the formula we are seeking was first developed in the study o       °
  421.  f'''                                                                          °
  422.   '''expanding powers of binomials, it is called the equation for BINOMI       °
  423.  AL'''                                                                         °
  424.   '''coefficients. To define it, we first must define another function''       °
  425.  '                                                                             °
  426.   '''called the FACTORIAL. This function is merely the product of the'''       °
  427.   '''first N integers'',r' 'show ''⌡/∞5'' ''!5'''                              °
  428.   '''In mathematical notation, factorial N is represented by N!. In'''         °
  429.   '''APL2 we merely place the ! in front of the value.''' 'do'                 °
  430.   '''The argument to the factorial is an integer. One could also ask'''        °
  431.   '''whether the argument to ! could be a number not an integer'',r'           °
  432.   'show ''!0.5'''                                                              °
  433.   '''Obviously the answer is yes. This function is called the GAMMA'''         °
  434.   '''function. It has many applications, but for the time being, we'''         °
  435.   '''will leave it alone. However, we should mention that this function'       °
  436.  ''                                                                            °
  437.   '''cannot be represented by finite polynomials. There are many such'''       °
  438.   '''functions, as we will see later. They are called TRANSCENDENTAL'''        °
  439.   '''functions. Gamma and the log functions are both transcendental.'''        °
  440.   'do'                                                                         °
  441.   '''Coming back to the factorial; how does that function come about?'''       °
  442.   '''Consider the set FOUR, that we discussed before. One could ask, how       °
  443.  '''                                                                           °
  444.   '''many different ways are there to order the elements of this set?'''       °
  445.   '''If you think about it, we have 4 choices to pick the first element,       °
  446.  '''                                                                           °
  447.   '''then there are only three choices to pick the second element, then'       °
  448.  '' '''two choices, an finally the fourth element is determined'',r'           °
  449.   '''1234 1324 1342 1423 1432 2134 2143 ... all together 24 possible'''        °
  450.   '''patterns, or'',r' 'show ''!4'''                                           °
  451.   '''We can now derive the formula for the binomial coefficient. Given''       °
  452.  ' '''the !N possible ways to rearrange N elements, if we are only'''          °
  453.   '''interested in K of then, we do not care what the sequence is on'''        °
  454.   '''the (N-K) remaining ones. Therefore we can divide (!N) by (!N-K).''       °
  455.  '                                                                             °
  456.   '''Also, we do not care about the ordering, 12 is the same as 21, and'       °
  457.  ''                                                                            °
  458.   '''so on, so we can also divide the remaining patterns by !K. Therefor       °
  459.  e'''                                                                          °
  460.   '''the binomial formula for the number of ways to take K distinct'''         °
  461.   '''subsets out of a collection of N objects is'',r'                          °
  462.   '''     (!N)÷(!K)⌡!(N-K)'',r'                                                °
  463.   '''The dyadic ! gives us this same result for, say K=3 N=8'',r'              °
  464.   'show ''(!8)÷(!5)⌡!3'' ''3!8'''                                              °
  465.   '''With the binomial primitive, we can easily define an algorithm to''       °
  466.  ' '''calculate the Nth row of the Pascal triangle'',r'                        °
  467.   '1 show ''PASCAL:(0,∞∙)!∙'' ''PASCAL 1'' ''PASCAL 2'' ''PASCAL 10'''         °
  468. X 'endd'                                                                       °
  469. *(1997 8 19 11 37 32 496)                                                      °
  470.  FTIME ÉFX 'U╜V TIME W;T'                                                      °
  471.   'Σ Measure execution time of W evaluated V times'                            °
  472. X 'U╜60 60 1000¥²3╞ÉTS' 'T╜»■VµΓW' 'U╜(,-U-60 60 1000¥²3╞ÉTS)÷V'               °
  473.  NTIMES 1 6 17.6729876851297 14.20669908289046 11.89566104594187               °
  474. X 10.24476835105871 9.006468342000588 8.043231726932046                        °
  475. XCa 0 %                                                                        °
  476. *(1997 7 13 12 28 49 504)                                                      °
  477.  Faddquote ÉFX 'u╜addquote w'                                                  °
  478.   'Σ Put quotes around a string, and double existing quotes'                   °
  479. X 'u╜ÉAV[40],((1+w=ÉAV[40])/w),ÉAV[40]'                                        °
  480. *(1996 4 6 16 10 36 352)                                                       °
  481. XFaq ÉFX 'U╜aq W' 'U╜Γaddquote W'                                              °
  482. *(1997 7 24 13 20 38 476)                                                      °
  483.  Fav ÉFX 'av;A;N;I;ÉIO' 'Σ Display characters in ÉAV' 'ÉIO╜0'                  °
  484.   'A╜22 78µ'' ''' 'N╜3 0«φ12 22µ1+∞356' 'A[;,(6⌡∞12)°.+2 3 4]╜N'               °
  485.   'A[;6+6⌡∞12]╜φ12 22µÉAV' 'ΣA[8 10 13;6]╜'' ''' 'A[13;6]╜'' '''               °
  486. X 'A[14+∞8;68 69 70 72]╜'' ''' 'A'                                             °
  487. *(1991 11 11 8 25 13 316)                                                      °
  488.  Fdate ÉFX 'u╜date w' 'Σ Format date and time of day' 'u╜«6╞w'                 °
  489. X 'u╜('' ''⌠u)Γu' 'u╜εu,■''-- .. '''                                           °
  490. XCdig 1 10 1234567890                                                          °
  491. *(1997 9 9 13 0 45 372)                                                        °
  492.  Fdisclaimer ÉFX 'disclaimer' 'Σ Copyright statement'                          °
  493.   '(10µ'' ''),''Copyright, Z. V. Jizba, 1995,1996,1997'',r'                    °
  494.   ''' This and subsequent workspaces labelled TEACHxx are made available       °
  495.  '''                                                                           °
  496.   '''at no cost to anyone who desires to learn how to use effectively'''       °
  497.   '''the IBM/OS2 version of APL2.'',r'                                         °
  498.   '''This software is provided "AS IS" with no WARRANTY of any kind, eit       °
  499.  her'''                                                                        °
  500.   '''express or implied. Any risk in its use resides with you, the user        °
  501.  of''' '''these tutorials.'',r' '''     ACKNOWLEDGEMENTS'',r'                  °
  502.   ''' In writing these tutorials, I am greatly indebted to Roy Sykes, wh       °
  503.  ose'''                                                                        °
  504.   '''excellent lectures increased my understanding of the language.'''         °
  505.   '''Discussions with the late Harry Bertucelli clarified a number of'''       °
  506.   '''concepts and caused me to change some improper terminology that was       °
  507.  '''                                                                           °
  508.   '''used in previous versions of these tutorials. Mr. Benjamin Archer''       °
  509.  '                                                                             °
  510.   '''kindly checked out a nearly final version, bringing to my attention       °
  511.  ''' '''some ommisions, misspellings, and invalid terminology.'',r'            °
  512. X '''(PRESS ENTER to continue)'''                                              °
  513. *(1997 7 13 12 28 50 508)                                                      °
  514.  Fdo ÉFX 'do;T;E' 'Σ Expression driver' 'E╜''''' 'æ╜''      ''' 'T╜æ'          °
  515.   '╕(^/'' ''=T)/0'                                                             °
  516.   '╕(('':''εT)doif ''B╜evaldd (+/^\'''' ''''=T)╟T'')/2'                        °
  517.   '''E╜ÉEM'' ÉEA T' '╕(0=µ,E)/2'                                               °
  518.   '''This is not a valid APL2 expression''' 'æ╜''*''' '╕(''?''⌠╞1╟æ)/2'        °
  519. X 'E' '╕2'                                                                     °
  520. *(1997 7 13 12 28 50 508)                                                      °
  521.  Fdoif ÉFX 'U╢╜V╢ doif W╢;t╢' 'Σ Rule' '╕(^/~U╢╜V╢)/0'                         °
  522. X '''U╢╜V╢ doif■ W╢'' ÉEA ''»V╢/W╢'''                                          °
  523. *(1997 9 9 12 50 14 444)                                                       °
  524.  Fendd ÉFX 'endd' 'Σ end of special feature' '20µ''²'' ╪ ╕(4<µÉLC)/0'          °
  525. X 'do'                                                                         °
  526. *(1997 8 19 11 36 54 580)                                                      °
  527.  Ferase ÉFX 'erase;t;EXIT;GO;HELP;DISPLAY;BIND;REVIEW;TIME;DISCLAIMER'         °
  528.   'Σ Erase all global functions and variables' 't╜ÉNL 3'                       °
  529.   't╜(~t^.εlc,'' '')≡t' 't╜ÉEX(~t[;∞5]^.=''TEACH'')≡t' 't╜ÉNL 2'               °
  530. X 't╜ÉEX(~t^.εlc,'' '')≡t' 't╜ÉNL 4' 't╜ÉEX(~t^.εlc,'' '')≡t'                  °
  531. *(1997 7 27 13 47 41 608)                                                      °
  532.  Fevaldd ÉFX 'u╜evaldd w;c;n' 'Σ Evaluate direct definition' 'u╜0'             °
  533.   'n╜(w∞''Σ'')-1' 'c╜(((n╞w)⌠'':'')Γn╞w),Γ''ΣDD '',(n+1)╟w'                    °
  534.   '╕((1 label╞c)doif ''''''Invalid label'''''')/0'                             °
  535.   '╕((2=µc)doif ''u╜showdd 1╙c'')/0'                                           °
  536.   '╕((3=ÉNC╞c)doif ''u╜⌡µÉ╜(╞c),'''' is already defined.'''''')/0'             °
  537.   '╕((3=µc)doif ''u╜simdd c'')/0' 'c╜(Γ''α∙ aw'')replace■c'                    °
  538.   'u╜ε''u╜'',((''a''εεc[2 3 4])/''a ''),(╞c),'' w;t;b'''                       °
  539.   'u╜u(5πc)(''b╜(t╜'',(3πc),'')/'',addquote ''u╜'',4πc)'                       °
  540. X 'u╜u,''╕(t doif b)/0''(''u╜'',2πc)' 'u╜╧ÉFX u'                               °
  541. *(1997 7 25 13 27 52 564)                                                      °
  542.  Fexit ÉFX 'V exit W;T' 'Σ Exit if too many suspended functions'               °
  543.   '╕(0⌠ÉNC ''V'')/L0 ╪ V╜10' 'L0:╕(V>µÉLC)/0'                                  °
  544.   '''There are too many suspended functions''' '''Please enter '',W'           °
  545. X '╕'                                                                          °
  546. *(1997 7 26 12 33 39 536)                                                      °
  547.  Fget ÉFX 'U╜V get W;t;T;ÉPR' 'Σ Prompt for response from keyboard'            °
  548.   'ÉPR╜T╜ÉAV[ÉIO+255] ╪ ╕(0⌠ÉNC ''V'')/L0 ╪ V╜1' 'L0:V╜V╧1' 'æ╜W ╪ t╜æ'        °
  549.   'U╜(+/^\t=T)╟t' '╕(''╕''⌠╞U)/L1 ╪ ╕' 'L1:╕V/0' 't╜(U⌠'' '')ΓU'               °
  550. X 'U╜(µt),(ΓU),t'                                                              °
  551. *(1997 7 28 13 33 8 424)                                                       °
  552.  Fglobals ÉFX 'globals' 'Σ Initialize useful global variables'                 °
  553.   'uc╜''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''                                          °
  554.   'lc╜''abcdefghijklmnopqrstuvwxyz''' 'dig╜''1234567890'''                     °
  555. X 'r╜ÉAV[13+ÉIO]' 'q╜'''''''''                                                 °
  556. *(1997 7 3 12 47 6 368)                                                        °
  557.  Finitialize ÉFX 'initialize;T' 'Σ Initialize workspace'                       °
  558.   '''AT ALL TIMES, TO CONTINUE, PRESS RETURN!'',r'                             °
  559.   '''To see disclaimers enter:'',r,''    disclaimer''' 'do' 'erase'            °
  560.   'globals'                                                                    °
  561.   '''Make sure the CAP LOCK light on your keyboard (upper right) is ON!'       °
  562. X'' 'endd'                                                                     °
  563. *(1997 7 27 13 14 33 444)                                                      °
  564.  Flabel ÉFX 'u╜v label w'                                                      °
  565.   'Σ Return 1 if label w does not begin with a cap'                            °
  566.   '╕(0⌠ÉNC ''v'')/L0 ╪ v╜0' 'L0:v╜v╧1 ╪ w╜εw ╪ ╕v/L1 ╪ ╕(u╜0⌠ÉNC w)/0'         °
  567. X 'L1:╕(u╜~^/wεlc,uc,dig)/0' 'u╜w[1]εlc,dig'                                   °
  568. XClc 1 26 abcdefghijklmnopqrstuvwxyz                                           °
  569. *(1997 7 13 12 28 55 528)                                                      °
  570.  Fnon ÉFX 'non;T;RC;ET;R' 'Σ Ignore keyboard entry' 'æ╜''      ''' 'T╜æ'       °
  571.   '╕(0=µ(T⌠'' '')/T)/0' '(RC ET R)╜ÉEC T' '╕(0=RC)/2'                          °
  572. X '╕((1=RC)doif ''R'')/2' '╕2'                                                 °
  573. *(1997 7 13 12 28 55 528)                                                      °
  574.  Fnotb ÉFX 'u╜notb w' 'Σ Remove trailing blanks'                               °
  575.   '╕((1<╧w)doif ''u╜notb■ w'')/0' '╕((1<µµw)doif ''u╜πnotb Γ[2]w'')/0'         °
  576. X 'u╜(1-(,'' ''⌠Φw)∞1)╟w'                                                      °
  577. *(1996 4 6 16 10 36 352)                                                       °
  578.  Fpause ÉFX 'V pause W;T'                                                      °
  579.   'Σ Pause, then print W V spaces right and return'                            °
  580. X 'T╜(0=ÉNC ''V'')doif ''V╜6''' 'do' '(Vµ'' ''),W' 'do'                        °
  581. *(1997 7 27 12 55 6 496)                                                       °
  582.  Fproblems ÉFX 'problems' 'Σ Problems'                                         °
  583.   '''That is all for this lesson. Remember, if you want to practice,'''        °
  584.   '''and plan to use direct definitions, be sure to first enter GO.'''         °
  585.   '''Direct definitions will then be accepted. To exit GO, enter EXIT.''       °
  586.  ,r'                                                                           °
  587.   '''To erase a previously defined DIRECT DEFINITION FUNCTION, enter'',r       °
  588.  ' '''       )ERASE functionname'',r'                                          °
  589. X '''WARNING! do not use )ERASE on other labels.'',r'                          °
  590. XCq 0 '                                                                        °
  591. XCr 0                                                                         °
  592. *(1997 7 13 12 28 56 532)                                                      °
  593.  Freplace ÉFX 'u╜v replace u;i;r;s' 'Σ Replace elements in v in u'             °
  594.   'i╜Γ∞µu' 's╜2πv╜(v⌠'' '')Γv' 'i╜⌡r╜i⌡■Γ[1]u°.=╞v'                            °
  595. X 'u[(εi)/εr]╜s[(εi)/εi⌡■∞µs]'                                                 °
  596. *(1997 7 13 12 28 56 532)                                                      °
  597.  Fround ÉFX 'U╜V round W' 'Σ Half adjust to V th decimal'                      °
  598. X 'U╜(╛0.5+W⌡10*V)÷10*V'                                                       °
  599. *(1997 7 13 12 28 57 536)                                                      °
  600.  Fshow ÉFX '╢V show ╢W;╢T;╢B' 'Σ Display and execute ╢W'                       °
  601.   '╢T╜(0=ÉNC ''╢V'')doif ''╢V╜0'''                                             °
  602.   '╕((0=╧╢W)doif ''show ╢W,'''' '''''')/0'                                     °
  603.   '╕((1<╧╢W)doif ''╢V show ■╢W'')/0' '''      '',╢W'                           °
  604. X '╕((╢V^'':''ε╢W)doif ''╢T╜evaldd ╢W'')/L0' '''ÉEM'' ÉEA ╢W' 'L0:do'          °
  605. *(1997 7 13 12 28 57 536)                                                      °
  606.  Fshowdd ÉFX 'u╜showdd w;a;b;c;r'                                              °
  607.   'Σ Display a direct definition function'                                     °
  608.   '╕((1=╧w)doif ''u╜showdd Γw'')/u╜0'                                          °
  609.   '╕((3⌠ÉNC╞w)doif ''(ε╞w),'''' is not a function'''''')/0'                    °
  610.   'c╜Γ[2]ÉCR╞w' 'c╜notb(2╞c),(Γ''aw α∙'')replace■2╟c'                          °
  611.   '╕((~''ΣDD''╧3╞2πc)doif ''''''Not a direct definition function'''''')/       °
  612.  0' 'u╜1' 'b╜('' ''⌠╞c)Γ╞c' 'a╜''      ''' 'r╜2╟3πc'                           °
  613.   '╕((3=µc)doif ''a,(╞w),'''':'''',r,(3<µ2πc)/''''   Σ'''',3╟2πc'')/0'         °
  614.   'a╜a,(╞w),'':'',(2╟5πc),'':''' 'b╜(+\r=''('')-+\r='')''' 'b╜b∞0'             °
  615. X 'a╜a,(²3╟(b-1)╞3╟r),'':'',2╟»(b+2)╟r' 'a,(3<µ2πc)/''  Σ'',3╟2πc'             °
  616. *(1997 7 13 12 28 57 536)                                                      °
  617.  Fshowfn ÉFX 'U╜V showfn W;F;N;T;ÉIO' 'Σ Simulate ╖W[É]'                       °
  618.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'ÉIO╜0'                                        °
  619.   'U╜r,''      '',''╖'',W,''[É]'',(╞V)╞''╖''' 'N╜1╞µF╜ÉCR W' 'N╜«∞N'           °
  620.   'N╜(N⌠'' '')ΓN' 'F╜(π''['',■N,■Γ''] ''),F'                                   °
  621.   'T╜(1<µ,V)doif ''F╜F[1╟V;]'' ''U╜''''''''''' 'U╜²1╟U,r,,F,r'                 °
  622. X 'U╜((-+/^\'' ''=ΦU)╟U),('' ╖'')[╞V],r'                                       °
  623. *(1997 7 13 12 28 58 540)                                                      °
  624.  Fsimdd ÉFX 'u╜simdd w;e' 'Σ Direct definition mode' 'u╜0'                     °
  625.   '╕((0⌠ÉNC╞w)doif ''''''Already defined'''''')/0' 'e╜''α''ε2πw'               °
  626.   'w[2]╜Γ''u╜'',''α∙ aw'' replace 2πw' 'w╜w[1 3 2]'                            °
  627. X 'w[1]╜Γε''u╜'',(e/''a ''),w[1],'' w''' 'u╜╧ÉFX w'                            °
  628. *(1996 4 6 16 10 36 352)                                                       °
  629.  Fsset ÉFX 'U╜K sset N' 'Σ Generate subset of K items out of N'                °
  630.   '╕((0=K)doif ''U╜ÉAV[124 126 33]'')/0' 'U╜²1Φ1+((-K)╞∞N)ÿ∞(!K)⌡K!N'          °
  631.   'U╜«²1╟ε(Γ[1](^≡2<≡U)/U),■'','''                                             °
  632. X 'U╜(1ΦÉAV[126 124],(U⌠'' '')/U),'' '''                                       °
  633. *(1992 6 3 9 59 17 424)                                                        °
  634.  Ftab ÉFX 'U╜V tab W;T;A;B;C;D;E;F;G;M;ÉPW' 'Σ Tabulate list W'                °
  635.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'M╜''Invalid data for tabulation'''            °
  636.   'V╜4╞V' 'ÉPW╜130╛30⌐G╜V[2]+79⌡V[2]=0'                                        °
  637.   'L1:╕((1<╧W)doif ''''''W╜∞0'''' ÉEA ''''W╜πW'''''')/L1'                      °
  638.   '╕(((0=µεW)δ2<µµW)doif ''U╜(~V╧4╞0)/M'')/0'                                  °
  639.   'T╜(1≥µµU╜«W)doif ''U╜πW╜(U⌠'''' '''')ΓU'''                                  °
  640.   'T╜(0<V[1])doif ''U╜(«(Φ1,╞µW)µ(V[3]µ'''' ''''),∞(╞µW)-V[3]),'''' ''''       °
  641.  ,U''' '╕(G<30)/0' 'T╜(F╜µεV[4])+C╜1╟B╜µA╜(V[3],0)╟U'                          °
  642.   'T╜⌐(1╞B)÷1⌐╛(ÉPW+F)÷T' 'U╜(E╜(V[3],C)╞U),[1](B╜T,1╟B)╞A'                    °
  643.   '''D╜εV[4]'' ÉEA ''D╜ÉAV[εV[4]+33⌡V[4]=0]''' 'L0:A╜(T,0)╟A'                  °
  644. X '╕(0=1╞µA)/0' 'U╜U,(((T+V[3]),µD)µD),E,[1]B╞A' '╕L0'                         °
  645. *(1997 7 13 12 28 59 544)                                                      °
  646.  Ftest ÉFX 'U╜V test W;P'                                                      °
  647.   'Σ Describe problem in W, (correct answer in V)' 'U╜2' 'L1:W'                °
  648.   'É╜''      ''' 'P╜æ' '''╕L0'' ÉEA ''P╜»P''' '╕(V╧P)/0'                       °
  649. X 'L0:╕(0=U╜U-1)/0' '''Incorrect. Try again''' '╕L1'                           °
  650. XCuc 1 26 ABCDEFGHIJKLMNOPQRSTUVWXYZ                                           °
  651. *(1996 4 6 16 10 36 352)                                                       °
  652.  Fvec ÉFX 'U╜vec' 'Σ Draw 2d vector in plane'                                  °
  653.   'U╜r,r,''2-        +'',r '':      °'',r,''1-    °'',r'                       °
  654. X 'U╜U,'' :  °'',r,''0|....|....|'',r,'' 0    1    2'',r'                      °
  655.