Physics  >  Book Review  >  Computational Physics Richard Fitzpatrick Professor of Physics The University of Texas at Austin (All)

Computational Physics Richard Fitzpatrick Professor of Physics The University of Texas at Austin

Document Content and Description Below

ience These set of lecture notes are designed for an upper-division undergraduate course on computational physics. 1.2 Major Sources The sources which I have consulted most frequently whilst devel ... oping course material are as follows: C/C++ PROGRAMMING: Software engineering in C, P.A. Darnell, and P.E. Margolis (Springer-Verlag, New York NY, 1988). The C++ programming language, 2nd edition, B. Stroustrup (Addison-Wesley, Reading MA, 1991). Schaum’s outline: Programming with C, 2nd edition, B. Gottfried (McGrawHill, New York NY, 1996). Schaum’s outline: Programming with C++, 2nd edition, J.R. Hubbard (McGrawHill, New York NY, 2000). NUMERICAL METHODS AND COMPUTATIONAL PHYSICS: Computational physics, D. Potter (Wiley, New York NY, 1973). Numerical recipes in C: the art of scientific computing, W.H. Press, S.A. Teukolsky, W.T. Vettering, and B.R. Flannery (Cambridge University Press, Cambridge UK, 1992). Computational physics, N.J. Giordano (Prentice-Hall, Upper Saddle River NJ, 1997). Numerical methods for physics, 2nd edition, A.L. Garcia (Prentice-Hall, Upper Saddle River NJ, 2000). 81.3 Purpose of Course 1 INTRODUCTION PHYSICS OF BASEBALL: The physics of baseball, R.K. Adair (Harper & Row, New York NY, 1990). The physics of sports, A.A. Armenti, Jr., Ed. (American Institute of Physics, New York NY, 1992). CHAOS: Chaos in a computer-animated pendulum, R.L. Kautz, Am. J. Phys. 61, 407 (1993). Nonlinear dynamics and chaos, S.H. Strogatz, (Addison-Wesley, Reading MA, 1994). Chaos: An introduction to dynamical systems, K.T. Alligood, T.D. Sauer, and J.A. Yorke, (Springer-Verlag, New York NY, 1997). 1.3 Purpose of Course The purpose of this course is demonstrate to students how computers can enable us to both broaden and deepen our understanding of physics by vastly increasing the range of mathematical calculations which we can conveniently perform. 1.4 Course Philosophy My approach to computational physics is to write self-contained programs in a high-level scientific language—i.e., either FORTRAN or C/C++. Of course, there are many other possible approaches, each with their own peculiar advantages and disadvantages. It is instructive to briefly examine the available options. 1.5 Programming Methodologies Basically, there are three possible methods by which we could perform the numerical calculations which we are going to encouter during this course. 91.5 Programming Methodologies 1 INTRODUCTION Firstly, we could use a mathematical software package, such as MATHEMATICA1, MAPLE2 or MATLAB.3 The main advantage of these packages is that they facilitate the very rapid coding up of numerical problems. The main disadvantage is that they produce executable code which is interpreted, rather than compiled. Compiled code is translated directly from a high-level language into machine code instructions, which, by definition, are platform dependent—after all, an Intel x86 chip has a completely different instruction set to a Power-PC chip. Interpreted code is translated from a high-level language into a set of meta-code instructions which are platform independent. Each meta-code instruction is then translated into a fixed set of machine code instructions which is peculiar to the particular hardware platform on which the code is being run. In general, interpreted code is nowhere near as efficient, in terms of computer resource utilization, as compiled code: i.e., interpreted code run a lot slower than equivalent compiled code. Thus, although MATHEMATICA, MAPLE, and MATLAB are ideal environments in which to perform relatively small calculations, they are not suitable for full-blown research projects, since the code which they produce generally runs far too slowly. Secondly, we could write our own programs in a high-level language, but use calls to pre-written, pre-compiled routines in commonly available subroutine libraries, such as NAG,4 LINPACK,5 and ODEPACK,6 to perform all of the real numerical work. This is the approach used by the majority of research physicists. Thirdly, we could write our own programs—completely from scratch—in a high-level language. This is the approach used in this course. I have opted not to use pre-written subroutine libraries, simply because I want students to develop the ability to think for themselves about scientific programming and numerical techniques. Students should, however, realize that, in many cases, pre-written library routines offer solutions to numerical problems which are pretty hard to improve upon. 1See http://www.wolfram.com 2See http://www.maplesoft.com 3See http://www.mathworks.com 4See http://www.nag.com 5See http://www.netlib.org 6ibid. 101.6 Scientific Programming Languages 1 INTRODUCTION 1.6 Scientific Programming Languages What is the best high-level language to use for scientific programming? This, unfortunately, is a highly contentious question. Over the years, literally hundreds of high-level languages have been developed. However, few have stood the test of time. Many languages (e.g., Algol, Pascal, Haskell) can be dismissed as ephemeral computer science fads. Others (e.g., Cobol, Lisp, Ada) are too specialized to adapt for scientific use. Let us examine the remaining options: FORTRAN 77: FORTRAN was the first high-level programming language to be developed: in fact, it predates the languages listed below by decades. Before the advent of FORTRAN, all programming was done in assembler code! Moreover, FORTRAN was specifically designed for scientific computing. Indeed, in the early days of computers all computing was scientific in nature— i.e., physicists and mathematicians were the original computer scientists! FORTRAN’s main advantages are that it is very straightforward, and it interfaces well with most commonly available, pre-written subroutine libraries (since these libraries generally consist of compiled FORTRAN code). FORTRAN’s main disadvantages are all associated with its relative antiquity. For instance. FORTRAN’s control statements are fairly rudimentary, whereas its input/output facilities are positively paleolithic. FORTRAN 90: This language is a major extension to FORTRAN 77 which does away with many of the latter language’s objectionable features. In addition, many “modern” features, such as dynamic memory allocation, are included in the language for the first time. The major disadvantage of this language is the absence of an inexpensive compiler. There seems little prospect of this situation changing in the near future. C: This language was originally developed by computer scientists to write operating systems. Indeed, all UNIX operating systems are written in C. C is, consequently, an extremely flexible and powerful language. Amongst its major advantages are its good control statements and excellent input/output facilities. C’s main disadvantage is that, since it was not specifically written to be a scientific language, some important scientific features (e.g., complex 111.6 Scientific Programming Languages 1 INTRODUCTION arithmetic) are missing. Although C is a high-level language, it incorporates many comparatively low-level features, such as pointers (this is hardly surprisingly, since C was originally designed to write operating systems). The low-level features of C—in particular, the rather primitive implementation of arrays—sometimes make scientific programming more complicated than need be the case, and undoubtedly facilitate programming errors. On the other hand, these features allow scientific programmers to write extremely efficient code. Since efficiency is generally the most important concern in scientific computing, the low-level features of C are, on balance, advantageous. C++: This language is a major extension of C whose main aim is to facilitate object-orientated programming. Object-orientation is a completely different approach to programming than the more traditional procedural approach: it is particularly well suited to large projects involving many people who are each writing different segments of the same code. However, objectorientation represents a large, and somewhat unnecessary, overhead for the type of straightforward, single person programming tasks considered in this course. Note, however, that C++ incorporates some non-object-orientated extensions to C which are extremely useful. Of the above languages, we can immediately rule out C++, because objectorientation is an unnecessary complication (at least, for our purposes), and FORTRAN 90, because of the absence of an inexpensive compiler. The remaining options are FORTRAN 77 and C. I have chosen to use C (augmented by some of the useful, non-object-orientated features of C++) in this course, simply because I find the archaic features of FORTRAN 77 too embarrassing to teach students in the 21st century. [Show More]

Last updated: 2 years ago

Preview 1 out of 322 pages

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)
Preview image of Computational Physics Richard Fitzpatrick Professor of Physics The University of Texas at Austin document

Buy this document to get the full access instantly

Instant Download Access after purchase

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Reviews( 0 )

$10.00

Buy Now

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Instant download

Can't find what you want? Try our AI powered Search

121
0

Document information


Connected school, study & course


About the document


Uploaded On

Jul 17, 2023

Number of pages

322

Written in

All

Seller


Profile illustration for AMAZING GRACE
AMAZING GRACE

Member since 3 years

140 Documents Sold

Reviews Received
9
2
2
0
8
Additional information

This document has been written for:

Uploaded

Jul 17, 2023

Downloads

 0

Views

 121

Recommended For You

Get more on Book Review »

$10.00
What is Scholarfriends

Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Scholarfriends · High quality services·