MATH7601 Prog
MATH7601 Prog
• Use PROGRAM NAME...END PROGRAM NAME to set up a program with a suitable name. Use
IMPLICIT NONE (spell-checker!).
• Be able to correctly declare and initialise variables of type INTEGER, REAL, COMPLEX,
LOGICAL, CHARACTER and CHARACTER(len=xx). Know about PARAMETERS and when to
use them.
• Know the syntax for simple arithmetic operations +, −, ∗, ∗∗, / etc. Remember integer division!
• Be able to use comparative operators ==, / =, >=, >, < etc. to initialise logical variables or define
conditional clauses based on the value of real or integer variables.
• Be able to use logical operators .NOT., .AND., .OR., .NEQV. etc. to perform operations with
logical variables.
• Use Fortran intrinsic functions EXP, ALOG, COS, ASIN, etc. to perform standard mathematical
operations.
• Use PRINT *, or WRITE (*,*) to write to the screen and READ *, or READ (*,*) to input from
the keyboard.
• Use format strings (e.g. ’(F12.6,A,2x,2I6)’) to control the organisation of output data.
• To repeat operations: Know the three different types of DO loop and when to use them, and the
effect of the variable STEP in the final type.
• Use single-line IF (condition) clauses to execute statements if and only if (condition) is true.
• Declare and initialise arrays of different dimension (different types of initialisation: element by
element, as vectors, in DO loops or using assignment statements). Be able to control the index range
(e.g. A(-2:2,0:4)). Use ‘:’ to define subarrays (e.g. B=A(:,2), C=A(-1:1,0:1).)
• Use SUM to add (some or all) elements of an array or sub-array. Use SIZE to recover the dimension
of an array or sub-array.
• Understand when and why a subroutine or function should be declared RECURSIVE (e.g. Towers of
Hanoi example).
• Use TYPE MYTYPE....END TYPE MYTYPE to create a user-defined data type for storing
different forms of data together (e.g. medical records). Know how to declare (e.g.
TYPE(MYTYPE)::DATASET1) and initialise them (e.g. DATASET1%VARIABLE1(1)=..., or
DATASET1=MYTYPE(...,...,...) ).