Introduction to Computing and Fortran: History and Development, Study notes of Research Methodology

An overview of the history and development of computing systems, focusing on the concepts of mechanization of arithmetic and stored programs. It also introduces fortran as a high-level programming language and discusses its applications in hydrologic modeling. Topics such as acronyms, computing system development, software, fortran development, and fortran applications.

Typology: Study notes

2012/2013

Uploaded on 10/03/2013

abani
abani 🇮🇳

4.4

(34)

81 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Introduction to Computing and Basic Fortran
1. Miscellaneous Knowledge and Acronyms (primarily compiled from Nyhoff and Leestma [1996])
1.1. Acronyms
Fortran: Formula translation
ANSI: American National Standard Institute
ISO: International Standards Organization
ASCII: American Standard Code for Information Interchange
IBM: International Business Machines Corporation
1.2. Development of Computing Systems
Two important concepts: mechanization of arithmetic and stored program
Mechanical devices: abacus used by Chinese 3–4 kyr ago; slide rule invented by English
mathematician W. Oughtred in early 1600s; one of the first mechanical adding machines invented
by French mathematician B. Pascal in 1642, which was improved to perform multiplication by
German mathematician G.W. von Leibniz; similar calculators became important tools in science,
business and commerce by the end of the 19
th
century
Stored program: weaving loom designed by Frenchman J.M. Jacquard using punched cards to
position threads for weaving process
Combining the two concepts: Difference Engine designed by English mathematician C. Babbage in
1822 to compute polynomials; Analytical Engine designed later by C. Babbage and his associate A.
Augusta (considered by some to be the first programmer), which had multipurpose components for
arithmetic computations, storing data and intermediate results, and inputting and outputting
information; a punched-card system designed by H. Hollerith for US census bureau in 1890, who
later formed his own tabulating company, which in 1924 became IBM; continued efforts in
developing computing devices in the US by pioneers including H. Aiken, J. Atanasoff, J.P. Eckert,
J.W. Mauchly, and J. von Newmann led to the first electromechanical Mark I computer in 1944 at
IBM
Electronic computers: first fully electronic computer developed by J. Atanasoff at Iowa State Univ.
between 1939–1942, followed by the well known ENIAC (Electronic Numerical Integrator and
Computer) constructed by J.P. Eckert and J.W. Mauchly at Univ. Penn.
Computers categorized by the type of hardware (the physical components used in constructing a
computer system): first-generation (e.g., ENIAC) with extensive use of vacuum tubes; second-
generation (IBM 7090, built in 1958) using transistors in place of vacuum tubes; third-generation
(IBM System/360, built in 1964) using integrated circuits with better system utilization;
microprocessor (4004) introduced by R. Noyce at Intel Corporation; fourth-generation developed in
1980–1990 using very large-scale integrated circuits (VLSI) on silicon chips; development of
personal computers made possible owing to the birth of microprocessors, represented by Apple II
designed by S. Jobs and S. Wozniak in 1977, and the first of IBM’s PCs in 1981
1.3. Terms
Hardware
CPU: Central Processing Unit, the heart of a computing system that controls the entire operation of
the system, performs the arithmetic and logic operations, and stores and retrieves instructions and
data. A CPU generally consists of a control unit, an arithmetic and logic unit, and a memory unit.
1
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Introduction to Computing and Fortran: History and Development and more Study notes Research Methodology in PDF only on Docsity!

Introduction to Computing and Basic Fortran

1. Miscellaneous Knowledge and Acronyms (primarily compiled from Nyhoff and Leestma [1996])

1.1. Acronyms

  • Fortran: Formula translation
  • ANSI: American National Standard Institute
  • ISO: International Standards Organization
  • ASCII: American Standard Code for Information Interchange
  • IBM: International Business Machines Corporation

