Next:
A quick tour of
Up:
Lecture Notes Introduction to
Previous:
Lecture Notes Introduction to
Contents
A quick tour of Fortran 95
Program Form
Free vs. Fixed Formats
Declaration of Variables
Memory Organization. Variables
Integers.
Characters.
Reals.
Double Precision.
Complex
Logical.
General Form of Declarations
Implicit declarations
Assignment
Intrinsic Numerical Operations
Literal Constants
Relational Operators
Intrinsic Logical Operations
Intrinsic Character Operations
Substrings
Concatenation
Operator Precedence
Intrinsic Functions
Controlling the flow of the program
Conditional execution
Examples
Repetitive action
Application to DO loops: Fahrenheit to Celsius
Problems
Input and Output
Standard (keyboard/console)
File I/O
Application
Arrays
Application
The Building Blocks of a Fortran Application
Program Units
External Procedures
External Functions
Actual arguments, formal (dummy) arguments and local variables
Implicit Interfaces
Subroutines
Comments
Modules
Scope of Variables
Lifetime of Variables
Global Storage
Circle Example
Taylor Approximation of the Exponential
F77 Global Storage. Storage Association.
BLOCK DATA statements
Include files
More on Storage Association
More on Flow Control
Named IF and DO Blocks
The IF Statement
More on DO Loops
Conditional EXIT
Conditional CYCLE
Exit and Cycle with named loops
Initial Test (DO...WHILE) Loop
SELECT CASE
Exceptional Situations
STOP
RETURN
GO TO
Computer Representation of Numbers and Computer Arithmetic
Binary numbers
Memory
Characters in Memory
The Memory Model
Reprentation of Signed Integers
Integers in Memory
Note.
Floating-Point Numbers
The IEEE standard
Floating Point Types
Detailed IEEE representation
Number range
Precision
The Set of FP Numbers
Rounding - up or down
Chopping
Rounding to nearest.
Arithmetic Operations
IEEE Arithmetic
The Guard Digit
Special Arithmetic Operations
Signed zeros
Operations with
Operations with
NaN
Comparisons
Arithmetic Exceptions
Division by 0
Overflow
Underflow
Inexact
Summary
Flags and Exception Trapping
Systems Aspects, from D. Goldberg, p. 193
Instruction Sets
Ambiguity
Programming Language Features
Optimizers
Exception Handling
Long Summations
Tipical pitfalls with floating point programs
Binary versus decimal
Floating point comparisons
Funny conversions
Memory versus register operands
Cancellation (``Loss-of Significance'') Errors
Insignificant Digits
Order of Operations Matters
Integer Multiplication
Homework
Applications Part I.
The Fibonacci Sequence
Summation Formulas
Intrinsic Functions
Generic vs. Specific Functions
Numerical Type Conversions
Numerical Intrinsic Functions
Mathematical Intrinsic Functions
Examples
Mixing Types
Mixed-Type Expressions
Mixed-Type Assignement
Integer Division
Input and Output.
List-Directed Input and Output
Formats
Editor Descriptors
Example: READ Integer Data
Example: READ Character Data
File I/O
Records and Files
OPEN
READ
READ example
WRITE
FORMAT
File Positioning
Writing to a string
Arrays
Declaring Arrays
Memory Storage
Array Attributes
Subscripting
Conformance
Array Expressions
Array Sections
RESHAPE intrinsic function
Array Constructors
Allocatable Arrays
Masked Assignment
Vector-valued Subscripts
Homework
Vector and Matrix Multiplication Intrinsics
Maximum and Minimum Intrinsics
Array Reduction Intrinsics
Array Arguments
Explicit Shape Arrays
Assumed Shape Arrays
Automatic Arrays
F77's Assumed-Size Arrays
Array-Valued Functions
More on Procedures
Recall F90 Program Units
Side Effects
Argument Intent
Pure Functions
Internal Procedures
Modules Hosting Procedures
Scope
Scope example
Procedure Interfaces
More on Implicit Interfaces
Explicit Interfaces
Explicit Interfaces for Internal Procedures
Explicit Interfaces for External Procedures
Required Interfaces
Keyword Arguments
Optional Arguments
Recursive Functions
Recursive Subroutines
Parametrised Intrinsic Types
Rationale
Parametrised Integers
Parametrized Reals
Kind Functions
Mixed
KIND
Expressions
Parametrised Logical Vaiables
Parametrised Character
Kinds and Procedures
Derived Types
Defininig Derived Types
Arrays and Derived Types
Derived Types and Procedures
Pointers and Targets
Pointers and Targets
Pointer Declaration
Target Declaration
Pointer Assignment
Association with Arrays
Example: Array swapping
Status of a Pointer
Dynamic Targets
Pointers to Arrays vs Allocatable Arrays
Pointers and Procedures
Pointer Valued Functions
Pointers and Derived Types
Example: Linked Lists
Arrays of Pointers
Example: Sorting Vectors
Elements of object-oriented programming
Public and Private Entities
Derived Type Constructors
Generic Procedures
Linear Systems of Algebraic Equations
Least Squares Fitting
The problem
Row Operations
The triangular form
Solving the upper triangular system
General algorithms
Computing the determinant
Pivoting
Triangular form with pivoting
Operation count
Singularity
Multiple systems with the same matrix
Computing the inverse of a matrix
Coding the LU decomposition
Coding the forward-backward substitution
LAPACK and BLAS.
Homework
LU decomposition
Back-substitution
Tests
Linear Least Squares
Least Squares Data Fitting
The general problem formulation
The Calculus Approach
Orthogonality
Augmented system
Matlab
Algorithm for polynomial least squares fitting
Note
Nonlinear Equations
The Newton Method for Nonlinear Equations
Order of convergence
The Secant Method
The Modified Newton Method
Fixed point iterations
The Newton Method for Systems
The Modified Newton Method for Systems
Polynomial Interpolation
Example
Direct algorithm for polynomial interpolation
Nested polynomial evaluation
Lagrange form of the interpolation polynomial
Newton form of the interpolation polynomial
Reconstructing functions
Chebyshev points
Numerical Integration
The Numerical Integration Problem
The Trapezoidal Method
The Simpson Method
Example.
Homework
Test Problem.
Piecewise Polynomial Interpolation. Splines.
The Piecewise Interpolation Problem
Piecewise linear interpolation
Spline interpolation
Interpolation and Continuity.
Same slope condition.
Same curvature condition.
Example
Homework
Input.
Output.
Test
Note
Submit
Test Driver
Taylor Polynomials
The Taylor Polynomial
Taylor Remainder
Important functions
Applications
Polynomial Evaluation
Sample Program
homework
Taylor polynomials
The project
About this document ...
Adrian Sandu 2001-08-26