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 fsolution fincludes fmy frough festimate fof fhow fdifficult fthe fexercise fis. f Easy
fproblems, fmarked f[E], ftest fthe fstudent’s frecall fof ffacts fand fconcepts fdiscussed
fin fthe ftext. f Hard fproblems, fmarked f[H], fneed fsome findependent fthought fand
fpossibly fsome fprogramming fbut fusually fdo fnot fexplicitly frequire fthe fstudent fto
fdeliver fa fprogram. f Projects, fmarked f[P], ftypically fask ffor fa ffinished fprogram fas
fpart fof fthe fsolution fto fthe fexercise, fand fin fmost fcases fproviding fone frequires
fanalysis, fprogram fdesign, fand fdebugging fas fwell fas fcoding fin fFORTRAN. f The ffraction
fof fsolutions fpresented fhere fvaries ffrom fone fpart fof fthe ftextbook fto fanother fand fby
fproblem fdifficulty, faccording fto fthe ftable fbelow.
part f (see f §0.5.3) [E] [H] [P]
f easy f hard f 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 f parts f of f the f book f that f are f listed f in f the f left f column f are f those f identified f in f the f table
f of
§0.5.3 fin fthe ftext. f The factual fnumber fof fsolutions fprovided ffor feach fchapter fand
fdifficulty⌈ f× ⌉ fis f n f f f , fwhere fn fis fthe fnumber fof fproblems fhaving fthat
level
fdifficulty fin fthe fchapter fand ff fis fthe ffraction fsolved fof fthat fdifficulty fin fthe fpart
fof fthe fbook fto fwhich fthe fchapter fbelongs. f Applying f the f formula fyields fthe
f distribution f of fsolutions fshown fin f the f table f on fthe fnext fpage.
Many fof fthe fsolutions fprovide fa fmore fthorough fdiscussion fof fthe fproblem fthan fone
fmight fexpect ffrom fa fstudent, fa ffew frefer fincidentally fto ftext fsections fthat fthe fstudent
fneed fnot fhave fread fyet, fand fsome fof fthe fprojects fare fsufficiently fopen-ended fthat
fmany fdifferent f“answers” fcould fbe fconsidered fcorrect. fThus, fthese fsolutions fare
fmeant fto fenlighten fthe fgrader frather fthan fto fserve fas fstrict ftemplates fagainst fwhich
fstudent fwork fis fdirectly fcompared.
Because feach fsolution fis fself-contained, fliterature fcitations fin fthis fManual f are fgiven
fwithin feach fsolution frather fthan fbeing fcollected fin fa fbibliography. f Section
freferences fappearing fin fthe fsolutions fare fto fsections fin fthe ftextbook, fnot fto
fsections fof fthis fManual. f Output fformatting fin fthe fterminal fsession fexcerpts fvaries
fslightly fdepending fon fthe fUNIXTM fsystem f (Sun, fIBM, fSGI, for fLinux) fthat fI fused fto
frun feach fprogram.
If f you f need f a f solution f that f was f not f selected f for f inclusion f here, f please f contact
f the f author fby fsending femail fto for fpaper fmail fto fPO fBox f215,
fCropseyville, fNY f12052.
@@SSee
isis
mmiciicsis
oolala
titoionn