1.2. Development of Computing Systems

  • Two important concepts: mechanization of arithmetic and stored program
  • Mechanical devices: abacus used by Chinese 3–4 kyr ago; slide rule invented by English mathematician W. Oughtred in early 1600s; one of the first mechanical adding machines invented by French mathematician B. Pascal in 1642, which was improved to perform multiplication by German mathematician G.W. von Leibniz ; similar calculators became important tools in science, business and commerce by the end of the 19 th^ century
  • Stored program: weaving loom designed by Frenchman J.M. Jacquard using punched cards to position threads for weaving process
  • Combining the two concepts: Difference Engine designed by English mathematician C. Babbage in 1822 to compute polynomials; Analytical Engine designed later by C. Babbage and his associate A. Augusta (considered by some to be the first programmer), which had multipurpose components for arithmetic computations, storing data and intermediate results, and inputting and outputting information; a punched-card system designed by H. Hollerith for US census bureau in 1890, who later formed his own tabulating company, which in 1924 became IBM; continued efforts in developing computing devices in the US by pioneers including H. Aiken , J. Atanasoff , J.P. Eckert , J.W. Mauchly , and J. von Newmann led to the first electromechanical Mark I computer in 1944 at IBM
  • Electronic computers: first fully electronic computer developed by J. Atanasoff at Iowa State Univ. between 1939–1942, followed by the well known ENIAC (Electronic Numerical Integrator and Computer) constructed by J.P. Eckert and J.W. Mauchly at Univ. Penn.
  • Computers categorized by the type of hardware (the physical components used in constructing a computer system): first-generation (e.g., ENIAC) with extensive use of vacuum tubes; second- generation (IBM 7090, built in 1958) using transistors in place of vacuum tubes; third-generation (IBM System/360, built in 1964) using integrated circuits with better system utilization; microprocessor (4004) introduced by R. Noyce at Intel Corporation; fourth-generation developed in 1980–1990 using very large-scale integrated circuits (VLSI) on silicon chips; development of personal computers made possible owing to the birth of microprocessors, represented by Apple II designed by S. Jobs and S. Wozniak in 1977, and the first of IBM’s PCs in 1981

1.3. Terms

Hardware

  • CPU: Central Processing Unit, the heart of a computing system that controls the entire operation of the system, performs the arithmetic and logic operations, and stores and retrieves instructions and data. A CPU generally consists of a control unit, an arithmetic and logic unit, and a memory unit.
  • Components of the memory unit: (1) Random Access Memory (RAM, also called internal, main, or primary memory) for storing the instructions and data of the programs being executed, (2) registers, which are a set of special high-speed memory locations, and (3) Read-Only Memory (ROM). Values that are stored in registers can typically be accessed thousands of times faster than can values stored in RAM. Both RAM and registers are volatile memory components in that information stored in these components is lost if the power to the computing system is shut off. ROM is nonvolatile memory used to store important (too important to lose) information, such as start-up instructions
  • External memory: also called auxiliary or secondary memory of which a common form is CD- ROMs. The time required to access data stored on such media can be much greater than the access time for data stored in RAM
  • Peripheral devices: include external memory and I/O devices (e.g., terminals, scanners, printers)
  • Memory organization: computer memory unit uses binary scheme, i.e., the two binary digits (bits) 0 and 1, to represent information. Memory is commonly measured in bytes (1byte = 8 bits), and a block of 2^10 = 1,024 bytes is called 1 K of memory. Hence, one megabyte (= 1,024 K) consists of 1,024×1,024 = 1,048,576 bytes, or, equivalently, 1,048,576×8 = 8,388,608 bits. Bytes are usually grouped together into words. The number of bits in a word is equal to the number of bits in a CPU register or to the length of the units of information handled by a computer’s microprocessor (chip). The longer these units, the faster the computer. Typical word sizes are 16 or 32 bits, and microcomputers are often referred to as 8-, 16- or 32-bit machines

Software

  • System software: collections of programs that facilitate and monitor computer use, including operating systems, utilities, compilers, and database management systems; usually provided by either the hardware vendor or a software supplier
  • Operating system: software that controls the activities of a computer (e.g., job control, scheduling, allocating system resources, I/O, memory management) and acts as an interface between the user and the computer
  • Typical operating systems: UNIX, developed in 1971 by K. Thompson and D. Ritchie at AT&T’s Bell Laboratories; MS-DOS developed in 1981 by W.H. Gates , founder of the Microsoft Corporation; the recent GUIs (Graphical User Interfaces) such as MIT’s X Window System for UNIX machines, Microsoft’s Windows TM^ , and Apple’s Macintosh OSX.
  • High-level language: computer language that is similar to natural language, e.g., Fortran, BASIC, COBOL, Pascal, Ada, Modula-2, C, C++
  • Procedural language: a high-level, machine-independent language that enables the user to describe the steps for the solution of a problem via a set of algorithms or procedures
  • Source program: a program written in a high-level language
  • Machine language: the language directly used by a computer
  • Object program: a program written in a machine language
  • Compilers: programs that translate source programs into object programs

