Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Computational Methods in Physics and Engineering

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11
At a glance
Powered by AI
The book discusses various computational methods that are useful for solving problems in physics and engineering, such as numerical integration, interpolation, differentiation, etc.

The book is about computational methods that are useful for solving problems in physics and engineering. It covers topics like numerical integration, interpolation, differentiation and finite element methods.

In the second edition, a new chapter on finite element methods was added. Some introductory chapters and sections on less popular topics were removed to keep the size manageable. Most chapters were substantially rewritten.

Computational Methods in Physics and Engineering Downloaded from www.worldscientific.

com
by 169.149.142.3 on 05/21/17. For personal use only.

COMPUTATIONAL

AND ENGINEERING
METHODS IN PHYSICS
A-PDF Deskew DEMO: Purchase from www.A-PDF.com to remove the wa
Computational Methods in Physics and Engineering Downloaded from www.worldscientific.com
by 169.149.142.3 on 05/21/17. For personal use only.

This page is intentionally left blank


COMPUTATIONAL
Computational Methods in Physics and Engineering Downloaded from www.worldscientific.com

METHODS IN PHYSICS
AND ENGINEERING
by 169.149.142.3 on 05/21/17. For personal use only.

2nd edition

Samuel S M Wong
University of Toronto

\ \ f e World Scientific
I N T Singapore New Jersey London* Hong Kong
Published by
World Scientific Publishing Co. Pte. Ltd.
P O Box 128, Fairer Road, Singapore 912805
USA office: Suite IB, 1060 Main Street, River Edge, NJ 07661
UK office: 57 Shelton Street, Covent Garden, London WC2H 9HE
Computational Methods in Physics and Engineering Downloaded from www.worldscientific.com

Library of Congress Cataloging-in-Publication Data


Wong, S. S. M. (Samuel Shaw Ming)
Computational methods in physics and engineering / Samuel S. M.
Wong, ~ 2nd ed.
p. cm.
Includes bibliographical references and index.
by 169.149.142.3 on 05/21/17. For personal use only.

ISBN 9810230176 ISBN 9810230435 (pbk)


1. Physics Data processing. 2. Mathematical physics.
3. Engineering - Data processing. 4. Engineering mathematics.
I. Title.
QC52.W66 1997
530,.O285~dc21 96-51106
CIP

British Library Cataloguing-in-Publication Data


A catalogue record for this book is available from the British Library.

First edition published in 1992 by Prentice-Hall, Inc.


This edition 1977 by World Scientific Publishing Co. Pte. Ltd.

Copyright 1997 by World Scientific Publishing Co. Pte. Ltd.


All rights reserved. Thisbook, orpartsthereof.maynotbereproducedinanyformorbyany means, electronic
or mechanical, including photocopying, recording or any information storage and retrieval system now
known or to be invented, without written permission from the Publisher.

For photocopying of material in this volume, please pay a copying fee through the Copyright Clearance
Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, USA. In this case permission to photocopy is not
required from the publisher.

This book is printed on acid-free paper.

Printed in Singapore by Uto-Print


Contents
Computational Methods in Physics and Engineering Downloaded from www.worldscientific.com

Preface to the First Edition ix

Preface to the Second Edition xi


by 169.149.142.3 on 05/21/17. For personal use only.

1 Computational Methods 1
1-1 Numerical calculations and beyond 1
1-2 Integers and floating numbers 5
1-3 Programming language and program library 7
1-4 Examples of algebraic, integer and floating number calculations ... 11
1-5 Examples of unconventional techniques 17
Problems 25

2 Integration and Differentiation 27


2-1 Numerical integration 27
2-2 Rectangular and trapezoidal rules 29
2-3 Simpson's rule 34
2-4 Gaussian quadrature 38
2-5 Monte Carlo integration 44
2-6 Multidimensional integrals and improper integrals 48
2-7 Numerical differentiation 56
Problems 60

3 Interpolation and Extrapolation 63


3-1 Polynomial interpolation 63
3-2 Interpolation using rational functions 70
3-3 Continued fraction 73
3-4 Fourier transform 76
3-5 Extrapolation 90
3-6 Inverse interpolation 97
3-7 Cubic spline 108
Problems 113

v
vi Contents

4 Special Functions 115


4-1 Hermite polynomials and harmonic oscillator 115
4-2 Legendre polynomials and spherical harmonics 120
4-3 Spherical Bessel functions 130
4-4 Laguerre polynomials 135
4-5 Error integrals and gamma functions 146
Problems 152
Computational Methods in Physics and Engineering Downloaded from www.worldscientific.com

