g g g
SOLUTIONS
,Contents
1 AboutgThisgSolutionsgManual 1
1.1 Togtheg Student .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 1
1.2 Tog theg Instructorg g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 1
2 Solutionsgtogtheg Exercises 3
Chapterg 1 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 5
Chapterg 2 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 9
Chapterg 3 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 17
Chapterg 4 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 33
Chapterg 5 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 75
Chapterg 6 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 95
Chapterg 7 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 115
Chapterg 8 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 121
Chapterg 9 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 129
Chapterg 10 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 139
Chapterg 11 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 159
Chapterg 12 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 171
Chapterg 13 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 179
Chapterg 14 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 189
Chapterg 15 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 195
Chapterg 16 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 201
Chapterg 17 .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g .g . 207
3 Extrag Exercisesg andg Theirg Solutions 221
4 Teachingg FORTRANg Programming 259
v
@@SSee
isis
mmiciicsis
oolala
titoionn
,1
About This Solutions Manual
g g g
1.1 TogthegStudent
Thisg Solutionsg Manualg isg intendedg forg theg instructorg ofg ag courseg thatg usesg Classicalg FORTRAN
asg ag textbook,g andg forg theg studentg whog isg learningg theg subjectg independently.
Ifgyougaregagstudentgtakingg theg courseg forgcreditgyougshouldgknowgthatgitgisgagviolationg
ofgacademicgethicsgforgyougtogconsultgthisgSolutionsgManual,gwhethergyougcopygverbatimgfro
mgitgorgonlygusegitgtoggetgideasgaboutghowgtogworkgthegexercises.g Thegexercisesgaregagvaluabl
egaidgtoglearninggthegmaterialgingthegtextbook,gbutgonlygifgyougworkgthemgyourselfg!gLookinggu
pgtheganswersginsteadgofgfiguringgthemgoutgdeprivesgyougofgangopportunitygtoglearngthegmate
rial.g Ifganganswergisgforgcredit,gcheatinggisgalsogpersonallygdegradinggtogyougandgunfairg tog you
rg classmates,g andg itg mightg placeg youg ing jeopardyg ofg disciplinaryg action.g Ifg thisgisgangillicitgco
py,gpleasegdestroygitgnow.g Ifgthisgisgagstolengcopy,gpleasegreturngitgtogitsgrightfulgowner.g Eithe
rgway,gSTOPgREADING.
Ifgyougaregagstudentglearninggthegsubjectgbygyourselfgthengyougaregyourgownginstruc-
tor.g Pleaseg readg theg nextg section.
1.2 TogthegInstructor
Thisg Solutionsg Manualg isg intendedg forg theg instructorg ofg ag courseg thatg usesg Classicalg FORTRAN
asg ag textbook,g andg forg theg studentg whog isg learningg theg subjectg independently.
Ifgyougaregingeithergcategorygyougshouldgknowgthatgitggreatlygdiminishesgthegusefulnessgofgt
hegexercisesgforggradedgworkgifgtheirgsolutionsgbecomegpublic.g Pleasegrefraingfromgloaninggth
isgbookgtogothers,gdistributinggsolutionsgtogothers,gorgpostinggsolutionsgongthegWorldgWidegW
eb.g Ifgyougwantgtogshowgaggroupghowgtogsolvegagproblem,gIgsuggestgmakinggagtransparencygor
g scanningg tog ag.pdfgfileg forg projection,g org postingg theg solutiong ing ag displaygcaseg underggla
ss,gsogasgtogrevealgtheganswergwhilegdiscouraginggphotocopyinggorgelectronicgscanning.
Atgthegsamegtime,gitgisgprudentgforginstructorsgtogexpectgthatgsomegstudentsgwillghavegacce
ssgtogthegsolutionsgandgthusgangunfairgadvantagegovergtheirgclassmatesgwhogdognot.g Ifgyougsu
spectgthisgmightgbegthegcase,gyougshouldgconsidergassigninggtextbookgexercisesgwhosegsoluti
onsgaregnotgincludedgingthisgManualgorgmakinggupgproblemsgofgyourgown,gperhapsgmodeledg
ongexercisesgingthegtextbook.
Chapterg2gofgthisgManualgprovidesgsolutionsgtogaboutghalfgofgthegexercisesgingthegtext,gdistr
ibutedgingsuchgagwaygasgtogrepresentgeachgproblemgtypegingeachgchaptergwhilegfavoringgeasyg
problemsgandgearlygchapters.g Chapterg3gofgthisgManualgcontainsgsomegadditionalgexercisesg
andg theirg solutions.g Chapterg 4g containsg someg materialsg thatgIghaveg foundg usefulging teachi
nggprogramminggfromgClassicalg FORTRAN.
1
@@SSee
isis
mmiciicsis
oolala
titoionn
, 2
Solutions to the Exercises
g g g
Eachgsolutiongincludesgmygroughgestimategofghowgdifficultgthegexercisegis.g Easygproblems,
gmarkedg[E],gtestgthegstudent’sgrecallgofgfactsgandgconceptsgdiscussedgingthegtext.g Har
dgproblems,gmarkedg[H],gneedgsomegindependentgthoughtgandgpossiblygsomegprogrammi
nggbutgusuallygdognotgexplicitlygrequiregthegstudentgtogdelivergagprogram.g Projects,gmark
edg[P],gtypicallygaskgforgagfinishedgprogramgasgpartgofgthegsolutiongtogthegexercise,gandgingm
ostgcasesgprovidinggonegrequiresganalysis,gprogramgdesign,gandgdebugginggasgwellgasgcodin
ggingFORTRAN.g Thegfractiongofgsolutionsgpresentedgheregvariesgfromgonegpartgofgthegtextbookgtog
anothergandgbygproblemgdifficulty,gaccordinggtogthegtablegbelow.
partg (seeg §0.5.3) [E]g easy [H]g hard [P]g 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
Theg partsg ofg theg bookg thatg areg listedg ing theg leftg columng areg thoseg identifiedg ing theg tableg of
§0.5.3gingthegtext.g Thegactualgnumbergofgsolutionsgprovidedgforgeachgchaptergandgdifficulty
glevelgisg⌈gngg×fggg,g whereg ngisgthegnumbergofg problemsg havinggthatgdifficultygingthegchapterg a
⌉ gfractiongsolvedgofgthatgdifficultygingthegpartgofgthegbookgtogwhichgthegchapterg
ndgfgisgthe
belongs.g Applyingg theg formulagyieldsgtheg distributiong ofgsolutionsgshownging theg tableg ongthegn
extgpage.
Manygofgthegsolutionsgprovidegagmoregthoroughgdiscussiongofgthegproblemgthangonegmight
gexpectgfromgagstudent,gagfewgrefergincidentallygtogtextgsectionsgthatgthegstudentgneedgnotghav
egreadgyet,gandgsomegofgthegprojectsgaregsufficientlygopen-
endedgthatgmanygdifferentg“answers”gcouldgbegconsideredgcorrect.gThus,gthesegsolutionsgareg
meantgtogenlightengtheggradergrathergthangtogservegasgstrictgtemplatesgagainstgwhichgstudent
gworkgisgdirectlygcompared.
Becausegeachgsolutiongisgself-
contained,gliteraturegcitationsgingthisgManualg areggivengwithingeachgsolutiongrathergthangbeing
gcollectedgingagbibliography. g Sectiongreferencesgappearinggingthegsolutionsgaregtog sections
gingthegtextbook,g notgtog sectionsgofgthisg Manual.g Outputgformattinggingthegterminalgsessiong
excerptsgvariesgslightlygdependinggongthegUNIXTMgsystemg (Sun,gIBM,gSGI,gorgLinux)gthatgIguse
dgtogrungeachgprogram.
Ifg youg needg ag solutiong thatg wasg notg selectedg forg inclusiong here,g pleaseg contactg theg author
mailgtog POgBoxg215,gCropseyville,gNYg12052
.
@@SSee
isis
mmiciicsis
oolala
titoionn