Algorithms, Computation and Mathewics (Algol -SE102?
Total Page:16
File Type:pdf, Size:1020Kb
' DOCUMENT RESUME 'ID 143 509 -SE102? 986 . AUTHOR ' Charp, Sylvia; And Cthers TITLE Algorithms, Computation and MatheWics (Algol SApplement). Teacher's Commentary. ReViged Edition. / IATITUTION. Stanford Univ.., Calif. School ,Mathematics Study Group. , SPONS, AGENCY National Science Foundation-, Washington, D.C. PUB DATE 66 'NOTE 113p.;,For related docuuents, see SE 022 983-988; Not available in hard copy dug to marginal legibility off original doctiment TIDRS PRICE MF-$0,.83 Plus Postage. HC Not Available frOm SDRS. 1?'ESCRI2TORS Algorithms; *Computers; *Mathematics Education; *Programing Languages; Secondary Education; *Secondary School Mathematics; *Teaching Guides IDENTIFIERS *itGeL; *,School Mathematics Study Group I. ABSTRACT.- A is the teacher's guide and commentary for the SIISG textboot,Algorithms, Computation andMathematics' (Algol Supplement) .This teacher's commentary provides~ background inf8rmation for'the teacher, suggestions for activities fOund in the student's lgoI 'Supplement, and answers to exercises and activities: The course is ,designed for high school students in grades 11 and 12. Acdess to a computer is high recommended. (RH) f ******************************4**********#5*****i******Lii*************- '* Documents acquired by ERIC ittlUde many informal unPgablished *, * materials n'ot available from other, sources. ERIC makes every effort pic' * to obtain,the best copy available. NeVerfheless, items of 'marginal * reprodUcibillty'are often encountered and this, affects the quality * * of the microfiche and hardcopy reproductions ERIp_makes.available_ * * via the-.ERIC-DocumentReproduction. Service IEDR4.' lint is note * * respon-siile for the quality of the original.document.'Reproductions * supplied by EURS are the` best that can be. made ftom the original. ********,*****************************A********************************* 414 yt r r 4) ALGORITHMS, COMPUTATION AN D MATH EMATICS (Algol Supplement) Teacher's Commentary Revised Edition 1 6 The following is a' list of, ail thKeji'vho participated in thepreparation of this. , volume: Sylvia Charp, Dobbins TechnitalHigh,School, Philaslelphia,.Perinsylvania Alexandra Forsythe, Gunn High,School, Palo Alto, California Bernard A. Galler, University of Michigan, Ann Athol-, Michigan John G. cierriot, Stahford University, California. Walter Hcirmarrn, Wayne State University, Detroit, Michigan ThOmas E. Hull, University.of Toronto, Torohto, Ontario;Canada. Thomas A. Keenan, University of Rochester, Rdehester, NewYork Robert E. Monroe, Wayne State University, Detroit, Michigan, Silvio 0. Navarro, University. of Kentucky, Lexington, Kentucky Mt Elliot V. arganick, University of Houston, Houston, Texas Jesse Peckenham, Oaklandi1lnified School District, Oakland,California, .. George A. Robinson, Argonne National Laboratory,.Areonne, Illinois Phillip M. Sherman, Bell Telephone Laboratories, Murray hill, NewJersey 4 , °Robert E. Smith, Control Da**Coorpo4tion, St. PaulMinnesota Warren Stenberg-, University of Mamesota, Minneapolis, Minnesdta . Harley Tillitt, U. S. Naval Ordnante Test Station, china Lake, California -s Lyneve Waldrop, NewtOn South High,School, Newton, Massachusetts The following, were the principal consultahts: George E. Forsythe, Stanford University, Califdtnia s Bernard A. Galler, University of Michigan, Ann Arbor, Michigan Wallace Givens, Argonne,National Laboratory, Argonne, Illinois4 41 , t 3 , I- ©1965 and1966 by The guard of Trustees of the Leland Stanford 'Junior University s r All rights reserved Priated in the United States of America t aIt " .01 a PePniission to make verbatim use of materialt this book ?mist be secured horn the 44rector of SMSG. Such'periniss on will be uanted except in unusual circumstances. Publications incor matingSMS6 mite? ials miut include loth an acknowledgment of the SMSGcopyright ,(Yale U,niver sity or-Stanford University, as the case n (4, Ir)anci a disclaimer of SMS endorsement. Exclusive license will nit he granted save 'in exceptional, circumstances, and then only by spec fic action of theAckisoqBoardof SMSG. - 1., r or Financial support fore School Mathematics' Study Group hasbeen provided by the Nat ial Science Fqtpida1io'n, 1' J 44-4 TABLE OF gONTENTS:' Chapter ;11A2, 'INPUT- OUTPUT AND ASSIGNMENT,STATEIENTS Summary af Chapter A2 1 t:. A2-1. "Target" programs and source programs '. 3 ' A2 -2. The Character Set 4 Answers to'Exercises. - . 7 A2-3: '1nput-output Statements < 8 , Answers to Exe'rcises -.\. 8 Answers to Exe=i-se's A2-4 10 Answers to ZXercises A2-6 13 A2-7.' Writing Complete,ALGOL.Programs 14 /- -.. Answers-to Exercises .. t15 " TA3*. BRANCHING AND SRSCRiPTLD VARIABLES , '' Introduction . , rr. --- Outline of Chapter A3 ' 18 Answers to Exercises A3.1 '20 Answers to Exer&ses A3-2 s 29 . = Answers td Exercises A3-3 36 Answers.tEXercises A3-5 45 Answers to Exercises A3-66' la 50. TA4 LOOPING . Summary of Chapter A4, . , 53 . A4-1.y, The "for clause", 53 .., A4,2: Illustrative Examples. , 53- -fik!4---.v Tal?le-look-up - 14 .. AW-4. Nested loops . is 54 , 4.,.. Answers to Exercises A4-1 -) 1 55 Answers to' Exercises.A4-2 57 Answers to Exercises,A4-3 0 p 63 1 Answers to Exercises A4!4 7 . 64 ", TA5 PROCEDURES' -.. ce-_-,4\r,,..4 Andwers to Exercises-A5-1, 69 Answers'to Exercises A5-3 70 .: Answers to -Exercises A5-4 . 76 ' Ahsyexs to ExercisesA5-5- - .. .... .. 86 . TA7 `SOMEMATHEMATICAL ltt4S , 0 '. ,". Answeritb Exercises A711' . ',... ......... ,..,. / . 93 ,.. Answ#rs to Exercises,A7-"i4, 96 c 1 - .,- Ahs14ers taExercisesA7- 99 : . Answqg to Exercises A7-4-: r. , .103 ., Andwd-8to ExerciS0 A7'-5 . , 104., *. ...... 4 ' " se o Chapter TA21 INPUT-OUTPUT ANA ASSIGNMENT STATEMENTS Summary of Chapter` A2 Enough of the ALGOL language is introduced in this chapteto enablea studerit to writevery simple programs. One series of exercises is arrangedin i such a way as to build tip complete pr grams, any or all of which, can becom- puter tested. These are exercises 1- at theendof sections s A2-3 Set A A2-3- Set B and , .A2-7. In addition, Exercise 8,' Section A2-7, is also recommended for computer - testirig. It will-be interesting tto the bpfterstudents. You may need to giVe the students some.special helpwiththis one. The outline: A2-1 Some batkground-on What is AIGOLand. like. what iLGOI, programeldok , - , . # . A2i2 The elements of the language, .. its characters, ntfterals for ..* - constants,'variaPles, labels, names forfuncions,operators-,' and.special,symbols. -. A2-3 The read and print statemenps ereintroduced. Slfice ALGOL does riot -Specify, format codes for describinginput and output records, only a7gerferal awareness of the grobiemis transmitted.to the students, . A suggeited free` form for- datacards and a standard- formatted'output areimaantb Theseare explained by discuss= ing the execution Of redd andrint procedtres in°a typical:, ALGOL implementation. - .. A2-4: . ': The.assignment statement is explainedlargely in terMs'qf 'what has been4earned-from the extensive materia),:inthe flow chart keit. ,,The student should parattenttonto:the differenceber tween real and tnteger division,. thelatter being explained in t terms of the greatest integer unction. ., Order' of:computation inan 4 expression is explained in: terms of the material given in the flowchart text., 0 A2-6 :' 'Obn;rcrting integers toreels ad ,vice-versa is shc3wn to pliShed by be decom- the assignment stateient. ' k , . f A2-7 A simple (but complete) ALGOL. program is disiilayed and a set of exercises given where -the student -is asked towrite his first complete programs. The .congept of "head" and "body" of .a pro- 14( gram is introdlided. So is the notion of a ccmppund statement asopposed,to a simple isptement. ,The conpept of a "block" is /' not mentioned, however. j 41 , "- Literature On ALGOL 60 and its 'implementation A.nonexhaustive'list is provided here. A. Reference manuals Nlie.manuals .14...sted are revised frequently and the d9cumentnumbers that are given may not reflect the latest revision.) O .0 1 ' Computer 1. "pc-tended ALGOL ReferenceManual for the B5000."Burroughs Corp.,Bull. No. 5000,21012 B5500 2. "Miscellaneous Facilitiesof Extended ALGOL for 1 B5000." Burroughs Corp.,Bull. No. 5000-21013 ONO 3. Burroughs Algebraic Compiler, Bull. No. 220-21017 "B220 ALCOR Algol for the IBM 7090 IBM 7090/94° Latest reference manual avai.11ble from the University of Illinois Computer Laboratory B. Primers, guides and other texts 0 The best source` of such material is the 8MSG annotated bibliography entitled "Study Guide .in J4gital.ohiputing and Related Mathematics," which is reprinted at the end of the Teachers Commentary for the Main Text. See especially the references mentioned in Sebtion III, Algorithmic LangUages.: 4 1 t. ' 1 '2 7 1 ti TA2 -1 A2-1"Target" programs and sourceprograms' Terminology ohanges rapiky'in a field whic*is moving as rapidly as the computer Most of the elder literature u d the object program: We c'e using the currently preferred term in',016 singtthe word target. In addition tp the normal manner'of !processinga source program as de. scribed in the student text, there isan alternative approach which is worth knowIng about. In this approach, the proceskr or-compilerprogram produces a target program which is executed in the " interpretive mode." This type of target program 'consists clinstructions that are not strictly machine codes. They are machine-like instruction codes, oftencalled an "Interpretive" cvle. .rs in'ordet to execute such a target,a specially developed "interpreter" \ ' Program