5 Matrices 155
5-1 System of linear equations 155
5-2 Matrix inversion and L/-decomposition 164
5-3 Matrix approach to the eigenvalue problem 175
5-4 Tridiagonalization method 188
by 169.149.142.3 on 05/21/17. For personal use only.

5-5 Eigenvalues and eigenvectors of a tridiagonal matrix 199


5-6 Lanczos method of constructing matrices . 216
5-7 Nonsymmetric matrices and complex matrices 228
Problems 235

6 M e t h o d s of Least Squares 237


6-1 Statistical description of data 237
6-2 Uncertainties and their propagation 247
6-3 The method of maximum likelihood 253
6-4 The method of least squares 257
6-5 Statistical tests of the results 263
6-6 Linear least-squares fit 272
6-7 Nonlinear least-squares fit to data 282
Problems 292

7 Monte Carlo Calculations 295


7-1 Generation of random numbers 295
7-2 Molecular diffusion and Brownian motion 316
7-3 Data simulation and hypothesis testing 320
7-4 Percolation and critical phenomena . . 327
7-5 The Ising model 339
7-6 Path integrals in quantum mechanics 349
7-7 Fractals 363
Problems 374

8 Finite Difference Solution of Differential Equations 377


8-1 Types of differential equations 377
8-2 Runge-Kutta methods 384
8-3 Solution of initial value problems by extrapolation 392
8-4 Boundary value problems by shooting methods 398
Contents vii

8-5 Relaxation methods 408


8-6 Boundary value problems in partial differential equations 417
8-7 Parabolic partial differential equations 422
8-8 Hyperbolic partial differential equations 432
8-9 Nonlinear differential equations 437
8-10 Stiffness problems 445
Problems 449
Computational Methods in Physics and Engineering Downloaded from www.worldscientific.com

9 Finite Element Solution to P D E 451


9-1 Background 451
9-2 Shape functions and finite element approximation 456
9-3 Assembling contributions from elements 461
9-4 Variational approach 464
9-5 Application to a two-dimensional Poisson equation 467
by 169.149.142.3 on 05/21/17. For personal use only.

Problems 476

Appendix A 477
A-l Decomposition into prime numbers 477
A-2 Bit-reversed order 479
A-3 Gaussian elimination of a tridiagonal matrix 480
A-4 Random bit generator 482
A-5 Reduction of higher-order ODE to first-order 483

Appendix B List of Fortran Program Examples 485

Bibliography 487

Index 493
Computational Methods in Physics and Engineering Downloaded from www.worldscientific.com
by 169.149.142.3 on 05/21/17. For personal use only.

This page is intentionally left blank


Preface to the First Edition
Computational Methods in Physics and Engineering Downloaded from www.worldscientific.com

Computational methods form an increasingly important part of the undergraduate curricu


lum in physics and engineering these days. This book is mainly concerned with the ways
that computers may be used to advance a student's understanding of physics. A large part
of the material is common to engineering as well.
The subject matter covered in this volume may be classified also under the title of
"computational physics." There are several ways to organize the material that should be
included. The choice made here is to follow the traditional approach of mathematical
by 169.149.142.3 on 05/21/17. For personal use only.

physics. That is, the chapters and sections are grouped around methods, with physical
problems used as the motivation and examples. One attractive alternative is to group
around physical phenomena. The difficulty of following this way of organization is the
heavy reliance on the physics background of the readers, thus making it harder to follow for
students at early stages of their education. For this reason, such an approach is rejected.
The intimate relation between physics and mathematics may be seen by the way that
physics is usually taught in the undergraduate curriculum. With a knowledge of calculus,
for example, the subject of mechanics is discussed in a more rigorous manner. By the
time the student is introduced to differential equations, topics such as harmonic oscillators
and alternating current circuits, are brought in. Long experience in the community has
shown this way of teaching to be very successful. The major problem here is the delay
in introducing certain other basic concepts, because of the need to acquire first a certain
maturity in mathematics. The fault is not with the mathematics required but the way it is
used. For example, discussions on a pendulum are usually limited to small amplitudes at the
early years. For finite amplitudes, the differential equation is nonlinear and the necessary
skill to solve such equations by analytical methods comes only in later years. On the other
hand, it is possible to use the same numerical methods to solve both types of differential
equations for the pendulum problem and they are no more difficult than analytical methods.
In this way, the discussion on pendulum does not have to be limited to small amplitude
oscillations.
Until quite recently, the mathematics required in undergraduate physics and engineer
ing, to a large extent, consists of analytical techniques to manipulate algebraic equations,
to carry out integrals, and to solve simple differential equations. In addition to these "alge
braic" methods, there is also a large class of numerical approaches that can be used to solve
physical problems. While it is true that computers have made numerical calculations pop
ular, many of the methods have their origins with the same group of mathematicians as the
algebraic methods, such as Gauss and Newton. In the intervening years since the introduc
tion of these mathematical techniques, numerical calculations have lost out to "algebraic"
ones, perhaps because of the tedium of carrying out numerical calculations by hand. This
reason is certainly no longer true, as attested by the explosion of numerical solutions in
research papers. In spite of its popularity in research, the introduction of computational
physics to the undergraduate syllabus is only starting.

