Computers in Physics

1 downloads 0 Views 386KB Size Report
Sep 22, 2016 - M. Metcalf, J. Reid, Alejandro Garcia, Susan McKay, and Wolfgang Christian. Citation: Computers in Physics 10, 135 (1996); doi: 10.1063/ ...
Computers in Physics Fortran 90 Explained M. Metcalf, J. Reid, Alejandro Garcia, Susan McKay, and Wolfgang Christian Citation: Computers in Physics 10, 135 (1996); doi: 10.1063/1.4822372 View online: http://dx.doi.org/10.1063/1.4822372 View Table of Contents: http://scitation.aip.org/content/aip/journal/cip/10/2?ver=pdfcov Published by the AIP Publishing Articles you may be interested in Upgrading to Fortran 90 Comput. Phys. 10, 135 (1996); 10.1063/1.4822374 Migrating to Fortran 90 Comput. Phys. 10, 135 (1996); 10.1063/1.4822373 Introducing Fortran 90 Comput. Phys. 10, 135 (1996); 10.1063/1.4822371 Fortran 90 Explained and FORTRAN 77 for Engineers and Scientists: Includes Preview of FORTRAN 90, 3rd ed. Am. J. Phys. 61, 383 (1993); 10.1119/1.17228 Fortran 8x Explained Comput. Phys. 3, 82 (1989); 10.1063/1.4822831

Reuse of AIP Publishing content is subject to the terms at: https://publishing.aip.org/authors/rights-and-permissions. Download to IP: 104.249.178.101 On: Thu, 22 Sep 2016 14:18:21

42iA 42iA

RELLAB By

BOOK REVIEWS:

SIX BOOKS ON FORTRAN 90 FUNDAMENTALS OF ARTIFICIAL NEURAL NETWORKS

Paul Horwitz, Edwin Taylor, & Kerry Shetline BBN Systems and Technologies Bolt Beranek & Newman

iÂi

Department Editors: Susan McKay [email protected]

Wolfgang Christian

atiMe11611511~.0111MMIOM•1115111~~1~111M1"01-

[email protected]

Six Books on Fortran 90 Programmer's Guide to Fortran 90 W. S. Brainerd, C. H. Goldberg, and J. C. Adams Springer-Verlag, New York, 1996; ISBN 0-387-94570-9; 445 pp., paper, $39.95.

Introducing Fortran 90 I. Chivers and J. Sleightholme Springer-Verlag, New York, 1995; ISBN 3-540-19940-3; 375 pp., paper, $34.95.

Fortran 90 Explained M. Metcalf and J. Reid Oxford University Press, Oxford, England, 1990; ISBN 0-19-853772-7; 294 pp., paper, $32.95.

Migrating to Fortran 90 J. Kerrigan O'Reilly & Associates, Sebastopol, CA, 1993; ISBN 1-56592-049-X; 361 pp., paper, $27.95.

Upgrading to Fortran 90 C. Redwine Springer-Verlag, New York, 1995; ISBN 0-387-97995-6; 501 pp., paper, $39.95.

Fortran 90 Language Guide W. Gehrke Springer-Verlag, New York, 1995; ISBN 3-540-19926-8; 350 pp., paper, $49.00.

Reviewed by Alejandro Garcia

AA lthough the Fortran 90 standard /.was established in 1991, only recently have Fortran 90 compilers become widely available. The most usefitl features in C, such as pointers, structures, and dynamic memory allocation,

