Introduction To Programming Using Fortran 95/2003/2008

3y ago
26 Views
2 Downloads
1.95 MB
237 Pages
Last View : 2m ago
Last Download : 3m ago
Upload by : Gannon Casey
Transcription

Introduction toProgrammingusingFortran 95/2003/2008Ed JorgensenMarch 2018Version 3.0.51

Cover DiagramThe cover image is the plotted output from the chaos game program from chapter 11.The image was plotted with GNUplot.CopyrightEd Jorgensen 2013, 2014, 2015, 2016, 2017, 2018You are free: to Share — to copy, distribute and transmit the work to Remix — to adapt the workUnder the following conditions: Attribution. You must attribute the work to “Introduction to Programming using Fortran95/2003/2008” (but not in any way that suggests that the author endorses you or youruse of the work). Share Alike. If you alter, transform, or build upon this work, you may distribute theresulting work only under the same, similar or a compatible license.For any reuse or distribution, you must make clear to others the license terms of this work. Thebest way to do this is with a link to http://creativecommons.org/licenses/by-sa/3.0/Any of the above conditions can be waived if you get permission from the copyright holder.Nothing in this license impairs or restricts the author's moral rights.ii

Table of Contents1 Introduction.1.1 Why Learn Programming.1.2 Fortran.1.3 Complete Fortran 95/2003/2008 Documentation.1.4 What Is A Program.1.5 Operating System.1111222 Computer Organization.2.1 Architecture Overview.2.2 Compiler.2.3 Information Representation.2.3.1 Decimal Numbers.2.3.2 Binary Numbers.2.3.3 Character Representation.2.4 Exercises.2.4.1 Quiz Questions.3344455553 Getting Started. 73.1 Required Skills. 73.2 Program Formats. 73.2.1 Program Statement. 73.2.2 Comments. 83.2.3 Simple Output. 83.2.4 Example – First Program. 83.3 Text Editor. 83.4 Compiling. 93.4.1 Advanced Compiler Options. 93.5 Executing. 93.6 Exercises. 103.6.1 Quiz Questions. 103.6.2 Suggested Projects. 114 Fortran 95/2003/2008 – Basic Elements.4.1 Variables.4.1.1 Variable Names.4.1.2 Keywords.4.2 Data Types.4.2.1 Integer.4.2.2 Real.4.2.3 Complex.4.2.4 Character.4.2.5 Logical.4.2.6 Historical Data Typing.4.3 Declarations.iii131313141414151515151516

4.3.1 Declaring Variables.4.3.2 Variable Ranges.4.3.3 Type Checking.4.3.4 Initialization.4.3.5 Constants.4.4 Comments.4.5 Continuation Lines.4.5.1 Example.4.6 Declarations, Extended Size Variables.4.6.1 Integers.4.6.2 Real.4.7 Exercises.4.7.1 Quiz Questions.4.7.2 Suggested Projects.16161617171718181819191919205 Expressions.5.1 Literals.5.1.1 Integer Literals.5.1.2 Real Literals.5.1.2.1 E-Notation.5.1.3 Complex Literals.5.1.4 Character Literals.5.1.5 Logical Constants.5.2 Arithmetic Operations.5.2.1 Assignment.5.2.2 Addition.5.2.3 Subtraction.5.2.4 Multiplication.5.2.5 Division.5.2.6 Exponentiation.5.3 Order of Operations.5.4 Intrinsic Functions.5.4.1 Mathematical Intrinsic Functions.5.4.2 Conversion Functions.5.4.3 Summary.5.5 Mixed Mode.5.6 Examples.5.7 Exercises.5.7.1 Quiz Questions.5.7.2 Suggested 7282828296 Simple Input and Output.6.1 Output – Write.6.1.1 Output – Print.6.2 Input – Read.6.3 Example.6.4 Exercises.313132323334iv

