1. Computing Environments for Problem Solving.- 1.1 A Brief History of Electronic Computing.- 1.1.1 The First Generation.- 1.1.2 The Second and Third Generations.- 1.1.3 The Fourth Generation.- 1.2 The Academic Computing Environment.- 1.2.1 The Department-Based Computing Environment.- 1.2.2 The Personal Computing Environment.- 1.3 What Do You Need to Know About Your Computing Environment?.- 1.4 Fortran and the Personal Computing Environment.- 1.5 Is Programming Necessary Anymore?.- 1.6 Exercises.- 2. Solving Problems with a High-Level Programming Language.- 2.1 Structured Programming and Problem Solving.- 2.1.1 A High-Level Programming Language Provides the Tool.- 2.1.2 Developing a Formal Approach to Problem Solving.- 2.1.3 Beware of Logical Errors.- 2.2 Designing Algorithms for Procedural Programming Languages.- 2.2.1 Getting Started.- 2.2.2 Executable Instructions.- 2.2.3 Data Types and Variables.- Data types.- Variables.- 2.2.4 Designing Algorithms for Solving Problems.- Defining a pseudocode language.- The three basic program control structures.- Adding to your pseudocode vocabulary.- Flowcharts: another way to visualize algorithms.- 2.3 Program Modularization.- 2.4 Applications.- 2.4.1 Maximum Deflection of a Beam Under Load.- 2.4.2 Oscillating Frequency of an LC Circuit.- 2.5 Debugging Your Algorithms.- 2.5.1 Algorithm Style.- 2.5.2 Problems with Your Algorithms.- 2.6 Exercises.- 2.6.1 Self-Testing Exercises.- 2.6.2 Basic Algorithm Development Exercises.- 2.6.3 Algorithm Development Applications.- 3. Getting Started with Fortran: Writing Simple Programs.- 3.1 A Simple Problem and a Fortran Program to Solve It.- 3.2 Program Layout.- 3.2.1 What Is "Source Code?".- 3.2.2 Where Does Source Code Come From?.- 3.2.3 Why Do the Fortran Statements All Start in Column 7?.- 3.2.4 Inserting Comments in Source Code Files.- 3.2.5 How Much of P-3.1 Is Absolutely Necessary and How Much Is a Matter of Style?.- 3.2.6 Fortran Keywords.- 3.2.7 What If a Statement Is Too Long to Fit on a Single Line?.- 3.2.8 Executable and Nonexecutable Statements.- 3.3 Declaring Variables and Defining Constants.- 3.3.1 Variable Names and Data Type Declarations.- 3.3.2 Intrinsic Data Types.- Type declarations for intrinsic data types.- Type declarations for numbers.- Type declarations for logical variables.- Type declarations for characters and strings of characters.- The PARAMETER attribute and statement.- Enforcing explicit typing.- The implications of type declaration.- Using nonexecutable statements in programs.- 3.3.3 Constants.- Integers and real numbers.- Logical constants.- Character constants.- 3.3.4 Initializing Values with the DATA Statement.- 3.4 List-Directed Input and Output.- 3.4.1 Reading and Displaying Numerical Values.- Displaying a prompt for user input.- Getting input from the keyboard.- Displaying output.- 3.4.2 Manipulating Text Information.- 3.5 Arithmetic Operators, Assignment Statements, and Calculations.- 3.5.1 Arithmetic Operators, Expressions, and the Assignment Operator.- 3.5.2 Assignment Statements That Increment Variables.- 3.5.3 Mixed-Mode Calculations.- 3.5.4 Using Compatible Constants.- 3.5.5 Operator Precedence.- 3.6 Program Termination.- 3.7 Compiling and Executing a Program.- 3.7.1 Source Code Portability.- 3.7.2 Compilation and Execution.- 3.7.3 Saving Output from Your Programs.- 3.8 Applications.- 3.8.1 Maximum Deflection of a Beam Under Load.- 3.8.2 Relativistic Mass and Speed of an Electron.- 3.9 Debugging Your Programs.- 3.9.1 Programming Style.- 3.9.2 Your Programs Will Often Contain Errors.- 3.9.3 Some Common Errors.- Compilation Errors.- Execution Errors.- Logical Errors.- 3.9.4 Forcing Your Programs to Fail.- 3.10 Exercises.- 3.10.1 Self-Testing Exercises.- 3.10.2 Basic Programming Exercises.- 3.10.3 Programming Applications.- 4. Using Functions to Expand the Power of Fortran.- 4.1 Fortran Intrinsic Functions.- 4.1.1 Intrinsic Functions for Arithmetic Calculations: Arguments and Ranges.- 4.1.2 Intrinsic Functions for Character and String Manipulation.- 4.1.3 Examples of Calculations Using Intrinsic Functions.- Polar/Cartesian conversions.- Calculating the absolute value.- The remainder from integer or real division.- 4.2 Fortran Statement Functions.- 4.3 Applications.- 4.3.1 Refraction of Light.- 4.3.2 Inverse Hyperbolic Functions.- 4.4 Debugging Your Programs.- 4.4.1 Programming Style.- 4.4.2 Problems with Programs.- 4.5 Exercises.- 4.5.1 Self-Testing Exercises.- 4.5.2 Basic Programming Exercises.- 4.5.3 Programming Applications.- 5. Gaining Control Over Program Output.- 5.1 The Formatted PRINT Statement.- 5.1.1 Introduction to Formatted Output.- 5.1.2 Format Descriptors for Numbers and Character Strings.- INTEGER descriptors.- REAL descriptors.- CHARACTER descriptors.- LOGICAL descriptor.- General descriptor.- String constant descriptors.- 5.1.3 Control Descriptors.- Carriage control.- Skipping spaces.- Sign display.- New lines.- Tabulation.- Format termination.- 5.1.4 Repeating Groups of Descriptors.- 5.1.5 Producing Formatted Output Without a FORMAT Statement.- 5.2 The WRITE Statement.- 5.2.1 Syntax of the WRITE Statement and the Standard Output Unit.- 5.2.2 Format Descriptors for the WRITE Statement.- 5.3 Saving Program Output.- 5.4 Applications.- 5.4.1 Stellar Magnitude and Distance.- 5.4.2 Relativistic Mass and Speed of an Electron.- 5.5 Debugging Your Programs.- 5.5.1 Programming Style.- 5.5.2 Problems with Programs.- 5.6 Exercises.- 5.6.1 Self-Testing Exercises.- 5.6.2 Basic Programming Exercises.- 5.6.3 Programming Applications.- 6. Program Control: Branching and Repetitive Calculations.- 6.1 Using Program Control Structures.- 6.1.1 The IF...THEN...(ELSE...) Pseudocode Construct.- 6.1.2 The CHOOSE Pseudocode Command.- 6.1.3 The LOOP...END LOOP Pseudocode Command.- Count-controlled loops.- Conditional loops.- 6.2 Relational and Logical Operators and the Fortran IF... Construct.- 6.2.1 Relational and Logical Operators.- 6.2.2 The IF... Construct.- 6.2.3 Using the IF... Construct in Programs.- 6.3 The SELECT CASE Construct.- 6.4 Fortran Loop Constructs.- 6.4.1 Count-Controlled (DO... ) Loops.- 6.4.2 Pre- and Post-Test Conditional Loop Constructs.- Pre-test loops.- Post-test loops.- 6.4.3 Nested Loops.- 6.4.4 Loop Design Considerations.- 6.5 Using Implied DO... Loops in Output Statements.- 6.6 Applications.- 6.6.1 Refraction of Light.- 6.6.2 Oscillating Frequency of an LC Circuit.- 6.6.3 Calculating Radiation Exposures for a Materials Testing Experiment.- 6.6.4 Maximum Deflection of a Beam with Various Support/Loading Systems.- 6.7 Debugging Your Programs.- 6.7.1 Programming Style.- 6.7.2 Logical Problems.- 6.7.3 Syntax and Execution Problems.- 6.8 Exercises.- 6.8.1 Self-Testing Exercises.- 6.8.2 Basic Programming Exercises.- 6.8.3 Programming Applications.- 7. Program Modularization.- 7.1 Designing Modularized Algorithms with the CALL and SUBPROGRAM Pseudocode Commands.- 7.2 Fortran Subroutines.- 7.2.1 Using Subroutines.- 7.2.2 Controlling the Flow of Information.- Expressing intent.- Enforcing intent.- 7.2.3 More About SUBROUTINE Syntax.- 7.3 Fortran Functions.- 7.4 Using Subroutines and Functions.- 7.4.1 Using the MODULE Structure for Passing Information to Subroutines and Functions.- 7.4.2 Initializing Information in Subroutines and Functions.- 7.4.3 Using Subroutines and Functions in Argument and Parameter Lists.- 7.4.4 Choosing Between Subroutines and Functions.- 7.5 Applications.- 7.5.1 Relativistic Mass and Speed of an Electron.- 7.5.2 A Function Library for Converting Units.- 7.5.3 A Simple Character-Based Function Plotter.- 7.6 Debugging Your Programs.- 7.6.1 Programming Style.- 7.6.2 Problems with Programs.- 7.7 Exercises.- 7.7.1 Self-Testing Exercises.- 7.7.2 Basic Programming Exercises.- 7.7.3 Programming Applications.- 8.
Using Arrays to Organize Information.- 8.1 Arrays in Structured Programming.- 8.2 Basic Array Implementation.- 8.2.1 Example: Testing a Random Number Generator.- 8.2.2 Declaring Arrays.- 8.2.3 Assigning Values to Arrays.- Assigning a value to an entire array or part of an array.- Assigning array elements with count-controlled loops.- Assigning values to individual array elements.- Using a DATA statement to initialize arrays.- Using elemental intrinsic functions.- 8.2.4 Displaying the Contents of Arrays (Implied DO... Loops).- 8.2.5 Example: Monthly Ozone Summary.- 8.3 Using Statically Allocated Arrays in Subprograms.- 8.4 Allocatable Arrays.- 8.5 Treating Strings of Characters as Arrays of Characters.- 8.6 The TYPE Statement, Records, and Arrays of Records.- 8.7 Applications.- 8.7.1 Vector Operations.- 8.7.2 Cellular Automata and Sierpinski Triangles.- 8.7.3 Probability Analysis for Quality Control of Manufacturing Processes.- 8.8 Debugging Your Programs.- 8.8.1 Programming Style.- 8.8.2 Problems with Programs That Use Arrays.- 8.9 Exercises.- 8.9.1 Self-Testing Exercises.- 8.9.2 Basic Programming Exercises.- 8.9.3 Programming Applications.- 9. Using Formatted Sequential Access and Internal Files.- 9.1 The Text File Concept.- 9.2 OPEN, READ, and CLOSE Statements for Sequential File Access.- 9.2.1 Reading a File Containing Student Names and Grades.- 9.2.2 The OPEN and REWIND Statements.- 9.2.3 The READ and BACKSPACE Statements.- 9.2.4 The CLOSE Statement.- 9.3 Files and Arrays.- 9.4 More About Formatted READ Statements.- 9.4.1 FORMAT Statements and Standard Field Descriptors.- 9.4.2 Reading Internal Files.- 9.5 Writing Text Files.- 9.6 Applications.- 9.6.1 Exponential Smoothing of Data.- 9.6.2 Billing Program for an Urban Water Utility.- 9.6.3 Merging Sorted Lists.- 9.6.4 Creating a "Quote-and-Comma-Delimited" Input File for Spreadsheets.- 9.7 Debugging Your Programs.- 9.7.1 Programming Style.- 9.7.2 Problems with Programs That Access External Data Files.- 9.8 Exercises.- 9.8.1 Self-Testing Exercises.- 9.8.2 Basic Programming Exercises.- 9.8.3 Programming Applications.- 10. Some Essential Programming Algorithms.- 10.1 Introduction.- 10.2 Searching Algorithms.- 10.2.1 Linear Searches.- 10.2.2 Binary Search.- 10.2.3 Comparing Searching Algorithms.- 10.2.4 A Driver Program for Testing Searching Algorithms.- 10.3 Sorting Algorithms.- 10.3.1 Selection Sort.- 10.3.2 Insertion Sort.- 10.3.3 Efficiency of Sorting Algorithms.- 10.3.4 A Driver Program for Testing Sorting Algorithms.- 10.4 Recursive Algorithms.- 10.5 The Recursive Quicksort Algorithm.- 10.6 Applications.- 10.6.1 Keeping a List of Words in Alphabetical Order.- 10.6.2 Evaluating Legendre Polynomials.- 10.7 Debugging Your Programs.- 10.7.1 Programming Style.- 10.7.2 Problems with Programs.- 10.8 Exercises.- 10.8.1 Self-Testing Exercises.- 10.8.2 Basic Programming Exercises.- 10.8.3 Programming Applications.- 11. Basic Statistics and Numerical Analysis with Fortran.- 11.1 Introduction.- 11.2 Basic Descriptive Statistics.- 11.2.1 The Sample Mean and Standard Deviation.- 11.2.2 Linear Regression and the Linear Correlation Coefficient.- 11.3 Numerical Differentiation.- 11.3.1 Newton's and Stirling's Formulas.- 11.3.2 Application. Estimating the Speed of a Falling Object.- 11.4 Numerical Integration.- 11.4.1 Polynomial Approximation Methods.- 11.4.2 Application: Evaluating the Gamma function.- 11.5 Solving Systems of Linear Equations.- 11.5.1 Linear Equations and Gaussian Elimination.- 11.5.2 Application: Current Flow in a DC Circuit with Multiple Resistive Branches.- 11.6 Finding the Roots of Equations.- 11.7 Numerical Solutions to Differential Equations.- 11.7.1 Motion of a Damped Mass and Spring.- 11.7.2 Application. Current Flow in a Series LRC Circuit.- 11.8 Exercises.- 11.8.1 Basic Programming Exercises.- 11.8.2 Programming Applications.- 12. A Closer Look.- 12.1 Introduction.- 12.2 Using More Than One Program Unit.- 12.2.1 Merging Source Code.- 12.2.2 Merging Object Code.- 12.3 The Internal Representation of Numbers and Extended Precision.- 12.3.1 Internal Representation of Numbers.- Integers.- Real Numbers.- 12.3.2 Specifying Precision for Numerical Variables.- 12.4 Array Operations and Array Inquiry and Reduction.- 12.4.1 Intrinsic Array Operations.- 12.4.2 Array Functions.- Array multiplication functions.- Array inquiry functions.- Array reduction functions.- 12.5 Direct Access and Unformatted (Binary) Files.- 12.5.1 Introduction to File Types.- 12.5.2 Using Other File Types.- 12.5.3 Example: Binary Search of a File.- 12.6 The COMPLEX Data Type.- 12.7 Data Sharing With COMMON Blocks.- Appendices.- Appendix 1. Table of ASCII Characters for IBM-Compatible PCs.- Appendix 2. Summary of Pseudocode Commands and Fortran Statement Syntax.- Appendix 2.1 Pseudocode Commands.- Appendix 2.2 Fortran Statement Syntax.- Appendix 3. Source Code File Name Summary.- Appendix 4. Accessing the System Time and Date.