are in the new standard. Availability of these features should reduce the migration of programmers from Fortran to C. Useful tools such as array operations (manipulating arrays as variables), variable scoping (public and private variables), and operator overloading have been added to the language, and many popular vendor extensions such as implicit NONE declaration, long variable names, inline comments, and free source form have been folded into the new standard. All this is provided by the new compilers together with full backwards compatibility with Fortran 77. (Caveat: Many compilers are still only partially compliant with the new standard; read the software vendor' s rine print carefully.) Are your old Fortran programs guaranteed to work with the new standard? Not necessarily, since you might be using nonstandard elements that are not part of Fortran 90. However, many computer sites have already installed the new compilers with Fortran 77 programmers often not noticing the difference. With the arrival of compilers and the standard' s growing acceptance, several Fortran 90 books have recently appeared. Most of them cover the same general material yet differ significantly depending on their target audience: Fortran neophytes (and their teachers) or experienced Fortran programmers A lejandro Garcia is a professor ofphysics at San Jose State University, One Washington Square, San Jose, CA 95192. His computational-physics textbook, Numerical Methods for Physics (Prentice Hall, Englewood Cliffs, NJ, 1994), uses Matlab and Fortran. E-mail: agarcia@ zeus.sjsu.edu

THIS IS NO ORDINARY LABORATORY!

RelLab is an interactive relativity laboratory where your students can investigate both low-speed motion explained by Newton's mechanics and high-speed motion described by Einstein's theory of special relativity. RELLAB makes it possible to design any scenario imaginable, as long as it does not violate the presently known laws of nature. Your students will begin to see the implications of Lorentz transforms and understand why a reference frame is critical. They will learn how length contracts, how time dilates, and how simultaneity depends on the velocity of the observer. Start with everyday phenomena and move on to explore the rich paradoxes of special relativity. In no time, your students

will develop a keen intuition about the world of the very fast. 88-page User's Manual.

$64.95 (single copy)

$194.95 (10-copy lab pack)

ORDER TODAY! e Call Toll-Free PHYSICS ACADEMIC SOFTWARE

1(800)955-TASL

A1P • APS • AAP!

Reuse of AIP©Publishing content is subject the terms at: https://publishing.aip.org/authors/rights-and-permissions. Download to 10, IP:NO. 104.249.178.101 1996 AMERICAN INSTITUTE OFtoPHYSICS 0894-1866/95/10(2)/135/3/$10.00 COMPUTERS IN PHYSICS, VOL. 2, MAR/APR 1996On: 135 Thu, 22 Sep 2016 14:18:21

42iA

learning the new standard. This review considers several books for neophytes and several for experienced programmers. It is not an exhaustive overview of all the available texts. Brainerd, Goldberg, and Adams, authors of Programmer's Guide to Fortran 90, have excellent credentials: Two of these authors are on the ANSI committee that developed the Fortran 90 standard, and the third is a professor of computer science. Working through numerous, complete examples, the text teaches Fortran programming. The new standard is used throughout, making this text preferable to updated Fortran 77 textbooks, to which one or two new chapters have been added at the end. The text has enough exercises to make it useful for a programming course. Tips for beginners are sprinkled throughout the text. One fault is that when a topic is covered, too many details are discussed. It would be better pedagogy to teach the basic framework first and return later to the minor specifics. (As Donald Knuth states in The TeXbook (Addison-Wesley, Reading, MA, 1986), "Another noteworthy characteristic of this manual is that it doesn't always tell the truth.") For anyone who knows a bit of programming and wants to learn Fortran 90 or for instructors who teach programming in Fortran, Brainerd et al. would be my recommendation. Introducing Fortran 90, by Chivers and Sleightholme, looks and reads like a set of lecture notes for a programming course. I did not like the style and organization of this text and found the authors' use of bullet outlines excessive. Most of the outlines could be replaced with a well-crafted paragraph or sometimes just a sentence. The first seven chapters, which have nothing to do with Fortran but rather discuss computers and programming in general, could be edited down to a single introductory chapter. The discussion of Fortran 90 is too often superficial or sketchy, and the book would be difficult to use as a reference. The number of exercises is inadequate, with most chapters having only two or three. While I did not care for this texes style, other readers might like it (clearly the authors did). If you are looking for a set of course notes for teaching Fortran programming, this book is worth looking at.

Metcalf and Reid' s Fortran 90 Explained, first published in 1990, was one of the first books available for the new standard (both authors worked on Fortran 90's development). The book assumes no prior knowledge of Fortran and covers all elements of the language. The discussions are well-written and concise yet sometimes lack details. There are exercises, but they really serve as examples, since almost all the solutions are in the back of the book. This text is probably too difficult for beginning programmers, but for experienced non-Fortran programmers who need to learn Fortran, this would be my recommendation. Written for experienced Fortran programmers, Migrating to Fortran 90, by James Kerrigan, is part of the popular Nutshell Handbook series (with the bestiary-engraving covers). The first chapter discusses compatibility issues for dusty decks and reviews Fortran 90's new features. Such information is exactly what a programmer wants to know before starting the migration. Subsequent chapters describe the new features in more detail, usually through progressive examples. One disadvantage of this format is that the reader sometimes must go through a chapter in its entirety to understand the discussion of a point made in an example. As with other books in the Nutshell series, the friendly and informal style allows important concepts to be presented quickly, deferring details to later sections. Kerrigan's book is recommended for experienced Fortran programmers who want to start quickly using Fortran 90's

new features. Redwine's Upgrading to Fortran 90 is also intended for experienced Fortran programmers, yet it points out that many of Fortran 90's best features require programmers to rethink the organization of their programs. While the first chapter is an overview of the new elements in Fortran 90, the rest of the book discusses how to use them to write Fortran 90 programs whose structure is fundamentally different from that of Fortran 77 programs. When Fortran programmers first use C, their programs are

often "Fortran with semicolons." It is not enough to know how an advanced feature works; one also must learn when it should be used and how to use it

effectively. For this reason, I personally found Redwine's book the most useful of the books reviewed, and I recommend it if you are serious about learning how to write modern programs in Fortran 90. Finally, the Fortran 90 Language Guide, by W. Gehrke, is a comprehensive reference manual for the language. It is not suitable for learning Fortran 90 but would be useful if the manual supplied by your compiler's vendor is unavailable or indecipherable. The standard document for Fortran 90 is in print, but, as the author points out, that document is written for compiler authors and not for compiler users. The guide is well written, as far as manuals go, but only a true propeller head could read it as a book. For anyone who occasionally finds manuals useful, this one is recommended. After reading these textbooks, I dug out my old Fortran text from 1975. Though the language has evolved considerably, many chapter titles in my old text (assignment, loops and conditionals, subprograms, input/output) are shared by the textbooks described above. One noticeable difference was in the quality of production—my old textbook has many photographs, cartoons, line drawings, diagrams, text boxes, an attractive typographical style and carefully edited text (price: $9.00, hardback). Electronic desktop publishing, which was clearly used by all the Fortran 90 texts, has significantly deteriorated the quality of textbook production. In fairness, one should recall that in the early 1970s Fortran was king, and its textbook market was more profitable. Having used Fortran for 20 years and C for 15 years, I now program exclusively in Fortran, though for small programs and prototyping I use Matlab. Many of my graduate students prefer to work in C, and so I still read and debug many C programs, which continuously reinforces my decision to stay with Fortran. In graduate school, I enjoyed driving my V-8 Mustang, but the constant repair work finally made me sell it. Today I am more interested in the destination than the vehicle. Fortran 90 is a powerful and dependable language for doing computational physics that allows us to concentrate on the physics rather than on the computer..

Reuse of AIP Publishing content is subject to10, theNO. terms at: https://publishing.aip.org/authors/rights-and-permissions. Download to IP: 104.249.178.101 On: Thu, 22 Sep 136 COMPUTERS IN PHYSICS, VOL. 2, MAR/APR 1996 2016 14:18:21