6.4.1 Quiz Questions. 346.4.2 Suggested Projects. 347 Program Development.7.1 Understand the Problem.7.2 Create the Algorithm.7.3 Implement the Program.7.4 Test/Debug the Program.7.4.1 Error Terminology.7.4.1.1 Compiler Error.7.4.1.2 Run-time Error.7.4.1.3 Logic Error.7.5 Exercises.7.5.1 Quiz Questions.7.5.2 Suggested Projects.3737383839404040414242428 Selection Statements.8.1 Conditional Expressions.8.2 Logical Operators.8.3 IF Statements.8.3.1 IF THEN Statement.8.3.1.1 IF THEN Statement, Simple Form.8.3.2 IF THEN ELSE Statement.8.3.3 IF THEN ELSE IF Statement.8.4 Example One.8.4.1 Understand the Problem.8.4.2 Create the Algorithm.8.4.3 Implement the Program.8.4.4 Test/Debug the Program.8.5 SELECT CASE Statement.8.6 Example Two.8.6.1 Understand the Problem.8.6.2 Create the Algorithm.8.6.3 Implement the Program.8.6.4 Test/Debug the Program.8.7 Exercises.8.7.1 Quiz Questions.8.7.2 Suggested 5569 Looping.9.1 Counter Controlled Looping.9.2 EXIT and CYCLE Statements.9.3 Counter Controlled Example.9.3.1 Understand the Problem.9.3.2 Create the Algorithm.9.3.3 Implement the Program.9.3.4 Test/Debug the Program.5959616162626263v

9.4 Conditional Controlled Looping.9.5 Conditionally Controlled Loop Example.9.5.1 Understand the Problem.9.5.2 Create the Algorithm.9.5.3 Implement the Program.9.5.4 Test/Debug the Program.9.6 Exercises.9.6.1 Quiz Questions.9.6.

You must attribute the work to “Introduction to Programming using Fortran 95/2003/2008” (but not in any way that suggests that the author endorses you or your use of the work). Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license.

Related Documents:

Course focus on Fortran 90 (called Fortran for simplicity) Changes in later versions (mostly) not important for us ‣ Fortran 95: Minor revision of Fortran 90 ‣ Fortran 2003: Major additions to Fortran 95 ‣ Fortran 2008: Minor revision of Fortran 2003 gfortran compiler: ‣ Fortran 95: Completely supported

Fortran Evolution Fortran stands for FORmula TRANslation. The first compiler appeared in 1957 and the first official standard in 1972 which was given the name of Fortran 66'. This was updated in 1980 to Fortran 77, updated in 1991 to Fortran 90, updated in 1997 to Fortran 95, and further updated in 2004 to Fortran 2003. At each update some

INTRODUCTION TO ABSOFT FORTRAN Absoft Fortran is a complete implementation of the FORTRAN programming languages: FORTRAN 77, Fortran 90, and Fortran 95. It also completely implements ISO Technical Reports TR15580 and TR15581. The microprocessor-based computers of today are vastly more powerful and sophisticated than their predecessors.

Fortran is short for FORmula TRANslation and this guide is based on Fortran 90, which is a version agreed in 1990. Fortran 95, a later standard, was a minor revision of Fortran 90. The latest standard, Fortran 2003, is now supported by some compilers as well. Fortran was developed for general scientific computing and is a very

Build with the Composer Edition (Continued) Boost Fortran Application Performance INTEL FORTRAN COMPILER on Linux* using Intel Fortran Compiler (Higher is Better) Deliver superior Fortran application performance. Get extensive support for the latest Fortran standards (including full Fortran

modern programming language. Fortran 95 is a small extension of Fortran 90. These latest versions of Fortran has many of the features we expect from a mod-ern programming languages. Now we have the Fortran 2003 which incorporates

Lahey/Fujitsu Fortran 95 (LF95) is a complete implementation of the Fortran 95 standard. Numerous popular extensions are supported. This manual is intended as a reference to the Fortran 95 language for programmers with expe-rience in Fortran. For information on creating programs using the LF95 Language System,

Lahey/Fujitsu Fortran 95 (LF95) is a complete implementation of the Fortran 95 standard. Numerous popular extensions are supported. This manual is intended as a reference to the Fortran 95 language for programmers with expe-rience in Fortran. For information on creating programs using the LF95 Language System,