IX
X Preface to the First Edition

To carry out numerical calculations on a computer, the usual practice is to write one or
more programs in one of the high-level languages, such as FORTRAN or C. To simplify the
process, one may make use of standard subroutine libraries to take over specific tasks, such
as inverting a determinant or diagonalizing a matrix. In contrast, the general approach
to algebraic computation is to make use of one of the symbolic manipulation packages.
Most of these packages are very powerful and are able to carry out a large variety of
complicated calculations. Although a substantial amount of "programming" can be done
Computational Methods in Physics and Engineering Downloaded from www.worldscientific.com

in most cases, the symbolic manipulation instructions are not programming languages on
the same level as, for example, FORTRAN or C. Furthermore, there has been little attempt
to standardize the instructions between diflFerent packages. As a result, any discussions of
algebraic calculations in a volume on computational methods must either be very abstract
or very specific in terms of one of these packages. The choice made here is the former, as it
is not clear what is available to the average reader.
The results obtained from computer calculations often appear in the form of a large
by 169.149.142.3 on 05/21/17. For personal use only.

table of numbers. For human beings to comprehend such huge quantities of information,
graphical presentations are essential. For this reason, graphical techniques are essential
parts of computational methods. On the other hand, it is not possible to cover all three
aspects, numerical, symbolic, and graphical, in a single volume. The choice made here is
to select a few of the standard topics in physics covered in the undergraduate curriculum
and present them in ways that computers may be useful for their solutions. Even this
is too big a task. The compromise is to put the emphasis on numerical techniques. For
reasons mentioned in the previous paragraph, only an introduction is made to symbolic
manipulation techniques. Computer graphics is perhaps one of the fastest growing areas in
computing. For this reason also, it is best to leave everything beyond an introduction to
volumes specializing on the subject.
There is quite a bit of interest in the physics community in developing courses in compu
tational physics, as has already been done in many places. Such courses should be regarded
as in parallel with the more traditional ones in mathematical physics and experimental
physics. It is one of the aims of this volume to serve as a textbook or major reference for
such a course. At the same time, many graduate students and senior undergraduates may
not have benefited from such a course. It is also the intention here to serve this group of
physicists. Engineers and other professional people who make use of computational tech
niques in physics may also find it useful to examine some of the background involved in
solving some of the physical problems on computers.
Although a set of computer program is present here, it is not the primary intention
of the author to provide a library of subroutines for common problems in physics. The
computer programs used as examples and included in the accompanying diskette are in
tended as illustrations for some of the materials discussed. They can be modified for other
applications. However, before one does that, as with any computer program, the programs
should be thoroughly tested first for the intended purpose.

S. S. M. Wong
Preface to the Second Edition
Computational Methods in Physics and Engineering Downloaded from www.worldscientific.com

The excellent reception of the first edition by the reader community worldwide makes
it imperative for a new edition. Many subtle changes have taken place in scientific
by 169.149.142.3 on 05/21/17. For personal use only.

computation in the time interval. Most of these are driven by the tremendous increase
in computational power available to the individual user, making it possible to carry
out work almost unthinkable a little while ago and there is every indication that the
trend will continue in the near future. As a result, computational techniques become
even more indispensable to engineers and scientists than ever before. At the same
time, the convenience of communication through internet is also having an impact
on how computers are used and how some of the computations are carried out these
days.
The main changes in the second edition include the addition of a chapter on
finite element methods. The growth of available computing power makes it more and
more attractive to solve many complicated differential equations numerically and a
different approach from the traditional finite difference methods is getting increasing
attention, especially in the physics community. In order to keep the volume from
expanding into unmanageable size, some sacrifices have to be made. These include
introductory chapters on graphics and computer algebra and a couple of sections
on topics that are less popular. Some derivations that can be left to references are
also omitted. In order to accommodate these changes, most of chapters have been
substantially rewritten. The end result is a volume that is more ideal in size both for
the classroom and on the desk.
Many valuable suggestions have been received from readers and they have been
incorporated, as far as possible, into the new edition. The author is greatly indebted
to colleagues for caring to communicate and share their thoughts. The strong en
couragement and support from World Scientific also form an essential ingredient in
making the decision to finish on the second edition.

Samuel S.M. Wong


Toronto

XI

You might also like