Full Download Numerical Methods in Engineering With Python First Edition Jaan Kiusalaas PDF DOCX
Full Download Numerical Methods in Engineering With Python First Edition Jaan Kiusalaas PDF DOCX
com
https://ebookname.com/product/numerical-methods-in-
engineering-with-python-first-edition-jaan-kiusalaas/
OR CLICK HERE
DOWLOAD NOW
https://ebookname.com/product/numerical-methods-in-engineering-with-
matlab-jaan-kiusalaas/
ebookname.com
https://ebookname.com/product/numerical-methods-for-chemical-
engineering-applications-in-matlab-1st-edition-kenneth-j-beers/
ebookname.com
https://ebookname.com/product/numerical-and-analytical-methods-with-
matlab-1st-edition-william-bober/
ebookname.com
https://ebookname.com/product/advanced-vocabulary-in-context-wih-key-
properly-bookmarked-5th-edition-donale-watson/
ebookname.com
Alienation The Experience of the Eastern Mediterranean 50
600 A D Antigone Samellas
https://ebookname.com/product/alienation-the-experience-of-the-
eastern-mediterranean-50-600-a-d-antigone-samellas/
ebookname.com
https://ebookname.com/product/inequality-and-economic-integration-1st-
edition-francesco-farina/
ebookname.com
https://ebookname.com/product/gandhi-s-interpreter-a-life-of-horace-
alexander-1st-edition-geoffrey-carnall/
ebookname.com
https://ebookname.com/product/visual-culture-in-organizations-theory-
and-cases-1st-edition-alexander-styhre/
ebookname.com
Myths America Lives By White Supremacy and the Stories
That Give Us Meaning 2nd Edition Richard T. Hughes
https://ebookname.com/product/myths-america-lives-by-white-supremacy-
and-the-stories-that-give-us-meaning-2nd-edition-richard-t-hughes/
ebookname.com
Numerical Methods in Engineering with Python
Python
Jaan Kiusalaas
The Pennsylvania State University
Cambridge, New York, Melbourne, Madrid, Cape Town, Singapore, São Paulo
Cambridge University Press has no responsibility for the persistence or accuracy of s
for external or third-party internet websites referred to in this publication, and does not
guarantee that any content on such websites is, or will remain, accurate or appropriate.
Contents
Preface . . . . . . . . . vii
1. Introduction to Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Appendices . . . . 409
Index . . . . . . . . . . . 419
v
Preface
This book is targeted primarily toward engineers and engineering students of ad-
vanced standing (sophomores, seniors and graduate students). Familiarity with a
computer language is required; knowledge of basic engineering mechanics is useful,
but not essential.
The text attempts to place emphasis on numerical methods, not programming.
Most engineers are not programmers, but problem solvers. They want to know what
methods can be applied to a given problem, what are their strengths and pitfalls and
how to implement them. Engineers are not expected to write computer code for basic
tasks from scratch; they are more likely to utilize functions and subroutines that have
been already written and tested. Thus programming by engineers is largely confined
to assembling existing pieces of code into a coherent package that solves the problem
at hand.
The “piece” of code is usually a function that implements a specific task. For the
user the details of the code are unimportant. What matters is the interface (what goes
in and what comes out) and an understanding of the method on which the algorithm
is based. Since no numerical algorithm is infallible, the importance of understanding
the underlying method cannot be overemphasized; it is, in fact, the rationale behind
learning numerical methods.
This book attempts to conform to the views outlined above. Each numerical
method is explained in detail and its shortcomings are pointed out. The examples that
follow individual topics fall into two categories: hand computations that illustrate the
inner workings of the method and small programs that show how the computer code is
utilized in solving a problem. Problems that require programming are marked with .
The material consists of the usual topics covered in an engineering course on
numerical methods: solution of equations, interpolation and data fitting, numerical
differentiation and integration, solution of ordinary differential equations and eigen-
value problems. The choice of methods within each topic is tilted toward relevance
to engineering problems. For example, there is an extensive discussion of symmetric,
vii
viii Preface
www.cambridge.org/0521852870
The author wishes to express his gratitude to the anonymous reviewers and
Professor Andrew Pytel for their suggestions for improving the manuscript. Credit
is also due to the authors of Numerical Recipes (Cambridge University Press) whose
presentation of numerical methods was inspirational in writing this book.
1 Introduction to Python
1 The Python interpreter also compiles byte code, which helps to speed up execution somewhat.
1
2 Introduction to Python
Python has other advantages over mainstream languages that are important in a
learning environment:
r Python is open-source software, which means that it is free; it is included in most
Linux distributions.
r Python is available for all major operating systems (Linux, Unix, Windows, Mac OS
etc.). A program written on one system runs without modification on all systems.
r Python is easier to learn and produces more readable code than other languages.
r Python and its extensions are easy to install.
Development of Python was clearly influenced by Java and C++, but there is also
a remarkable similarity to MATLAB® (another interpreted language, very popular
in scientific computing). Python implements the usual concepts of object-oriented
languages such as classes, methods, inheritance etc. We will forego these concepts
and use Python strictly as a procedural language.
To get an idea of the similarities between MATLAB and Python, let us look at the
codes written in the two languages for solution of simultaneous equations Ax = b by
Gauss elimination. Here is the function written in MATLAB:
for k in range(0,n-1):
for i in range(k+1,n):
if a[i,k] != 0.0:
lam = a [i,k]/a[k,k]
a[i,k+1:n] = a[i,k+1:n] - lam*a[k,k+1:n]
b[i] = b[i] - lam*b[k]
for k in range(n-1,-1,-1):
b[k] = (b[k] - dot(a[k,k+1:n],b[k+1:n]))/a[k,k]
return b
The command from numarray import dot instructs the interpreter to load
the function dot (which computes the dot product of two vectors) from the module
numarray. The colon (:) operator, known as the slicing operator in Python, works the
same way it does in MATLAB and Fortran90—it defines a section of an array.
The statement for k = 1:n-1 in MATLAB creates a loop that is executed with
k = 1, 2, . . . , n − 1. The same loop appears in Python as for k in range(n-1).
Here the function range(n-1) creates the list [0, 1, . . . , n − 2]; k then loops over
the elements of the list. The differences in the ranges of k reflect the native off-
sets used for arrays. In Python all sequences have zero offset, meaning that the in-
dex of the first element of the sequence is always 0. In contrast, the native offset in
MATLAB is 1.
Also note that Python has no end statements to terminate blocks of code (loops,
conditionals, subroutines etc.). The body of a block is defined by its indentation; hence
indentation is an integral part of Python syntax.
Like MATLAB, Python is case sensitive. Thus the names n and N would represent
different objects.
Obtaining Python
Python interpreter can be downloaded from the Python Language Website
www.python.org. It normally comes with a nice code editor called Idle that allows
you to run programs directly from the editor. For scientific programming we also
need the Numarray module which contains various tools for array operations. It is
obtainable from the Numarray Home Page http://www.stsci.edu/resources/
software hardware/numarray. Both sites also provide documentation for down-
loading. If you use Linux or Mac OS, it is very likely that Python is already installed on
your machine (but you must still download Numarray).
You should acquire other printed material to supplement the on-line documen-
tation. A commendable teaching guide is Python by Chris Fehly, Peachpit Press, CA
(2002). As a reference, Python Essential Reference by David M. Beazley, New Riders
4 Introduction to Python
Publishing (2001) is recommended. By the time you read this, newer editions may be
available.
The assignment b = 2 creates an association between the name b and the integer
value 2. The next statement evaluates the expression b * 2.0 and associates the
result with b; the original association with the integer 2 is destroyed. Now b refers to
the floating point value 4.0.
The pound sign (#) denotes the beginning of a comment—all characters between
# and the end of the line are ignored by the interpreter.
Strings
A string is a sequence of characters enclosed in single or double quotes. Strings are
concatenated with the plus (+) operator, whereas slicing (:) is used to extract a portion
of the string. Here is an example:
Tuples
A tuple is a sequence of arbitrary objects separated by commas and enclosed in paren-
theses. If the tuple contains a single object, the parentheses may be omitted. Tuples
support the same operations as strings; they are also immutable. Here is an example
where the tuple rec contains another tuple (6,23,68):
Lists
A list is similar to a tuple, but it is mutable, so that its elements and length can be
changed. A list is identified by enclosing it in brackets. Here is a sampling of operations
that can be performed on lists:
Matrices can represented as nested lists with each row being an element of the
list. Here is a 3 × 3 matrix a in the form of a list:
The backslash (\) is Python’s continuation character. Recall that Python sequences
have zero offset, so that a[0] represents the first row, a[1] the second row, etc. With
very few exceptions we do not use lists for numerical arrays. It is much more convenient
Other documents randomly have
different content
13. Die Metropole des Südens.
Bahia Blanca.
er Zug fährt durch eine Wand von Staub. Mehr als die
schwarzen Schleier, die die unendliche Nacht vor die
Kupeefenster zieht, sind es die Staubmassen, die jeden
Ausblick hemmen. Wie inmitten einer Sandhose fährt der Zug.
Resigniert gibt man den Versuch auf, durch die blinden Scheiben
den Charakter der Landschaft zu erspähen, und läßt auch noch die
hölzernen Rolläden herab, um dem Staub den Eintritt in den Wagen
zu wehren.
Umsonst. Durch die feinsten Ritzen dringt er ein. Fingerdick setzt
er sich auf Polster und Lehne, auf Koffer und Kleider. Von Zeit zu Zeit
macht ein Bediensteter der Bahn den Versuch, mit einem Wedel den
Staub aufzuwischen. Es ist hoffnungslos. Der Zug ertrinkt im Staub.
Wie sagte der Herr in Bahia Blanca, als er von meiner Reise
durch Neuquen hörte?
„Was, in diese Wüste wollen Sie?“
„Waren Sie denn schon einmal dort?“ war meine Gegenfrage.
„Nein, aber das weiß man doch!“
Das weiß man doch! Ich frage etwas unter meinen Bekannten in
Bahia Blanca herum, wer Neuquen oder auch nur Rio Negro kenne.
Das Resultat war nicht anders als in Buenos Aires. — Kaum einer.
Seltsam, da handeln die Geschäftsherren mit den Frutos del pais, mit
Getreide und Alfalfa, mit Wolle und Häuten, aber sie haben kein
Interesse daran, das Land kennenzulernen, aus dem sie das
beziehen, womit sie sich ein Vermögen machen.
Und so bilden sich Urteile nicht aus eigener Anschauung, sondern
gleichsam auf überkommenen Konventionen ruhend, die man
nachspricht, ohne sie nachzuprüfen. „Patagonien — nur für
Schafzucht geeignet“, „Regierungsland — wertlos“, „Neuquen — eine
Wüste“.
Stimmt das Urteil? Auf den Stationen sieht man im schwachen
Licht der Sterne kaum eine Bretterbude, einen Windmotor und
Wassertank, dahinter nichts als zampabestandene Wüste. — Ich
gehe ins Schlafkupee. Auch hier der Staub. Noch in den Traum folgt
er und liegt beim Aufwachen trocken im Gaumen und knirscht
zwischen den Zähnen.
Die Stationen sind spärlich geworden. Stundenlang fährt der Zug
von einer zur andern. Und nicht einmal für die wenigen fanden sich
Namen, einfach Kilometer soundso.
Sand, Zampa, Tosca, dorniges Buschwerk, bestenfalls am
Horizont ein paar Hügel und leicht sich wellende Berge.
Um neun Uhr sind wir in Ramon M. Castro, der letzten Station vor
Zapala, von wo die Reise zu Pferd weitergehen soll.
Freundliche Marktweiber.
Lamaherde.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com