Contents
Page List
Practical Numerical and Scientific Computing with MATLAB and Python
Practical Numerical and Scientific Computing with MATLAB and Python
Eihab B. M. Bashier
MATLAB is a trademark of The MathWorks, Inc. and is used with permission. The Mathworks does not warrant the accuracy of the text or exercises in this book. This books use or discussion of MATLAB software or related products does not constitute endorsement or sponsorship by The MathWorks of a particular pedagogical approach or particular use of the MATLAB software.
CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742
2020 by Taylor & Francis Group, LLC
CRC Press is an imprint of Taylor & Francis Group, an Informa business
No claim to original U.S. Government works
Printed on acid-free paper
International Standard Book Number-13: 978-0-367-07669-6 (Hardback)
This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers.
For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged.
Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe.
Library of Congress Cataloging-in-Publication Data
Names: Bashier, Eihab Bashier Mohammed, author.
Title: Practical Numerical and Scientific Computing with MATLAB and Python / Eihab B.M. Bashier.
Description: Boca Raton : CRC Press, 2020. | Includes bibliographical references and index.
Identifiers: LCCN 2019052363 | ISBN 9780367076696 (hardback) | ISBN 9780429021985 (ebook)
Subjects: LCSH: Science--Data processing. | MATLAB. | Python (Computer program language)
Classification: LCC Q183.9 B375 2020 | DDC 502.85/53--dc23
LC record available at https://lccn.loc.gov/2019052363
Visit the Taylor & Francis Web site at
http://www.taylorandfrancis.com
and the CRC Press Web site at
http://www.crcpress.com
To my parents, family and friends.
Contents
The past few decades have witnessed tremendous development in the manufacture of computers and software, and scientific computing has become an important tool for finding solutions to scientific problems that come from various branches of science and engineering. Nowadays, scientific computing has become one of the most important means of research and learning in the fields of science and engineering, which are indispensable to any researcher, teacher, or student in the fields of science and engineering.
One of the most important branches of scientific computing is a numerical analysis which deals with the issues of finding approximate numerical solutions to such problems and analyzing errors related to such approximate methods. Both the MATLAB and Python programming languages provide many libraries that can be used to find solutions of scientific problems visualizing them. The ease of use of these two languages became the most languages that most scientists who use computers to solve scientific problems care about.
The idea of this book came after I taught courses of scientific computing for physics students, introductory and advanced courses in mathematical software and mathematical computer applications in many Universities in Africa and the gulf area. I also conducted some workshops for mathematics and science students who are interested in computational mathematics in some Sudanese Universities. In these courses and workshops, MATLAB and Python were used for the implementation of the numerical approximation algorithms. Hence, the purpose of introducing this book is to provide the student with a practical guide to solve mathematical problems using MATLAB and Python software without the need for third-party assistance. Since numerical analysis is concerned with the problems of approximation and analysis of errors of numerical methods associated with approximation methods, this book is more concerned with how these two aspects are applied in practice by software, where illustrations and tables are used to clarify approximate solutions, errors and speed of convergence, and its relations to some of the numerical method parameters, such as step size and tolerance. MATLAB and Python are the most popular programming languages for mathematicians, scientists, and engineers. Both the two programming languages possess various libraries for numerical and symbolic computations and data representation and visualization. Proficiency with the computer programs contained in this book requires that the student have prior knowledge of the basics of the programming languages MATLAB and Python, such as branching, Loops, symbolic packages, and the graphical libraries. The MATLAB version used for this book is 2017b and the Python version is 3.7.4.
The book consists of 11 chapters divided into three parts: the first part is concerned with discussing numerical solutions for linear and nonlinear systems and numerical difficulties facing these types of problems with how to overcome these numerical difficulties. The second part deals with methods of completing functions, differential and numerical integration, and solutions of differential equations. The last part of the book discusses methods to solve linear and nonlinear programming and optimal control problems. It also contains some specialized software in Python language to solve some problems numerically. These software packages must be downloaded from a third party, such as Gekko which is used for the solutions of differential equations and linear and nonlinear programming in addition to the optimal control problems. Also, the Pulp package is used to solve linear programming problems and finally Pyomo a package is used for solving linear and nonlinear programming problems. How to install and run such a package is also presented in the book.
What distinguishes this book from many other numerical analysis books is that it contains some topics that are not usually found in other books, such as nonstandard finite difference methods for solving differential equations and solutions of optimal control problems. In addition, the book discusses implementations of methods with high convergence rates, such as Gauss integration methods discussed in the numerical differentiation and integration, exact finite difference schemes for solving differential equations discussed in the nonstandard finite differences Chapter. It also uses efficient python-based software for solving some kinds of mathematical problems numerically.