ebook img

Practical Scientific Computing PDF

197 Pages·2011·7.45 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Practical Scientific Computing

Practical Scientific Computing 0 Woodhead Publishing Limited, 201 1 Related titles: Essentials of scientijk computing: numerical methods for science and engineering (ISBN 978-1-904275-32-9) Modern development of science and technology is based to a large degree on computer modelling. To understand the principles and techniques of computer modelling, students should first get a strong background in classical numerical methods, which are the subject of this book. This text is intended for use in a numerical methods course for engineering and science students, but will also be useful as a handbook on numerical techniques for research students. Essentials of scientific computing is as self-contained as possible and considers a variety of methods for each type of problem discussed. It covers the basic ideas of numerical techniques, including iterative process, extrapolation and matrix factorization, and practical implementation of the methods shown is explained through numerous examples. An introduction to MATLAB is included, together with a brief overview of modem software widely used in scientific computations Fundamentals of university mathematics Third edition (ISBN 978-0-85709-223-6) The third edition of this popular and effective textbook provides in one volume a unified treatment of topics essential for first-year university students studying for degrees in mathematics. Students of computer science, physics and statistics will also find this book a helpful guide to all the basic mathematics they require. It clearly and comprehensively covers much of the material that other textbooks tend to assume, assisting students in the transition to university-level mathematics. An essential reference for first-year university students in mathematics and related disciplines, it will also be of interest to professionals seeking a useful guide to mathematics at this level and capable pre-university students. Mathematical analysis and proof Second edition (ISBN 978- 1-904275-40-4) This fundamental and straightforward text addresses a weakness observed among present-day students, namely a lack of familiarity with formal proof. Beginning with the idea of mathematical proof and the need for it, associated technical and logical skills are developed with care and then brought to bear on the core material of analysis in such a lucid presentation that the development reads naturally and in a straightforward progres- sion. Retaining the core text, the second edition has additional worked examples which users have indicated a need for, in addition to more emphasis on how analysis can be used to tell the accuracy of the approximations to the quantities of interest which arise in analytical limits. Details of these and other Woodhead Publishing mathematics books can be obtained by: visiting our web site at www.woodheadpublishing.com contacting Customer Services (e-mail: [email protected]; fax: +44 (0) 1223 832819; tel.: +44 (0) 1223 499140 ext. 130; address: Woodhead Publishing Limited, 80 High Street, Sawston, Cambridge CB22 3HJ, UK) If you would like to receive information on forthcoming titles, please send your address details to: Francis Dodds (address, tel. and fax as above; e-mail: francis.dodds@ woodheadpub1ishing.com). Please confirm which subject areas you are interested in. 0 Woodhead Publishing Limited, 201 1 Practical Scientific Computing Ali Muhammad and Victor Zalizniak WOODHEAD PUBLISHING Oxford Cambridge Philadelphia New Delhi 0 Woodhead Publishing Limited, 201 1 Published by Woodhead Publishing Limited, 80 High Street, Sawston, Cambridge, CB22 3HJ, UK www.woodheadpublishing.com Woodhead Publishing, 1518 Walnut Street, Suite 1100, Philadelphia, PA 19102-3406, USA Woodhead Publishing India Private Limited, G-2, Vardaan House, 7/28 Ansari Road, Daryaganj, New Delhi - 110002, India www.woodheadpublishingindia.com First published 201 1, Woodhead Publishing Limited 0 Woodhead Publishing Limited, 201 1 The authors have asserted their moral rights. This book contains information obtained from authentic and highly regarded sources. Reprinted material is quoted with permission, and sources are indicated. Reasonable efforts have been made to publish reliable data and information, but the authors and the publisher cannot assume responsibility for the validity of all materials. Neither the authors nor the publisher, nor anyone else associated with this publication, shall be liable for any loss, damage or liability directly or indirectly caused or alleged to be caused by this book. Neither this book nor any part may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, microfilming and recording, or by any information storage or retrieval system, without permission in writing from Woodhead Publishing Limited. The consent of Woodhead Publishing Limited does not extend to copying for general distribution, for promotion, for creating new works, or for resale. Specific permission must be obtained in writing from Woodhead Publishing Limited for such copying. Trademark notice: Product or corporate names may be trademarks or registered trade- marks, and are used only for identification and explanation, without intent to infringe. British Library Cataloguing in Publication Data A catalogue record for this book is available from the British Library. ISBN 978-0-85709-225-0 (print) ISBN 978-0-85709-226-7 (online) The publisher’s policy is to use permanent paper from mills that operate a sustainable forestry policy, and which has been manufactured from pulp which is processed using acid-free and elemental chlorine-free practices. Furthermore, the publisher ensures that the text paper and cover board used have met acceptable environmental accreditation standards. Printed by TJI Digital, Padstow, Cornwall, UK 0 Woodhead Publishing Limited, 201 1 Table of Contents Preface ........................................................................................................... ix Acknowledgements .......................................................................................... Part I ............................................................................................................... 1 Chapter 1 Introduction ................................................................................. 3 1.1 Getting Started ........................................................................................... 4 1.2 Interpreter .................................................................................................. 7 1.3 Prog ram .................................................................................................... 10 Chapter 2 Expressions ................................................................................. 12 2.1 Matrix ...................................................................................................... 12 2.2 Real Number ............................................................................................ 13 2.3 Complex Number ..................................................................................... 14 2.4 Boolean .................................................................................................... 15 2.5 String. ....................................................................................................... 16 2.6 Structure. .................................................................................................. 17 2.7 Cell ........................................................................................................... 19 2.8 Range Expression .................................................................................... 20 2.9 Boolean Expression ................................................................................. 21 2.10 Relational Expression ............................................................................ 22 2.1 1 Numerical Expression ............................................................................ 23 Chapter 3 Statements .................................................................................. 25 3.1 Assignment Statement ............................................................................. 25 3.2 Loop Statements ...................................................................................... 27 3.2.1 “for” Statement ..................................................................................... 27 3.2.2 “while” Statement ................................................................................. 28 3.3 Conditional Statements ............................................................................ 28 3.3.1 “if” Statement ....................................................................................... 29 3.3.2 ‘‘switch” Statement .............................................................................. 30 3.4 Continue and Break Statements ............................................................... 31 Chapter 4 Programming ............................................................................. 32 4.1 Program. ................................................................................................... 32 4.2 Function ................................................................................................... 34 4.3 Procedure ................................................................................................. 42 4.4 Java Programming ................................................................................... 43 4.5 C Programming ........................................................................................ 49 0 Woodhead Publishing Limited. 201 1 vi Table of Contents Chapter 5 Architecture ............................................................................... 53 5.1 Front-end .................................................................................................. 53 5.2 Back-end .................................................................................................. 54 5.3 User Interface ........................................................................................... 55 5.4 Gnuplot Interface ..................................................................................... 56 5.5 Execution Engine ..................................................................................... 57 Chapter 6 Plotting ........................................................................................ 61 6.1 Simple Function Plot (fplot) .................................................................... 61 6.2 Two-Dimensional Plots ........................................................................... 64 6.2.1 Basic plot (plot) .................................................................................... 64 6.2.2 Logarithmic plot (plot) .......................................................................... 66 6.2.3 Polar plot (polar) ................................................................................... 67 6.2.4 Bar chart (bar) ....................................................................................... 67 6.2.5 Histogram plot (hist) ............................................................................. 67 6.2.6 Stairs plot (stair) .................................................................................... 68 6.3 Three-Dimensional Plots ......................................................................... 68 6.3.1 Line plot (plot3) .................................................................................... 68 6.3.2 Mesh surface plot (mesh, meshc, contour) ........................................... 69 Part I1 ............................................................................................................ 71 Chapter 7 Solving Nonlinear Equations .................................................... 73 7.1 Calculation of Roots with the use of Iterative Functions ......................... 73 7.1.1 One-point iterative processes ................................................................ 76 7.1.2 Multi-point iterative processes .............................................................. 82 7.1.3 One-point iterative processes with memory ......................................... 85 7.2 Exercises .................................................................................................. 86 Chapter 8 Solving Systems of Linear Equations ....................................... 89 8.1 Linear Algebra Background ..................................................................... 89 8.2 Systems of Linear Equations ................................................................... 92 8.3 Types of Matrices that arise from Applications and Analysis ................. 94 8.3.1 Sparse matrices ..................................................................................... 94 8.3.2 Band matrices ....................................................................................... 94 8.3.3 Symmetric positive definite matrices .................................................... 94 8.3.4 Triangular matrices ............................................................................... 94 8.3.5 Orthogonal matrices .............................................................................. 98 8.3.6 Reducible matrices ................................................................................ 98 8.3.7 Matrices with diagonal dominance ....................................................... 98 8.4 Error Sources ........................................................................................... 99 0 Woodhead Publishing Limited. 201 1 Table of Contents vii 8.5 Condition Number ................................................................................... 99 8.6 Direct Methods ....................................................................................... 100 8.6.1 Basic principles of direct methods ...................................................... 101 8.6.2 Error estimation for linear systems ..................................................... 103 8.7 Iterative Methods ................................................................................... 104 8.7.1 Basic principles of iterative methods .................................................. 104 8.7.2 Jacobi method ..................................................................................... 106 8.7.3 Gauss-Seidel method .......................................................................... 108 8.7.4 Method of relaxation ........................................................................... 110 8.7.5 Variational iterative methods .............................................................. 113 8.8 Exercises ................................................................................................ 115 Chapter 9 Computational Eigenvalue Problems .................................... 122 9.1 Basic Facts concerning Eigenvalue Problems ....................................... 122 9.2 Localization of Eigenvalues. .................................................................. 123 9.3 Power Method ........................................................................................ 124 9.4 Inverse Iteration ..................................................................................... 126 9.5 Iteration with a Shift of Origin .............................................................. 128 9.6 The QR Method ..................................................................................... 130 9.7 Exercises ................................................................................................ 133 Chapter 10 Introduction to Finite Difference Schemes for Ordinary Differential Equations ............................................................................... 138 10.1 Elementary Example ofa Finite Difference Scheme ........................... 138 10.2 Approximation and Stability ................................................................ 141 10.3 Numerical Solution of Initial Value Problems. .................................... 143 10.3.1 Stability of difference schemes for linear problems ......................... 144 10.3.2 Runge-Kutta methods ....................................................................... 146 10.3.3 Adams type methods ......................................................................... 150 10.3.4 Systems of differential equations ...................................................... 153 10.4 Numerical Solution of Boundary Value Problems .............................. 156 10.4.1 Conversion of difference schemes to systems of equations. .............1 56 10.4.2 Method of time development ............................................................ 158 10.4.3 Accurate approximation of boundary conditions when derivatives are specified at boundary points ........................................................................ 160 10.5 Error Estimation and Control ............................................................... 161 10.6 Exercises .............................................................................................. 164 Chapter 11 Interpolation and Approximation ....................................... 168 1 1. 1 Interpolation ........................................................................................ 168 11.1.1 Polynomial interpolation. .................................................................. 168 0 Woodhead Publishing Limited. 201 1 ... Vlll Table of Contents 1 1.1.2 Trigonometric interpolation .............................................................. 171 1 1.1.3 Interpolation by splines ..................................................................... 175 1 1.2 Approximation of Functions and Data Representation ........................ 176 11.2.1 Least-squares approximation ............................................................ 177 11.2.2 Approximation by orthogonal functions ........................................... 180 1 1.2.3 Approximation by interpolating polynomials ................................... 185 1 1.3 Exercises .............................................................................................. 186 Bibliography ................................................................................................ 189 0 Woodhead Publishing Limited. 201 1 Scientific computing is about developing mathematical models, numerical methods and computer implementations to study and solve real problems in science, engineering, business and even social sciences. Mathematical modeling requires deep understanding of classical numerical methods. There are a number of commercial and open source tools available which provide a rich collection of built- in mathematical functions. These tools are widely used by researchers to model, solve and simulate mathematical problems. These tools also offer easy to use programming languages for users to develop more functions. This book is divided into two parts. In the first part, we present an open source tool, numEclipse. It is a Java based tool modeled after MATLAB@ and it is implemented as a plug-in for Eclipse, which is a leading integrated development environment (IDE) for Java programming. In the second part, we study the classical methods of numerical analysis. We present the numerical algorithms and their implementations using numEclipse. Although we have tried to make this book as self-contained as possible, knowledge of calculus, linear algebra and differential equations is a prerequisite. Some exposure to a programming language will be helpful to follow the computer programs. Such a small volume as this book cannot do justice to the vast area of classical numerical methods. The choice of some of the topics is based on our own preferences and teaching experience. This book provides enough foundations for a beginner to venture into more advanced texts in the subject area. Ali Muhammad Victor Zalizniak 0 Woodhead Publishing Limited, 201 1

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.