1.4. Development of Fortran

  • First developed by J. Backus and a team of 13 programmers for the IBM 704 computer during 1954–1957; the fourth revision completed in 1962; the fifth revision appeared in 1977, known as FORTRAN 77; an extensive revision known as Fortran 90 was prepared in 1990
  • Both FORTRAN 77 and Fortran 90 (note the official spelling with only F in upper case in Fortran
    1. are specified as American standards by ANSI, while Fortran 90 is the only international Fortran standard as decided by ISO
  • Organizations in charge of Fortran development: X3J3, an ANSI subcommittee, is dedicated to

declaration statements executable statements END

The END statement informs the compiler that there are no further Fortran statements to compile.

Statements Statements form the basis of any Fortran program, and may contain from 0 to 132 characters (a statement may be blank; the use of blank statements is encouraged to make a program more readable by separating logical sections.) Earlier versions of Fortran insisted that certain parts of a statement start in certain columns; Fortran 90 has no such restriction.

All statements, except the assignment statement (e.g., BALANCE = 1000), start with a keyword. Some keywords may be END, PRINT, PROGRAM, and REAL. Generally, there will be one statement per line. However, multiple statements may appear on a line if they are separated by semi-colons. For the sake of clarity, this is recommended only with very short assignments, such as

A = 1; B = 1; C = 1

Continuation Long statements may continue over several lines. In Fortran 90, if a statement is too long to fit on a line, it will be continued on the next line if the last non-blank character in it is an ampersand (&):

A = 174.6 * & (T! 1981.2) ** 3

Continuation is normally to the first character in the next non-comment line. However, if the first non-blank character of the continuation line is &, continuation is to the first character after the &. In this way a token (tokens are the units, such as identifier/variable name, assignment or arithmetic operators, or integer constants, that are recognized and analyzed by a compiler to generate an object program) may be split over two lines, although this is not recommended, since it makes the code less easy to read.

An & at the end of a comment line will not continue the comment, since the & is construed as part of the comment.

In FORTRAN 77, the continuation of a line is indicated by a non-zero, non-blank character in the sixth column.

Comments Any characters following an exclamation mark (!) (except in a character string) are commentary, and are ignored by the compiler. An entire line may be a comment, if started with “C” or “*”or “!” in FORTRAN and with “!” in Fortran 90. A blank line is also interpreted as comment. Comments should be used liberally to improve readability.

2.2. Data Type

The concept of a data type is fundamental in Fortran 90. A data type consists of a set of data values (e.g., the whole numbers), a means of denoting those values (e.g., !2, 0, 999), and a set of operations (e.g., arithmetic, logic) that are allowed on them. The Fortran 90 standard requires five intrinsic or built-in data

types, which are divided into two classes. The numeric types are integer, real and complex. The non-numeric types are character and logical.

Associated with each data type are various kinds, defined depending on the number of bits available for storage, so that, for example, there might be two kinds of integer: short and long. In addition to the intrinsic data types, you may define your own derived data types, each with their own set of values and operations.

2.3. Names and Vairables

In Fortran, names indicate memory locations. In FORTRAN 77, names consist of no more than six (6) alphanumeric characters and must start with a letter. In Fortran 90, names can consist of between 1 and 31 alphanumeric characters and still must start with a letter. The alphanumeric characters are the 26 letters, the 10 digits, and the underscore (_). Names are case insensitive, except in the case of character strings. A name in a program must be unique.

A variable is a memory location whose value may be changed during execution of a program. A variable’s name is constructed following the aforementioned rules. A variable has a type that determines the type of number it may hold, as specified in a type declaration, e.g.,

INTEGER : : X REAL : : INTEREST CHARACTER : : LETTER REAL : : A = 1

2.4. An Example of Numeric Expression

Refer to the following numeric expression

U * T! G / 2 * T ** 2

It is a formula combining constants, variables and functions (e.g., exponential) using numeric intrinsic operators. It specifies a rule for computing a value (vertical distance, in this case). Since it only computes a single value it is a scalar numeric expression. There are five numeric intrinsic operators, ** for exponentiation, highest precedence; * for multiplication, / for division, lower precedence; + for addition, and ! for subtraction, lowest precedence. Typing blanks on either side of operators will make expressions more readable.

An operator with two operands, as in A + B, is called a binary or dyadic operator. When an operator appears with only one operand, as in !Z, it is called unary or monadic. The order in which operations in an expression are carried out is determined by the precedence of the operators, except that parentheses () always have the highest precedence. Since multiplication has a higher precedence than addition, this means, for example, that 1 + 2 * 3 is evaluated as 7, while (1 + 2) * 3 is evaluated as 9. Note also that !3 ** 2 evaluates to !9, not 9.

When operators with the same precedence occur in the same expression, they are with one exception always evaluated from left to right, so 1 / 2 * A is evaluated as (1 / 2) * A and not 1 / (2 * A). The exception to the precedence rules is that in an expression of the form

A ** B ** C

This means that there might be loss of precision. For example, assuming N is integer, and X and Y are real:

N = 10. / 3 (value of N is 3) X = 10 / 3 (value of X is 3.0) Y = 10 / 3. (value of Y is 3.33333)

The danger of performing integer divisions inadvertently cannot be stressed too much. For example, you might want to average two marks which happen to be integers M1 and M2. The most natural statement to write is

FINAL = (M1 + M2) / 2

but this operation loses the decimal part of the average. It is always safer to write constants as reals if real arithmetic is what you want:

FINAL = (M1 + M2) / 2.

References

Anderson, M.P., and W.W. Woessner, Applied Groundwater Modeling: Simulation of Flow and Advective Transport , Academic Press, San Diego, 1992. Beven, K.J., R. Lamb, P. Quinn, R. Romanowicz, and J. Freer, TOPMODEL, in Computer Models of Watershed Hydrology , edited by V.P. Singh, p. 627–668, 1995. Chapman, S.J., 1998, Fortran 90/95 for Scientists and Engineers , McGraw-Hill, Boston. Donigian, A.S., Jr., B.R. Bicknell, and J.C. Imhoff, Hydrologic Simulation Program - Fortran (HSPF), in Computer Models of Watershed Hydrology , edited by V.P. Singh, p. 395–442, 1995. Flerchinger, G.N., and K.E. Saxton, Simultaneous heat and water model of a freezing snow-residue-soil system I. Theory and development, Trans. ASAE. 32, 565–571, 1989. Hahn, B.D., Fortran 90 for Scientist and Engineers , Butterworth-Heinemann, Woburn, MA, 1994. Harbaugh, A.W., E.R. Banta, M.C. Hill, and M.G. McDonald, MODFLOW-2000, the US Geological Survey modular ground-water model—User guide to modularization concepts and the ground-water flow process: US Geol. Surv. Open-File Rep. 00-92 , 121 p., 2000. Knisel, W.G. (ed.), GLEAMS manual, ver. 2.10, UGA-CPES-BAED Pub. 5 , Univ. Georgia, Coastal Plain Experiment Station, Tifton, GA, 1993. Kramer, J.H., and S.J. Cullen, Review of vadose zone flow and transport models, Handbook of Vadose Zone Characterization & Monitoring , edited by L.G. Wilson, L.G. Everett and S.J. Cullen, Lewis Publishers, Boca Raton,

Leavesley, G.H., and L.G. Stannard, The Precipitation-Runoff Modeling System - PRMS, in Computer Models of Watershed Hydrology , edited by V.P. Singh, p. 281–310, 1995. Morris, C. (ed.), Academic Press Dictionary of Science and Technology , Academic Press, San Diego, 1992. Nyhoff, L., and S. Leestma, FORTRAN 77 for Engineers and Scientists , 4 th^ ed., Prentice Hall, Upper Saddle River, 1996. Singh, V.P. (ed.), Computer Models of Watershed Hydrology , Water Resources Publications, Highlands Ranch, 1995. The Fortran Company, Information, Source: URL , accessed in January,

Wanielista, M., R. Kersten, and R. Eaglin, Hydrology: Water Quantity and Quality Control , 2 nd^ ed., John Wiley & Sons, Inc., New York, 1997.

Lab 4 Assignment

1. Make connections ( 3.5 pts )

(1) John Backus (2) byte (3) John von Neumann (4) UNIX (5) CPU (6) ROM (7) Fortran (A) a premier operating system (B) central processing unit (C) a high-level language (D) computer memory unit (E) read-only memory (F) designer of Fortran language (G) developer of the scheme to use internally stored commands

2. Are the following names valid or invalid? Why? ( 4 pts )

X X+Y R2D SHADOW FAX Pay_day 2A ENDOFTHEMONTH OBI-WAN

3. Decide which of the following constants are not written in standard Fortran. ( 2.5 pts )

(A) 9, (B). (C) 3.57*E (D) 1.23E (E) 3,57E! 2

4. Evaluate the following numeric expressions by hand and with a calculator if needed. Then, write a simple Fortran code to verify your result for any chosen case. The given values for the individual variables are A = 2, B = 3, C = 5 (reals); and I = 2, J = 3 (integers) ( 7.5 pts )

A * B + C A * (B + C) B / C * A B / (C * A) A / I / J A * B ** I / A ** J * 2 C + (B / A) ** 3 / B * 2