Professional Documents
Culture Documents
Numerical JA
Numerical JA
Methods,
Algorithms
and Tools in
All the source codes for the material contained in this book can be downloaded directly from the
publisher’s
& Updates.”
CRC Press
10 9 8 7 6 5 4 3 2 1
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,
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,
Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and
are used
p. cm.
QA297.D684 2010
518.0285’5133--dc22 2009031461
http://www.taylorandfrancis.com
http://www.crcpress.com
Preface
Today, more than at any other time in the history of mankind, computers are increasingly
world and as a result, also deepen our appreciation and reverence for God’s Creation.
Consequently, as computers evolve, so must the means to control them through advancements
In order to satisfy this demand for better software, Microsoft released an entirely
new programming language called C# that incorporates the best features of all the
other existing popular programming languages such as Java, C/C++, and Visual Basic.
the past and continue to program computers the hard way, C# has now firmly established
art Microsoft .NET programming environment, this book provides readers with
working C# code including practical examples that can be easily customized and implemented
real-world applications.
For the benefit of those readers who are not yet familiar with C#, Chapter 1 provides
a brief outline of the .NET Framework, the C# programming language and the
topics that illustrate how to best utilize these and other tools to develop accurate and
Chapter 2 is entirely focused on the .NET Framework Math Class Library which
already comes built into Microsoft’s Visual Studio software development system.
Chapter 3 introduces data structures along with their associated functions that are
particularly useful for programming and working with vectors and matrices. These
iii
issues can sometimes pose a substantial problem when doing numerical calculations,
complex number functions are presented using both elegant state-of-the-art objectoriented
methods which, although slick, can at times carry some overhead and the
old fashioned but proven methods which at times have been found to actually run
faster on some computers. In addition, important overflow and underflow issues are
also discussed and alternative solutions to avoid those problems are proposed.
often required to perform various types of data sorting for which many different
very important decision that developers frequently have to make. In this chapter,
readers are provided with both a wide selection of sorting and searching algorithms
from which to choose along with a brief explanation of how each algorithm works.
to image processing.
analytically often need to be solved using some kind of interpolation scheme, and
this chapter has plenty of practical examples to illustrate how one might handle this
kind of problem.
This is actually a huge topic by itself and quite worthy of its own book. Nevertheless,
and engineering.
comes with its own internal random number generator function, it is not regarded to
order to produce reliable and accurate results. Alternate ways to obtain both computer
generated pseudo-random numbers and real random numbers obtained from
naturally occurring physical phenomena are also discussed. In addition, routines are
also provided for generating random numbers that follow a particular probability
distribution function.
of functions. This is a very tricky and controversial topic whose approximations can
give fairly good to atrociously bad results. Nevertheless, numerical methods do exist
for calculating these types of functions. The trick is really in learning to recognize the
difference between good and bad results and in choosing the best available method
of specific functions as well as from collections of rawdata points. Other more exotic
Preface v
ways of calculating integrals, such as by using Monte Carlo methods, are also briefly
discussed.
analysis of data.
functions which are typically found in various branches of mathematics, physics and
engineering.
Chapter 15 is focused on least squares and numerical curve fitting methods that
differential equations. Although this is really a huge topic, there are some basic
numerical methods which can be used successfully to solve a lot of these types of
equations in many real-world applications.
equations. Although this is also a huge topic by itself and quite deserving of its
own book, there are some standard types of partial differential equations that arise
naturally in many areas of science and engineering, and whose solutions can be approximated
and engineering applications. Since this is still a very active area of ongoing research,
the examples presented here are more narrowly focused on just a few established
topics with the explicit purpose of illustrating how such methods may be individually
Lastly, I would like to point out that most of the numerical methods described in
this book have actually been around in one form or another for years, and sometimes
even for centuries, and it is only their computer implementation in C# that makes
this book uniquely different from some other book on the topic of numerical analysis.
Accordingly, I have made every effort to track down and give proper credit to
original sources whenever possible as the size of this book’s reference section can
easily attest. In addition, I have also made every effort to provide my readers with
errors are ever found so that I may promptly have the problem corrected for any future
editions of this book. Also, as with just about everything we do in life, there is
always room for improvement. Accordingly, I would also very much welcome any
constructive criticism that my readers may have regarding this book so that I can perhaps
make appropriate changes. Finally, there is an old saying that states, “an author
never finishes a book, but merely abandons it.” I have certainly come to appreciate
that observation after working on this project for so long and making countless revisions.
Nevertheless, this has certainly been a very enjoyable project where just about
every word was carefully chosen and every topic was meticulously researched and
writing this book, it is only with the modest hope that it may be useful to my readers
Concord, California
e-mail: waldemar007@hotmail.com
website: www.waldemardospassos.com
Acknowledgements
It gives me great pleasure to thank the many people who made this book possible.
First, I would very much like to thank my publisher, Nora Konopka, for not only accepting
this book for publication but also for her exceptional patience as I underwent
a series of unforeseen tumultuous events in my life during the course of writing this
book which unfortunately led to some regrettable delays in its original publication
target date. I would also like to particularly thank both my project director, Theresa
Delforn, and my editor, Amy Rodriguez, for their excellent expert guidance in various
aspects of this project. I would also like to thank Dawn Snider for her excellent
artistic skills in designing the cover for this book. Many thanks to Ashley Gasque
for guiding me through the necessary bureaucratic paperwork and to Shashi Kumar
for some expert LATEX tips he gave me. I would also like to thank all those other
wonderful people at Taylor & Francis who have worked tirelessly behind the scenes
to make this project a success but whose exact names I may likely never come to
know.
I am also very grateful for the support I received from the H.E. Martin Foundation
under grant 13011938. Without their most kind and extraordinary generous financial
assistance, the writing of this book would not have been possible.
I am especially grateful to my third grade teacher, Miss Daly, for all her help,
and eventually, physics. Looking back over all these years that have elapsed
since I was a student in her class, I can now say unequivocally that Miss Daly was
by far the very best and most caring teacher, professor, or instructor I ever had.
Lastly, I would also like to express my deepest and most heartfelt thanks to my