Page - XV - in Programming for Computations β Python - A Gentle Introduction to Numerical Simulations with Python
Image of the Page - XV -
Text of the Page - XV -
ListofExercises
Exercise1.1: Errormessages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Exercise1.2:Volumeofacube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Exercise1.3:Areaandcircumferenceofacircle . . . . . . . . . . . . . . . . . . 27
Exercise1.4:Volumesof threecubes . . . . . . . . . . . . . . . . . . . . . . . . . 27
Exercise1.5:Averageof integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Exercise1.6: Interactivecomputingofvolumeandarea . . . . . . . . . . . . . . 27
Exercise1.7: Peculiar results fromdivision . . . . . . . . . . . . . . . . . . . . . 28
Exercise1.8:Updatevariableat commandprompt . . . . . . . . . . . . . . . . . 28
Exercise1.9: Formattedprint to screen . . . . . . . . . . . . . . . . . . . . . . . . 28
Exercise1.10: Pythondocumentationandrandomnumbers . . . . . . . . . . . 28
Exercise2.1: Errorswithcolon, indent, etc. . . . . . . . . . . . . . . . . . . . . . 44
Exercise2.2:Compare integersaandb . . . . . . . . . . . . . . . . . . . . . . . . 45
Exercise2.3: Functions forcircumferenceandareaofacircle . . . . . . . . . . 45
Exercise2.4: Function forareaofa rectangle . . . . . . . . . . . . . . . . . . . . 45
Exercise2.5:Areaofapolygon. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Exercise2.6:Averageof integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Exercise2.7:While loopwitherrors . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Exercise2.8:Areaof rectangleversuscircle . . . . . . . . . . . . . . . . . . . . . 47
Exercise2.9: Findcrossingpointsof twographs . . . . . . . . . . . . . . . . . . 47
Exercise2.10: Sort arraywithnumbers . . . . . . . . . . . . . . . . . . . . . . . . 47
Exercise2.11:Compute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Exercise2.12:Computecombinationsof sets . . . . . . . . . . . . . . . . . . . . 48
Exercise2.13: Frequencyof randomnumbers . . . . . . . . . . . . . . . . . . . . 49
Exercise2.14:Game21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Exercise2.15: Linear interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Exercise2.16: Test straight line requirement . . . . . . . . . . . . . . . . . . . . . 50
Exercise2.17: Fit straight line todata . . . . . . . . . . . . . . . . . . . . . . . . . 50
Exercise2.18: Fit sines to straight line . . . . . . . . . . . . . . . . . . . . . . . . 51
Exercise2.19:Countoccurrencesofa string ina string . . . . . . . . . . . . . . 52
Exercise3.1:Handcalculations for the trapezoidalmethod . . . . . . . . . . . . 88
Exercise3.2:Handcalculations for themidpointmethod . . . . . . . . . . . . . 88
Exercise3.3:Computea simple integral . . . . . . . . . . . . . . . . . . . . . . . 88
Exercise3.4:Hand-calculationswith sine integrals . . . . . . . . . . . . . . . . . 88
Exercise3.5:Make test functions for themidpointmethod . . . . . . . . . . . . 88
xv