Introduction to Python for Science and Engineering Second Edition David J. Pine - The ebook in PDF/DOCX format is available for instant download
Introduction to Python for Science and Engineering Second Edition David J. Pine - The ebook in PDF/DOCX format is available for instant download
https://ebookultra.com/download/engineering-mechanics-an-introduction-
to-dynamics-4th-edition-david-j-mcgill/
https://ebookultra.com/download/python-programming-an-introduction-to-
computer-science-john-m-zelle/
https://ebookultra.com/download/introduction-to-biomedical-
engineering-3ed-edition-enderle-j/
https://ebookultra.com/download/introduction-to-computing-and-
programming-in-python-a-multimedia-approach-mark-j-guzdial/
Introduction to Plasma Technology Science Engineering and
Applications 1st Edition John Ernest Harry
https://ebookultra.com/download/introduction-to-plasma-technology-
science-engineering-and-applications-1st-edition-john-ernest-harry/
https://ebookultra.com/download/introduction-to-psycholinguistics-
understanding-language-science-matthew-j-traxler/
https://ebookultra.com/download/introduction-to-fire-in-california-
second-edition-david-carle/
https://ebookultra.com/download/introduction-to-materials-science-and-
engineering-a-guided-inquiry-1st-edition-elliot-p-douglas/
https://ebookultra.com/download/introduction-to-chemical-engineering-
thermodynamics-7rd-ed-edition-j-m-smith/
Introduction to Python for Science and Engineering
Second Edition David J. Pine Digital Instant Download
Author(s): David J. Pine
ISBN(s): 9781032673950, 1032673958
File Details: PDF, 23.39 MB
Year: 2024
Language: english
Introduction to
Python for Science and
Engineering
Introduction to Python for Science and Engineering offers a quick and incisive
introduction to the Python programming language for use in any science or
engineering discipline. The approach is pedagogical and “bottom up,” which
means starting with examples and extracting more general principles from that
experience. No prior programming experience is assumed.
Readers will learn the basics of Python syntax, data structures, input and output,
conditionals and loops, user-defined functions, plotting, animation, and visual-
ization. They will also learn how to use Python for numerical analysis, including
curve fitting, random numbers, linear algebra, solutions to nonlinear equa-
tions, numerical integration, solutions to differential equations, and fast Fourier
transforms.
Readers learn how to interact and program with Python using JupyterLab and
Spyder, two simple and widely used integrated development environments.
All the major Python libraries for science and engineering are covered, includ-
ing NumPy, SciPy, Matplotlib, and Pandas. Other packages are also introduced,
including Numba, which can render Python numerical calculations as fast as
compiled computer languages such as C but without their complex overhead.
David J. Pine has taught physics and chemical engineering for over 40 years
at four different institutions: Cornell University (as a graduate student), Haver-
ford College, UCSB, and NYU, where he is a Professor of Physics, Mathematics,
and Chemical & Biomolecular Engineering. He has taught a broad spectrum of
courses, including numerical methods. He does research on optical materials
and in experimental soft-matter physics, which is concerned with materials such
as polymers, emulsions, and colloids.
Intelligent Data-Driven Systems and Artificial Intelligence
Series Editor: Harish Garg
Cognitive Machine Intelligence
Applications, Challenges, and Related Technologies
Inam Ullah Khan, Salma El Hajjami, Mariya Ouaissa, Salwa Belqziz and
Tarandeep Kaur Bhatia
David J. Pine
Designed cover image: David J. Pine
MATLAB• and Simulink• are trademarks of The MathWorks, Inc. and are used with per-
mission. The MathWorks does not warrant the accuracy of the text or exercises in this
book. This book’s use or discussion of MATLAB• or Simulink• software or related prod-
ucts does not constitute endorsement or sponsorship by The MathWorks of a particular
pedagogical approach or particular use of the MATLAB• and Simulink•software.
Second edition published 2025
by CRC Press
2385 NW Executive Center Drive, Suite 320, Boca Raton FL 33431
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 conse-
quences 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 re-
cording, 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, access www.
copyright.com or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood
Drive, Danvers, MA 01923, 978-750-8400. For works that are not available on CCC please
contact [email protected]
DOI: 10.1201/9781032673950
CHAPTER 1 Introduction 1
1.1 INTRODUCTION TO PYTHON FOR SCIENCE AND
ENGINEERING 1
1.2 INSTALLING PYTHON 3
vii
viii Contents
Index 413
Preface to First Edition
The aim of this book is to provide science and engineering students a practi-
cal introduction to technical programming in Python. It grew out of notes I
developed for various undergraduate physics courses I taught at NYU. While
it has evolved considerably since I first put pen to paper, it retains its original
purpose: to get students with no previous programming experience writing
and running Python programs for scientific applications with a minimum of
fuss.
The approach is pedagogical and “bottom up,” which means starting with
examples and extracting more general principles from that experience. This
is in contrast to presenting the general principles first and then examples of
how those general principles work. In my experience, the latter approach is
satisfying only to the instructor. Much computer documentation takes a top-
down approach, which is one of the reasons it’s frequently difficult to read and
understand. On the other hand, once examples have been seen, it’s useful to
extract the general ideas in order to develop the conceptual framework needed
for further applications.
In writing this text, I assume that the reader:
• is familiar with how to get around a Mac or PC at a very basic level; and
This book introduces, in some depth, four Python packages that are im-
portant for scientific applications:
xvii
xviii Preface to First Edition
The aim of the second edition remains the same as the first: to provide science
and engineering students a practical introduction to technical programming
in Python. This new edition adds nearly 100 pages of new material.
Among the changes, the concept of an object is developed more thor-
oughly, starting in Chapter 2 with the discussion of variables and assignment.
This perspective is continued throughout the text as the various aspects of ob-
jects are revealed and developed. The chapter on Python classes, now Chapter
10, has been completely rewritten with new examples. Here, we emphasize the
concept of encapsulation and its use in science and engineering.
Chapter 3 on the Spyder and Jupyter Lab integrated development environ-
ments (IDEs) is new. Some of the material on the Spyder IDE can be found in
the First Edition, but it has been updated and expanded in this edition. The
material on the Jupyter Lab IDE is entirely new, as Jupyter Lab has developed
significantly since the first edition and now offers a compelling IDE.
New examples have been added to Chapter 6 on conditionals and loops.
The chapter also includes a new section on exception handling.
The introduction of functions has been moved so that it now occurs be-
fore the chapter on plotting. Type hints, new to Python since the first edition,
are discussed. The subtle subject of namespace and scope and its relation to
functions has been expanded significantly.
The chapter on curve fitting has been eliminated. That material is now
covered in Chapters 7 and 9.
New material has been added to Chapter 8 on plotting, including an in-
troduction to the Seaborn package. New examples have been added, includ-
ing using two separate scales for a single axis, plots with insets, vector field
(quiver) plots, and plotting with polar coordinates.
Chapter 9 on the NumPy and SciPy packages has been expanded to in-
clude new material on interpolating and smoothing splines. Several updates
in various NumPy and SciPy packages have been incorporated into the text,
including changes in NumPy’s random number and polynomial packages.
xxi
xxii Preface to Second Edition
David Pine has taught Physics and Chemical Engineering for more than 40
years at four different institutions: Cornell University (as a graduate student),
Haverford College, UCSB, and NYU, where he is a Professor of Physics, Math-
ematics, and Chemical and Biomolecular Engineering. He has taught a broad
spectrum of courses, including numerical methods. He does research on opti-
cal materials and soft-matter physics, which is concerned with materials such
as polymers, emulsions, and colloids.
xxiii
CHAPTER 1
Introduction
DOI: 10.1201/9781032673950-1 1
2 Introduction to Python for Science and Engineering
Don’t worry if you don’t know exactly what these terms mean.1 Their pri-
mary significance for you is that you can write Python code, test it, and use it
quickly with a minimum of fuss.
One advantage of Python compared to MATLAB® is that it is free. It can be
downloaded from the web and is available on all the standard computer plat-
forms, including Windows, macOS, and Linux. This also means that you can
use Python without being tethered to the internet, as required for commercial
software tied to a remote license server.
Another advantage is Python’s clean and simple syntax, including its im-
plementation of object-oriented programming. This should not be discounted;
Python’s rich and elegant syntax renders many tasks that are difficult or arcane
in other languages more straightforward and understandable in Python.
A significant disadvantage is that Python programs can be slower than
compiled languages like C. For large-scale simulations and other demanding
applications, there can be a considerable speed penalty in using Python. In
these cases, C, C++, or Fortran are recommended, although intelligent use of
Python’s array processing tools in the NumPy module can significantly speed
up Python code. Alternatively, several new tools have recently appeared that
can be used to speed up certain numerical computations in Python signifi-
cantly, often by one or two orders of magnitude. These are discussed in Chap-
ter 13. Another disadvantage is that, compared to MATLAB®, Python is less
well-documented. This stems from the fact that it is public open source soft-
ware and thus depends on volunteers from the community of developers and
users for documentation. The documentation is freely available on the web
but is scattered among a number of different sites and can be terse. This book
will acquaint you with the most commonly used websites. Search engines like
Google can help you find others.
You are not assumed to have had any previous programming experience.
However, the purpose of this manual isn’t to teach you the principles of com-
puter programming; it’s to provide a very practical guide to getting started
with Python for scientific computing. Once you see some of the powerful
tasks you can accomplish with Python, perhaps you will be inspired to study
computational science and engineering, as well as computer programming, in
greater depth.
1
Appendix B contains a glossary of terms you may find helpful.
Introduction 3
Launching Python
In this chapter, you learn about IPython, an interface that allows you
to use Python interactively with tools optimized for mathematical and
computational tasks. You learn how to use IPython as a calculator to
add, subtract, multiply, divide, and perform other common mathemat-
ical functions. You also learn the basic elements of the Python program-
ming language, including functions, variables, and scripts, which are
rudimentary computer programs. You are introduced to Python mod-
ules, which extend the capabilities of the core Python language and al-
low you to perform advanced mathematical tasks. You also learn some
new ways to navigate your computer’s file directories. Finally, you learn
how to get help with Python commands and functions.
4 DOI: 10.1201/9781032673950-2
Launching Python 5
you are running Windows, launch the Anaconda Powershell Prompt application
from the Start menu. Under Linux, you can open the Terminal application by
pressing <ctrl + alt + T>.
After launching a terminal application, type jupyter qtconsole at the
terminal prompt and press <return>. This launches a particularly powerful
version of the IPython shell called the Qt Console. Alternatively, instead of
launching a terminal, you can launch Qt Console directly from the Anaconda-
Launcher app that is downloaded with the Anaconda Python Distribution. The
Qt Console for IPython will be used throughout this text. It should look like
the window in Figure 2.1. You should see the default input prompt of the
IPython shell, which looks like this:
In[1]:
This is not what you want either. Type quit() after the >>> prompt to quit the
Python shell and return to the system terminal. By the way, you can also type
quit() to quit either of the IPython shells and return to the system terminal.
6 Introduction to Python for Science and Engineering
indicates that the IPython shell is running and ready to receive input from
the user (you!). By typing commands at the prompt, IPython can be used to
perform various tasks, such as running programs, performing arithmetic, and
creating and moving files around on your computer.
Before getting started, we note that, like most modern computer lan-
guages, Python is case sensitive. That is, Python distinguishes between upper-
and lower-case letters. Thus, two words spelled the same but having different
letters capitalized are treated as different names in Python. Please keep that in
mind in all that follows.
Python returns the correct product, as expected. You can do more complicated
calculations:
In[2]: 6 + 21 / 3
Out[2]: 13.0
Notice that the effect of the parentheses in In[3]: (6 + 21) / 3 is to cause the
addition to be performed first and then the division. Without the parenthe-
ses, Python will always perform the multiplication and division operations be-
fore performing the addition and subtraction operations. The order in which
arithmetic operations are performed is the same as for most calculators: expo-
nentiation first, then multiplication or division, then addition or subtraction,
then left to right.
Launching Python 7
1. Integers in Python are simply, as their name implies, integers. They can
be positive or negative and can be arbitrarily long. In Python, a number
is automatically treated as an integer if it is written without a decimal
point. This means that 23, written without a decimal point, is an integer,
and 23., written with a decimal point, is a floating point number. Here
are some examples of integer arithmetic:
In[4]: 12 * 3
Out[4]: 36
In[5]: 4 + 5 * 6 - (21 * 8)
Out[5]: -134
In[6]: 11 / 5
Out[6]: 2.2
In[8]: 9734828*79372
Out[8]: 772672768016
For the binary operators +, -, *, and //, the output is an integer if the
inputs are integers. The output of the division operator / is a floating
point number (as of version 3 of Python). The floor division operator //
must be used if an integer output is desired when dividing two integers.
2. Floating point numbers are essentially rational numbers and can have
a fractional part; integers, by their very nature, have no fractional part.
In most versions of Python, floating point numbers go between approx-
imately ±2 × 10−308 and ±2 × 10308 . Here are some examples of floating
point arithmetic:
In[9]: 12. * 3
Out[9]: 36.0
In[10]: 12 / 3.
Out[10]: 4.0
In[11]: 5 ** 0.5
Out[11]: 2.23606797749979
In[12]: 5 ** (1/2)
Out[12]: 2.23606797749979
In[13]: 11. / 5.
Out[13]: 2.2
In[14]: 11. // 5.
Out[14]: 2.0
In[15]: 11. % 5.
Out[15]: 1.0
Note that the result of any operation involving only floating point num-
bers as inputs is another floating point number, even in cases where the
floor division // or remainder % operators are used. The last output illus-
trates an alternative way of writing floating point numbers as a mantissa
followed by e or E followed by a power of 10: so 1.23e-12 is equivalent
to 1.23 × 10−12 .
Notice also that multiplying or dividing a floating point number by an
integer produces a floating point number.
Launching Python 9
Notice that 2.5-3j**2 and (2.5-3j)**2 give different results. You need to
enclose the real and imaginary parts of a complex number in parenthe-
ses if you want exponentiation to operate on the entire complex number
and not simply on the imaginary part. It works similarly with multipli-
cation and division of complex numbers, so be sure to enclose the en-
tire complex number with parentheses if you wish to multiply or divide
complex numbers.
If you multiply an integer by a floating point number, the result is a float-
ing point number. If you multiply a floating point number by a complex
number, the result is a complex number. Python promotes the result to
the most complex of the inputs.
has an ID, which is just its location in your computer’s memory. We can de-
termine the ID of an object using Python’s id function.
In[21]: id (52)
Out[21]: 140294301609872
In[22]: id (241.3)
Out[22]: 140293508419248
In[23]: id (3+7j)
Out[23]: 140293508416368
The next thing to know is that every object has a type, which can be as-
certained using the function type. So, what are the types of the numbers we
introduced above?
In[24]: type (72)
Out[24]: int
The results are not too surprising: int for integers, float for floating point
numbers, and complex for complex numbers.
An object’s type defines how it interacts with other objects. For exam-
ple, you can freely add, subtract, multiply, and divide objects of the types int,
float, and complex, as illustrated above. On the other hand, you can’t multiply
float and complex types by a string type such as “dog” (we introduce strings in
Chapter 4). Trying to do so will result in an error message. Surprisingly, you
can multiply strings by int types, but we defer that discussion to Section 4.1.
Python binds the variable name a to the integer object 32. The equals sign = is
the assignment operator, and its function is to bind the variable name on the
left side to the object on its right side.
Consider the following code:
In[2]: leg_a = 3.7
Launching Python 11
19.53
leg_a = 19.53
In[5]: hypontenuse
Out[5]: 9.087353850269066
The first two statements bind the variable names leg_a and leg_b to the float
objects 3.7 and 8.3, respectively. The third statement performs the calculation
to the right of the equals sign and then binds the variable name hypotenuse to
the resulting float object 9.087353850269066. Note that Python binds the result
of the calculation, not the calculation itself, to the variable hypotenuse. There-
fore, if we reassign the value of leg_a to a new value, the value of hypotenuse
does not change, as demonstrated here.
In[6]: leg_a = 19.53
In[7]: hypotenuse
Out[7]: 9.087353850269066
When we write leg_a = 19.53, Python reassigns the variable name leg_a to
a new float object 19.53, as illustrated in Figure 2.2. The old object, in this
case, the float 3.7, is still in memory. Eventually, Python gets rid of it to free
up memory; this process is called garbage collection and occurs behind the
scenes so that you do not need to worry about it.
The assignment operator “=” in Python is not equivalent to the equals
sign “=” you are accustomed to in algebra. Consider the following sequence
of commands.
In[8]: a = 5
12 Introduction to Python for Science and Engineering
In[9]: a = a + 2
In[10]: a
Out[10]: 7
In[12]: c += 3
In[13]: c
Out[13]: 7
In[14]: c *
= 3
In[15]: c
Out[15]: 21
In[16]: d = 7.92
In[17]: d /= -2
In[18]: d
Out[18]: -3.96
In[19]: d -= 4
In[20]: d
Out[20]: -7.96
By the way, %=, **=, and //=, are also valid operators. Verify in the IPython
console that you understand how the above operations work.
Python also allows you to make multiple variable assignments in a single
statement
In[21]: p, q, r = 32.1 , 81.6 , 111.6
see if you were able to predict the correct results. The key thing to remember
is that Python evaluates the right-hand side of the equation before assigning
the results to the left-hand side.
Finally, please note that the same object can have multiple names. For ex-
ample, in the following code, a and b point to (i.e., are bound to) the same
object, which you can verify by checking the ID of each of them.
In[22]: a = b = 3.4
In[23]: id(a)
Out[23]: 140293508599056
In[24]: id(b)
Out[24]: 140293508599056
In[25]: b = 5.8
In[26]: id(b)
Out[26]: 140293508598928
In[27]: id(a)
Out[27]: 140293508599056
none of the objects for 5, 6, or 30 have names. They are all integer objects.
Not having variable names associated with them, we say that they are integer
literals.
In[31]: type(b)
Out[31]: int
14 Introduction to Python for Science and Engineering
Notice that after we wrote b = 6, its type changed from float to int. This fea-
ture of Python is called dynamical typing. A variable’s type can change on the
fly. That’s all we’ll say about dynamic typing for now, but we will return to this
topic.
In[35]: velocity
Out[35]: 57.6271186440678
Note, however, that word processing programs like Microsoft Word® are
not suitable for this purpose because they produce files that, in addition to the
visible text, contain all sorts of formatting code that is invisible to the user but
not the computer (or the Python interpreter). You must use a plain text editor.
Code: my_trip.py
1 """ Calculates time , electrical energy used , and cost of electricity
2 for a trip in an electric vehicle """
3 # Get inputs
4 distance = 180. # [ miles ]
5 mpk = 3.9 # [ miles /kilowatt -h] car mileage
6 speed = 60. # [ miles /h] average speed
7 cost_per_kWh = 0.22 # [$/kW -h] price of electricity
8
9 # Calculate outputs
10 time = distance / speed # [ hours ]
11 energy = distance / mpk # [kW -h]
12 cost = energy * cost_per_kWh # [$]
Save the file with the name my_trip.py in the directory PyScripts that you
created earlier (see Section 2.5.1.1). This stores your script (or program) on
your computer’s disk. More generally, the name of a Python file can be almost
Launching Python 17
anything consistent with the computer operating system as long the name ends
with the extension .py. The .py extension tells the computer this is a Python
program.
The code in the program is pretty straightforward: lines 4–7 set the values
of the inputs, while lines 10–12 calculate the desired information. All of the
variables are floats by virtue of the decimal point included in each assignment
statement. Notice that we included a blank line, line 8, between the input and
output blocks of code. This is not necessary, as the blank line serves no compu-
tational purpose. Rather, it indicates to the reader that the blocks do different
things, analogous to what paragraphs do in normal written text.
The text between the triple quotes at the beginning of the program is called
a “docstring” and is not executed when the script is run. Everything between
the triple quotes is part of the docstring, which can extend over multiple lines,
as it does here. It’s a good idea to include a docstring explaining what your
script does at the beginning of your file.
The hash (or number) symbol # is the “comment” character in Python;
anything on a line following # is ignored when the code is executed. A com-
ment in a Python script is a brief explanation or annotation added to help
people reading the program understand what the program is doing. Judicious
use of comments in your code will make it much easier to understand days,
weeks, or months after you write it. Use comments generously. For aesthetic
reasons, the comments on different lines have been aligned. This isn’t neces-
sary. The spaces needed to align the comments have no effect on the running
of the code.
Now you are ready to run the code. From a QtConsole, type
In[1]: run ~/ Documents / PyScripts / my_trip .py
When you run a script, Python executes the sequence of commands in the
order they appear. Afterward, you can see the values of the variables calculated
in the script by typing the name of the variable. IPython responds with the
value of that variable. For example:
In[2]: time
Out[2]: 3.0
In[3]: energy
Out[3]: 46.15384615384615
In[4]: cost
Out[4]: 10.153846153846153
Of course, you must remember that the time is in hours, and the cost is in U.S.
dollars.
You can change the number of digits IPython displays using the com-
mand %precision. To display two digits to the right of the decimal place, enter
%precision 2:
In[5]: % precision 2
Out[5]: ' %.2f'
In[6]: time
Out[6]: 3.00
In[7]: energy
Out[7]: 46.15
In[8]: cost
Out[8]: 10.15
the script will return the values of the variables time, gallons, and cost that
the script calculated. We will discuss the print function in much greater detail,
as well as other methods for data output, in Chapter 5.
Launching Python 19
NumPy is the standard Python package for scientific computing with Python.
It provides the all-important NumPy array data structure, which is
at the very heart of NumPy. It also provides tools for creating and
manipulating arrays, including indexing and sorting, as well as ba-
sic logical operations and element-by-element arithmetic operations
like addition, subtraction, multiplication, division, and exponentia-
tion. It includes the basic mathematical functions of trigonometry,
exponentials, and logarithms, as well as a vast collection of special
functions (Bessel functions, etc.), statistical functions, and random
number generators. It also includes many linear algebra routines that
overlap with those in SciPy, although the SciPy routines tend to be
more comprehensive. You can find more information about NumPy at
http://docs.scipy.org/doc/numpy/reference/index.html.
Matplotlib is the standard Python package for making two- and three-
dimensional plots. Matplotlib makes extensive use of NumPy arrays. All
of the plots in this book use this package. You can find more informa-
tion about Matplotlib at the website http://matplotlib.sourceforge.net/.
We will use these four modules extensively and, therefore, will provide in-
troductions to their capabilities as we develop Python. The links above provide
much more extensive information; you will certainly want to refer to them oc-
casionally.
After running this statement, you can access all the functions and data struc-
tures of NumPy. For example, you can now access NumPy’s sine function as
follows:
In[2]: numpy.sin (0.5)
Out[2]: 0.479425538604203
In this simple example, the sin function has one argument, here 0.5, and the
function returns the sine of that argument, which must be expressed in radi-
ans.
Note that we had to put the prefix numpy dot before the name of the actual
function name sin. This tells Python that the sin function is part of the NumPy
module that we just imported.
Another Python module called math also has a sine function. We can im-
port the math module just like we imported the NumPy module:
In[3]: import math
Another Random Scribd Document
with Unrelated Content
105. R u n d k e h r e i m S e i t e n t a l
zur Vermeidung zu starker Steigung im Haupttal
Auch die Strecke über den Brennerpaß besitzt eine Anlage dieser
Art. Hier zeigt die Eisenbahn einmal, daß sie schwerfälliger ist als die
Landstraße. Zu Fuß gelangt man von Schellenberg nach Gossensaß weit
schneller als im Abteil des D-Wagens. Die Landstraße steigt zwischen
den in der Luftlinie nur 1100 Meter voneinander entfernten Orten
ziemlich geradlinig hinunter. Die Bahn aber muß sich, um 176 Meter tief
in das Tal der Eisack zu gelangen, seitlich weit in das Pflerschtal
hineinwenden, da ihr die unmittelbare Überwindung einer Neigung von
1 : 6 versagt ist. Sieben Kilometer werden hier — vom reinen
Verkehrsstandpunkt betrachtet — unnötig durchfahren, aber nun
beträgt die größte Neigung auf der ganzen Strecke nur 1 : 45.
Seitentäler sind jedoch nicht immer zur Verfügung. Alsdann muß
die künstliche Längenentwicklung in dem von der Bahn benutzten
Haupttal selbst stattfinden. Dies gibt Anlaß zu den großartigsten und
überraschendsten Bauten, insbesondere dann, wenn doch eine
Seitenentwicklung durch die höchst merkwürdige Anlage von
Kehrtunneln gewaltsam ermöglicht wird.
In diesen Bauarten hat die Bahn über den St. Gotthard zum
erstenmal besonders Hervorragendes geleistet.
In der Nähe des Pfaffensprungs steigt das hier sehr schmale,
beiderseits von ragenden Felsen eingeschlossene Tal der Reuß weit
rascher auf, als daß die Bahn der Talhebung ohne weiteres zu folgen
vermöchte. Es ist hier auch keine Gelegenheit, irgendwohin ohne
weiteres auszubiegen, und so mußte eine Seitenausladung dadurch
erzwungen werden, daß man in den Berg selbst einen eigenartig
geformten Tunnel hineintrieb, der nun also die ansteigende
Seitentalschleife zu ersetzen hat. In dem rückkehrenden Tunnel muß
daher eine allmähliche Hebung der Bahn stattfinden, so daß dieser die
Form einer Schraubenlinie mit Einer Windung erhält. Bei der Einfahrt in
den Pfaffensprung-Berg liegt die Bahn 774 Meter hoch, bei der Ausfahrt
hat sie 809 Meter erreicht, so daß sie im Berg um 35 Meter gestiegen
ist.
Solcher großen Kehrtunnel, in denen die Bahn steigend ihre
Fahrtrichtung einmal umkehrt, besitzt die Gotthardbahn jenseits des
großen Scheiteltunnels noch vier, von denen die zwei in der Biaschina-
Schlucht liegenden einander fast berühren. Dies schon ist ein besonders
deutliches Zeichen dafür, welche außerordentlichen Umwege einer
Gebirgsbahn mit gewöhnlichem Anhaftungsgleis zugemutet werden
dürfen, ohne daß dessen Vorteile gegenüber dem Zahngleis verloren
gehen.
Der größte Umweg, den die Gotthardstrecke macht, befindet sich
jedoch bei dem Ort Wasen, bald hinter dem Pfaffensprung. Hier sind die
nicht ganz geschlossenen Kehrtunnelschlingen als Enden zweier langer
Schleifen in dem breiten Haupttal ausgebildet. In drei Stockwerken
liegen die Bahnabschnitte in kühnstem Bau übereinander. Da die
Umkehr der Fahrtrichtung an den Enden der beiden Schleifen in
verdeckten Kehren, nämlich im Wattinger und Leggistein-Tunnel
stattfindet, so daß sie mit dem Auge nicht verfolgt werden kann,
vermag der Reisende, der keine Karte zur Hand hat, sich keine
Vorstellung von dem Weg der Bahn zu machen. Welche Verwirrung die
dreimalige Rückkehr zu dem gleichen Punkt in manchem Kopf
anzustiften vermag, zeigt eine bekannte Anekdote, deren Schauplatz die
Wasener Schleifenstrecke ist.
106. K e h r t u n n e l
Bahnsteigung in einem Berg
107a. K e h r e n d e r G o t t h a r d b a h n b e i F a i d o u n d D a z i o
Grande
107b. D o p p e l k e h r e d e r G o t t h a r d b a h n i n d e r
Biaschina-Schlucht
Ein Reisender, der des Landes unkundig ist, fährt zusammen mit
einem Schweizer in einem Abteil des Gotthardzugs. Nachdem der
Pfaffensprung-Kehrtunnel verlassen ist, fragt der Reisende den
Schweizer, indem er zum rechtsliegenden Fenster hinausdeutet. „Was ist
das für ein Bauwerk da oben?“ — „Das ist die Kirche von Wasen,“ lautet
die Antwort. Es vergeht etwa eine Viertelstunde, und der Fremde sieht
ein Gebäude dicht neben sich. „Und was ist dies?“ fragt er wieder. „Das
ist die Kirche von Wasen,“ sagt der Schweizer. Der Fremde glaubt nicht
recht gehört zu haben, denn dieselbe Antwort hatte er ja schon vor
einer Viertelstunde erhalten, und damals lag die Kirche hoch über der
Bahn. Stumm blickt er weiter hinaus, bis er plötzlich wiederum einen
Turm weit unter sich, und zwar auf der linken Seite, erblickt. „Und diese
Kirche dort, wie heißt sie?“ spricht er den Mitreisenden von neuem an.
„Das ist die Kirche von Wasen,“ lautet die Antwort. Nun aber wird der
Reisende wütend, er blickt den Schweizer zornig an, weil er glaubt, daß
dieser ihn zum Narren halten wolle, und richtet während der ganzen
Zeit, in der sie noch zusammen im Abteil sitzen, kein Wort mehr an ihn.
108a) D o p p e l s c h l e i f e d e r G o t t h a r d b a h n b e i W a s e n
108b) B l i c k a u f W a s e n m i t d e n d r e i
übereinanderliegenden
E i s e n b a h n l i n i e n (×)
Hauenstein-Tunnel
erbaut von 1853 bis 1857
für die Eisenbahn Basel-Olten
Semmering-Tunnel
erbaut von 1849 bis 1852
für die Eisenbahn Wien-Triest
Nach einer Tafel im Deutschen Museum zu München
109. V e r g l e i c h e n d e A n g a b e n ü b e r d i e w i c h t i g s t e n
Tu n n e l b a u t e n
110. M e s s u n g e n v o r B e g i n n e i n e s g r o ß e n
Tu n n e l b a u s v o n b e i d e n S e i t e n
Festlegung der Tunnelrichtung durch trigonometrische Aufnahme im Gelände
Wir wollen, um ein Beispiel zu geben, annehmen, daß aus der
nächsten Umgebung des Punkts, an dem das eine Tunneltor errichtet
werden soll, eine Landstraße mit vielen Windungen in die Nähe des
andren Tors hinüberführt, wie das auf Bild 110 der Fall ist. Man kann
alsdann diese Landstraße genau abmessen, die Länge jeder gradlinigen
Erstreckung festlegen und mit Hilfe der trigonometrischen Hilfsmittel
auch ganz genau den Winkel bestimmen, den jede geänderte Richtung
zu der vorhergehenden bildet. Nach Beendigung dieser Arbeit ist man
imstande, die Landstraße mit vollkommener Genauigkeit in eine Karte
einzuzeichnen. Verbindet man nun die beiden Anfangspunkte des
Tunnels durch eine gerade Linie und verlängert diese so weit nach
beiden Seiten, bis sie die eingezeichnete Landstraße schneidet, so kann
man auf der Karte den Winkel abmessen, den die Tunnelachse zu den
geschnittenen Landstraßenstücken diesseits und jenseits bilden muß.
Damit liegt die Richtung genau fest, und es kommt jetzt nur darauf an,
sie auch im Gelände abzustecken und beim Bau aufs genaueste
innezuhalten.
Zu diesem Zweck wird zunächst auf jeder Seite der von der Karte
entnommene Winkel zwischen dem letzten Straßenstück und der
Tunnelachse abgemessen, und es werden zwei starke Pfosten in der
genauen Tunnelrichtung in die Erde gesetzt. Auf ihnen werden die
Richtungs-Festpunkte angebracht. Alsdann wird hinter dem ersten
Pfosten ein Fernrohr aufgestellt, in dem ein senkrechter und ein
wagerechter Faden, das Fadenkreuz, so angebracht sind, daß sie
einander genau in der Mittelachse des Fernrohrs kreuzen. Man richtet
das Fernrohr so, daß seine Mittelachse genau in der Richtung der
Verbindungslinie liegt, die von dem Festpunkt des ersten Pfostens zum
zweiten führt.
Wenn man nun an der Bergwand eine kleine Lampe derartig
aufhängt, daß sie beim Schauen durch das so eingestellte Fernrohr
gerade im Kreuzungspunkt der beiden Fäden erscheint, dann ist damit
der Anfang der Tunnelachse bestimmt. Sobald der Richtstollen ein
kleines Stückchen vorgetrieben ist, läßt man von der Decke wiederum
ein Lämpchen hinunterhängen und verschiebt es so lange, bis der durch
das Fernrohr Blickende es in gerader Linie hinter den beiden
Pfostenmarken und der ersten Lampe liegen sieht. So wird allmählich
Lampe hinter Lampe gehängt, neue mit vollkommenster Genauigkeit
festgelegte Pfostenmarken werden auch im Tunnel in gewissen
Abständen immer wieder geschaffen, und auf diese Weise ist man
imstande, von beiden Seiten aus die Achsrichtung innezuhalten.
Die Genauigkeit der Richtungshaltung hängt natürlich von der
Vollkommenheit der verwendeten Winkelmessungswerkzeuge ab. Bei
dem vor kurzem von der deutschen Firma Julius Berger in der Schweiz
gebauten neuen Hauenstein-Tunnel, der 8200 Meter lang ist, betrug
beim Durchschlag die Achsabweichung der beiden Bauseiten nicht mehr
als zwei Zentimeter; selbst bei dem 20 Kilometer langen Simplontunnel
waren es nur 20 Zentimeter. Der Meßtechnik kann kein glänzenderes
Zeugnis ausgestellt werden als durch diese eindrucksvollen Tatsachen.
Der Tunnel muß so gebaut werden, daß seine Sohle von beiden
Seiten her gegen die Mitte etwas ansteigt, damit das Wasser, sowohl
zugeführtes wie auch angeschlagenes Gebirgswasser, abfließen kann.
Für die Heranschaffung von Frischluft zur Lüftung und Kühlung muß
während der ganzen Bauzeit in lebhaftester Weise Sorge getragen
werden. Sobald der Durchschlag erfolgt ist, pflegen sich die Tunnel,
insbesondere durch die Mithilfe der fahrenden Züge, selbst zu lüften, da
zwischen den beiden Toren gewöhnlich ein starker Unterschied des
Luftdrucks besteht. Wenn die Selbstlüftung nicht ausreicht, müssen, wie
beim Kochemer Tunnel und auch auf dem Gotthard, künstliche
Luftzuführungs-Einrichtungen geschaffen werden.
Die Tunnelbaukunst ist in den letzten Jahrzehnten lebhaft
vervollkommnet worden. Früher mußte man die zur Aufnahme des
Sprengstoffs dienenden Bohrlöcher mit der Hand herstellen. Ein Arbeiter
drehte den Bohrer, eine mit stählerner Spitze versehene Eisenstange,
während ein anderer daraufschlug. Sehr viel geschwinder arbeiten
natürlich Bohrmaschinen, von denen die ersten beim Mont Cenis-Tunnel
verwendet wurden. Heute besitzt man vorzügliche Einrichtungen dieser
Art, die durch Preßwasser, Druckluft oder Elektrizität betrieben werden
können. Auch die Maschinenbohrer arbeiten sämtlich so, daß die
Bohrstange zugleich gestoßen und gedreht wird. Man vermag heute
mehrere Löcher zu gleicher Zeit herzustellen, und da auch die Wirkung
der Sprengstoffs bedeutend vervollkommnet ist, wodurch man mit einer
immer geringeren Zahl von Löchern auskommen kann, so vollziehen
sich die Tunnelbauten immer rascher. Beim Gotthard-Tunnel vermochte
man in den günstigsten Monaten nur um je 111 Meter vorwärts zu
kommen, beim Arlberg-Tunnel brachte man es schon auf 166 Meter im
Monat, und der Simplon-Tunnel wurde in der gleichen Zeit um je 270
Meter vorgetrieben.
Tack! Tack! Tack! machen die Räder unseres nach Halle fahrenden
Schnellzugs.
Es ist ein eintöniges, in gleichen Abständen immer wiederkehrendes
Geräusch, das seltsam einschläfernd auf die Nerven wirkt. Die
Gleichmäßigkeit dieses ewig klingenden Tons weckt die Erinnerung an
manche gern gehörte Weise; während der auf seinen Federn sich
schaukelnde Wagen uns langsam einwiegt, scheint es einem jeden, als
sängen die Räder sein Lieblingslied.
Der Zug fliegt über den blanken, stählernen Pfad, über die
Schienen, wie man einfach sagt. Nichts scheint leichter als die
Ausstreckung der vier silberigen Stränge vor der Maschine. Und doch ist
die Arbeit von vielen Geschlechtern, die angestrengte Tätigkeit
unzähliger Geister notwendig gewesen, um nur den heutigen Zustand
zu erreichen, der von Vollkommenheit noch weit entfernt ist.
Die Unterlage für die Fahrbahn haben wir bereits besprochen. Es
bleibt uns übrig, Bettung, Schwellen, Schienen und das zugehörige
Kleineisenzeug in den Arten und Formen, wie sie heutzutage
angewendet werden, erst im einzelnen, dann in ihrem Zusammenhang,
also den O b e r b a u zu betrachten. Es ist ein weites Feld, wie Effi
Briests Vater in Fontanes Roman zu sagen pflegt.
Wir wissen aus Abschnitt 5, daß es die Aufgabe der Bettung ist, für
die Schwellen einen Lagerbezirk zu schaffen, in dem diese fest und
möglichst trocken liegen. Der Bettungsstoff muß daher Wasser sehr
leicht durchlassen und doch fest genug sein, um die sehr großen Kräfte,
die von oben und von den Seiten her gegen die Schienen und Schwellen
wirken, aufnehmen und über eine weite Fläche verteilen zu können.
Außerdem muß die Form der einzelnen Bettungsstücke so beschaffen
sein, daß man sie leicht unter die Schwellen schlagen kann, um deren
durch den Betrieb immer wieder bewirkte Senkung auszugleichen.
Die deutschen Bahnen sind entweder in Kies oder in Steinschlag
verlegt. Die tiefste Lage der Bettung auf dem Unterbau, die nur zu
tragen, aber keine seitlichen Kräfte aufzunehmen hat, wird auch öfter
aus gut zusammengesetzten, größeren Steinen, der sogenannten
Packlage, gebildet. Der Steinschlag besteht bei uns zumeist aus Basalt,
Porphyr, Quarzit oder Grauwacke und zwar in Form von scharfkantigen
kleinen Stücken mit einer Seitenlänge von drei bis vier Zentimetern.
Die Längsschwellen, mit denen der Eisenbahnoberbau einst
begann, sind heute als überlebt zu betrachten. Der Querschwellenbau
herrscht vor. Er wird aus hölzernen oder eisernen Stücken
zusammengesetzt, neuerdings hat man auch Versuche mit Schwellen
aus Beton mit Eiseneinlage gemacht. Auch die Schwellenschiene, das
heißt eine Schiene mit sehr breit ausladendem Fuß, der die Schwelle
ersetzt, kommt vor, jedoch nur selten und meist in Nebengeleisen.
Die Bevorzugung des Querschwellengleises ist leicht begreiflich
durch die großen Vorteile, die es bietet: die sichere Festhaltung der
Spur ohne besondere Vorkehrungen und die leichte Möglichkeit des
Erneuerns einzelner Stücke. Bei dieser Bauart kann man auch in
einfacher Weise eine Verstärkung der Tragfähigkeit des Gleises
bewirken, da man in solchem Fall nur nötig hat, die Zahl der Schwellen
für die Längeneinheit zu erhöhen.
Auf den preußischen Bahnen, deren Verhältnisse auch hier wieder
als Beispiel herangezogen werden sollen, ist der Querschnitt der
Schwellen stets ein Rechteck, meist mit abgeschrägten Kanten an der
oberen Fläche. Bei den Holzschwellen, die wir nun zunächst betrachten,
entstehen diese sogenannten Waldkanten, die man aus Gründen der
Holzersparung zuläßt,
meist von selbst; sie
ergeben sich für viele
Schwellen durch die Art,
wie diese aus dem vollen
Baumstamm
herausgeschnitten
werden. Die beiden
Schwellen oben und
unten auf Bild 112
können keinen voll
rechteckigen Querschnitt
mehr erhalten.
Die üblichen
Abmessungen für die
Schwellen sind: Breite 26
Zentimeter, Höhe 16
Zentimeter, Länge 2,70 Nach Haarmann: „Das Eisenbahngeleise“
Meter. Eine Bearbeitung 112. W i e H o l z s c h w e l l e n a u s e i n e m
der Oberfläche findet Stamm geschnitten werden
heute für gewöhnlich
nicht mehr statt, da die seitliche Neigung der Schienen durch
Zwischenlegen von Unterlagsplatten hergestellt wird. Die Löcher, welche
später die Befestigungsmittel für die Schienen, Nägel oder Schrauben,
aufzunehmen haben, werden vor dem Verlegen auf einer Seite
vorgebohrt, auf der anderen Seite geschieht das Bohren erst während
des Auslegens, damit man imstande ist, die häufig vorkommenden,
kleinen Abweichungen von der Regelspur auszuführen.
Bei uns werden in der Hauptsache Eiche, Buche, Fichte, Tanne und
Kiefer, diese letzte in größter Zahl, zu Schwellen verarbeitet. Unter ihnen
ist seltsamerweise das Buchenholz, obgleich es zu den sonst besonders
widerstandsfähigen Harthölzern gehört, am leichtesten vergänglich. Die
Buchenschwellen faulen so rasch, daß sie ohne die Anwendung
besonderer Erhaltungsverfahren gar nicht verwendet werden können.
Da es durch dieses Verfahren gelungen ist, auch die Weichhölzer sehr
haltbar zu machen, so geht der Verbrauch der teuren Eiche allmählich
immer weiter zurück. In neuerer Zeit wird die Brauchbarkeit der
Weichholzschwellen auch dadurch erhöht, daß man die Nägel und
Schrauben nicht mehr unmittelbar in ihren Körper einsetzt, sondern an
den in Betracht kommenden Stellen zunächst sehr starke, in der Mitte
durchbohrte Bolzen aus Hartholz einschraubt. Diese Dübel erst nehmen
die eisernen Befestigungsmittel auf.
113. H a r t h o l z v e r d ü b e l u n g
Verstärkung von Weichholzschwellen durch Einschrauben von
Hartholzdübeln zur Aufnahme der Schraubenlöcher
114. L a g e d e r E i s e n s c h w e l l e i n d e r B e t t u n g
116. E i s e r n e D o p p e l s c h w e l l e f ü r
Stoßunterstützung
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.
ebookultra.com