SOLUTIONS
,Contents
1 About This Solutions Manual 1
1.1 To the Student . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 To the Instructor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Solutions to the Exercises 3
Chapter 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Chapter 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Chapter 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Chapter 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Chapter 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Chapter 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Chapter 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Chapter 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Chapter 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Chapter 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Chapter 11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Chapter 12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Chapter 13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Chapter 14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Chapter 15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Chapter 16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Chapter 17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
3 Extra Exercises and Their Solutions 221
4 Teaching FORTRAN Programming 259
v
@@SSee
isis
mmiciicsis
oolala
titoionn
,1
About This Solutions Manual
1.1 To the Student
This Solutions Manual is intended for the instructor of a course that uses Classical FORTRAN
as a textbook, and for the student who is learning the subject independently.
If you are a student taking the course for credit you should know that it is a violation
of academic ethics for you to consult this Solutions Manual, whether you copy verbatim
from it or only use it to get ideas about how to work the exercises. The exercises are a
valuable aid to learning the material in the textbook, but only if you work them yourself !
Looking up the answers instead of figuring them out deprives you of an opportunity to learn
the material. If an answer is for credit, cheating is also personally degrading to you and
unfair to your classmates, and it might place you in jeopardy of disciplinary action. If this
is an illicit copy, please destroy it now. If this is a stolen copy, please return it to its rightful
owner. Either way, STOP READING.
If you are a student learning the subject by yourself then you are your own instruc-
tor. Please read the next section.
1.2 To the Instructor
This Solutions Manual is intended for the instructor of a course that uses Classical FORTRAN
as a textbook, and for the student who is learning the subject independently.
If you are in either category you should know that it greatly diminishes the usefulness of
the exercises for graded work if their solutions become public. Please refrain from loaning
this book to others, distributing solutions to others, or posting solutions on the World Wide
Web. If you want to show a group how to solve a problem, I suggest making a transparency
or scanning to a .pdf file for projection, or posting the solution in a display case under
glass, so as to reveal the answer while discouraging photocopying or electronic scanning.
At the same time, it is prudent for instructors to expect that some students will have
access to the solutions and thus an unfair advantage over their classmates who do not. If
you suspect this might be the case, you should consider assigning textbook exercises whose
solutions are not included in this Manual or making up problems of your own, perhaps
modeled on exercises in the textbook.
Chapter 2 of this Manual provides solutions to about half of the exercises in the text,
distributed in such a way as to represent each problem type in each chapter while favoring
easy problems and early chapters. Chapter 3 of this Manual contains some additional
exercises and their solutions. Chapter 4 contains some materials that I have found useful
in teaching programming from Classical FORTRAN.
1
@@SSee
isis
mmiciicsis
oolala
titoionn
, 2
Solutions to the Exercises
Each ssolution sincludes smy srough sestimate sof show sdifficult sthe sexercise sis. s Easy
sproblems, smarked s[E], stest sthe sstudent’s srecall sof sfacts sand sconcepts sdiscussed
sin sthe stext. s Hard sproblems, smarked s[H], sneed ssome sindependent sthought sand
spossibly ssome sprogramming sbut susually sdo snot sexplicitly srequire sthe sstudent sto
sdeliver sa sprogram. s Projects, smarked s[P], stypically sask sfor sa sfinished sprogram sas
spart sof sthe ssolution sto sthe sexercise, sand sin smost scases sproviding sone srequires
sanalysis, sprogram sdesign, sand sdebugging sas swell sas scoding sin sFORTRAN. s The
sfraction sof ssolutions spresented shere svaries sfrom sone spart sof sthe stextbook sto sanother
sand sby sproblem sdifficulty, saccording sto sthe stable sbelow.
part s (see s §0.5.3) [E] [H] [P]
s easy s hard s project
INSPIRATION none none none
1 1
ELEMENTARY all 2 3
1 1 1
INTERMEDIATE 2 3 4
1 1 1
ADVANCED 3 4 5
REFERENCE none none none
The s parts s of s the s book s that s are s listed s in s the s left s column s are s those s identified s in s the
s table s of
§0.5.3 sin sthe stext. s The sactual snumber sof ssolutions sprovided sfor seach schapter sand
sdifficulty⌈ s× ⌉ sis s n s f s , swhere sn sis sthe snumber sof sproblems shaving sthat
level
sdifficulty sin sthe schapter sand sf sis sthe sfraction ssolved sof sthat sdifficulty sin sthe
spart sof sthe sbook sto swhich sthe schapter sbelongs. s Applying s the s formula syields sthe
s distribution s of ssolutions sshown sin s the s table s on sthe snext spage.
Many sof sthe ssolutions sprovide sa smore sthorough sdiscussion sof sthe sproblem sthan
sone smight sexpect sfrom sa sstudent, sa sfew srefer sincidentally sto stext ssections sthat sthe
sstudent sneed snot shave sread syet, sand ssome sof sthe sprojects sare ssufficiently sopen-ended
sthat smany sdifferent s“answers” scould sbe sconsidered scorrect. sThus, sthese ssolutions sare
smeant sto senlighten sthe sgrader srather sthan sto sserve sas sstrict stemplates sagainst
swhich sstudent swork sis sdirectly scompared.
Because seach ssolution sis sself-contained, sliterature scitations sin sthis sManual s are sgiven
swithin seach ssolution srather sthan sbeing scollected sin sa sbibliography. s Section
sreferences sappearing sin sthe ssolutions sare sto ssections sin sthe stextbook, snot sto
ssections sof sthis sManual. s Output sformatting sin sthe sterminal ssession sexcerpts svaries
sslightly sdepending son sthe sUNIXTM ssystem s (Sun, sIBM, sSGI, sor sLinux) sthat sI sused sto
srun seach sprogram.
If s you s need s a s solution s that s was s not s selected s for s inclusion s here, s please
s contact s the s author sby ssending semail sto sor spaper smail sto sPO sBox
s215, sCropseyville, sNY s12052.
@@SSee
isis
mmiciicsis
oolala
titoionn