http://interval.louisiana.edu/courses/455/spring-2005-455-language-policy.html
Programming Languages for Scientific Computing, Math 455, Spring,
2005
/ Description of various
languages / Policy for the course /
Instructor: R.
Baker Kearfott, Department
of Mathematics, University of
Louisiana
at Lafayette
Office hours
and telephone, Email: rbk@louisiana.edu.
Description of
various languages
- Traditionally, Fortran has been the primary language of
scientific computing, and, even in 2005, it remains so for many
large-scale applications, such as in chemical engineering, mechanical
engineering and other engineering disciplines, physics, and climate
modeling. Fortran has obtained a somewhat undeserved reputation
for being too old-fashioned, not supporting modern programming
structures, such as user-defined data types. However, the Fortran
90 standard, implemented for over a decade, does allow such
"object-oriented" structure, and compilers for it are widely
available. (This includes a new free, open-source "Gnu" Fortran 90 compiler,
integrated with the "gcc" compiler suite.) Furthermore, much free
numerical software, primarily in Fortran, is available from Netlib. The new standard has many
intrinsic functions useful for scientific computing, including easy
access to vector and matrix operations, done efficiently on parallel
machines and other special machines, without having to program
loops. Unfortunately, many still think of the older, more limited
Fortran 77 standard as "Fortran," and thus discount the use of
Fortran. (All Fortran 77 programs are also valid Fortran 90 and
Fortran 95 programs, so there is no problem in that regard using a
compiler supporting the new standard.)
- C and C++ have traditionally been "operating system" languages,
originally designed for systems programming and graphics. In
fact, much, if not most commercial programming for the Microsoft
Windows environment is in C++. Also, since C++ came out in the
late 1980's, before Fortran 90 compilers were available, many
researchers in scientific computing who required object-oriented
capabilities started using C++ instead of Fortran, and the trend has
continued.
- Matlab,
or "MATrixLABoratory", originated with Cleve Moler as a National
Science Foundation project in 1980, as an interactive system for doing
matrix computations. Now a "Mathworks" corporation product,
Matlab has evolved into a general-purpose scientific computing
environment. Various "toolboxes"
supply specialized capabilities, such as optimization (linear and
nonlinear programming), control systems, signal processing, and an
environment for mathematical modeling. Beyond interactive
computations, Matlab is a full-featured programming language, with
functions and "scripts" stored in Matlab "m" files. Such programs
are easily debuggable with Matlab's built-in interactive debugger, and
in some cases run efficiently. Many scientists and engineers
program new and experimental algorithms first in Matlab, later
translating the programs into more efficient Fortran, C, or C++, as
necessary. Matlab's "for" loops are "interpretive," and are
inefficient compared to loops in compiled programming languages such as
Fortran, C, and C++. This is particularly true if there are
"nested" loops (i.e. loops within loops), and Matlab programs can
therefore execute a factor of 60 slower than corresponding Fortran or C
programs.
- Mathematica
originated in the late 1980's as a symbolic manipulation program,
that is, as a program that automatically factors and simplifies
algebraic expressions, that symbolically differentiates and integrates,
etc. Mathematica has evolved into a more general-purpose
repository of mathematical knowledge, and supports both numerical and
symbolic computations. Browsing the capabilities of
Mathematica is one way of becoming familiar with functions and
relations in classical applied mathematics, for example.
Mathematica also has many graphical capabilities, both two- and
three-dimensional. Finally, Mathematica has general-purpose
programming capabilities, admitting many programming styles, including
"object-oriented" and "functional". Mathematica is especially
appropriate for us if we need to combine symbolic and numerical
capabilities. However, Mathematica programs can be even less
efficient than Matlab programs. Furthermore, for purely numerical
programming, especially that involving matrix computations, and for
simple graphs, Matlab may be somewhat easier to learn and use. (A
competing symbolic manipulation package, with capabilities similar to
Mathematica, is Maple.
However, we deal with Mathematica, since our university has Mathematica
licenses, rather than Maple licenses.)
Policy for the Course
I will allow use of any of the above programming languages for course
assignments, and I will allow other programming languages if the
student first clears it with me.
However, the examples in the course will be primarily in Matlab, since
that is appropriate for numerical computations and is available both in
our classroom (MDD 212) and on the UCS machines in Stephens Hall and
the Conference Center. In addition, my own expertise is heavily
weighted towards Fortran 90, so students electing to use that language
can expect high-quality help from me.
There are general programming style principles (concerning
documentation, etc.) that we will discuss somewhat in the course,
although the emphasis in the course will be on numerical methods,
rather than programming style. Additional study of programming
style in scientific computing can be obtained by taking Math.
487. For a reference on Matlab programming (as well as a
discussion of good style and examples thereof), see Gerald Recktenwald, Numerical Methods with Matlab,
Prentice Hall, 2000.