Information Technology Reference
In-Depth Information
efficiency. Some programmers regard C CC as a “middle of the road” choice: It
provides speed and a fair amount of programming convenience.
Maple is an obvious choice if it is important to integrate symbolic and numerical
computing. However, Matlab has a communication link to Maple, and Python can
call up symbolic mathematics engines such as SymPy or Ginac, so integration of
symbolic functionality can be performed in all three environments.
Even if a particular feature is supported in several languages, the usage of the
feature may be considerably more favorable in one particular language. Classes con-
stitute an example; the authors find class programming easiest and most convenient
in Python, followed by Java and C CC , while we find Matlab classes less convenient.
These finer points are not easy to express in a tabular set-up such as Table 6.1 .
The most obvious conclusion is that there is no single preferred scientific com-
puting tool. You need to gain experience with several and learn how to pick the
most productive tool for a given task. We recommend you gain this knowledge from
“learning by doing”, so that you can build up your own experience rather than trying
to deduce the conclusion from theoretical considerations.
Finally, we mention that only some relevant programming languages are com-
pared here. We have said little about C and not mentioned Python's “brothers”
Perl and Ruby; there are also excellent computing environments such as Mathemat-
ica, Gauss, and R (or S-Plus) that are not mentioned here. We have also neglected
the modern Fortran versions: 90, 95, and 2000. These represent a smooth transi-
tion from the simple Fortran 77 language to a rich language such as C CC .For
many purposes, Fortran 2003 11 shares the same characteristics as C CC , with some
convenient additional built-in features for numerical computing.
Tabl e 6. 1 Comparison of different programming languages. The numbers given in the “speed”
column equal the actual CPU time of Algorithm 6.2 , implemented in the particular language,
divided by the CPU time required by the associated Fortran 77 implementation. For Python and
Matlab we have reported the CPU time of the vectorized version of Algorithm 6.2 . The num-
bers in the “program length” column correspond to the number of lines in our implementation,
including comment lines, and depend significantly on the personal tastes and habits of the pro-
grammer. The dashes indicate that it is difficult to give a precise yes or no answer: Maple's speed is
improved by calling built-in numerical functionality, but vectorization as a programming technique
is not required; Java and Python (and C
to some extent) can easily incorporate visualization in
programs, but this is not a part of standard libraries
Language
CC
Program
Speed
Vectorization
Dynamic
Classes
Interactive
Built-in
length
required
typing
computing
visualization
Fortran 77
41
1.0
No
No
No
No
No
C
CC
38
1.0
No
No
Yes
No
No
Java
50
2.1
No
No
Yes
No
-
Python
24
1.9
Yes
Yes
Yes
Yes
-
M a t l a b
2 1
2 . 0
Ye s
Ye s
Ye s
Ye s
Ye s
Maple
36
613.6
-
Yes
No
Yes
Yes
11 At the time of this writing, Fortran 2003 compiler are just starting to emerge.
 
Search WWH ::




Custom Search