Instant Access To Introduction To Scientific Computing and Data Analysis 2nd Edition Mark H. Holmes Ebook Full Chapters
Instant Access To Introduction To Scientific Computing and Data Analysis 2nd Edition Mark H. Holmes Ebook Full Chapters
com
https://ebookmeta.com/product/introduction-to-scientific-
computing-and-data-analysis-2nd-edition-mark-h-holmes/
OR CLICK BUTTON
DOWLOAD NOW
https://ebookmeta.com/product/introduction-to-differential-
equations-2e-2nd-edition-mark-h-holmes/
https://ebookmeta.com/product/a-gentle-introduction-to-
scientific-computing-chapman-hall-crc-numerical-analysis-and-
scientific-computing-series-1st-edition-dan-stanescu/
https://ebookmeta.com/product/introduction-to-the-tools-of-
scientific-computing-2nd-edition-einar-smith/
https://ebookmeta.com/product/introduction-to-computational-
engineering-with-matlab-chapman-hall-crc-numerical-analysis-and-
scientific-computing-series-1st-edition-timothy-bower/
Introduction to Engineering and Scientific Computing
with Python 1st Edition David E. Clough
https://ebookmeta.com/product/introduction-to-engineering-and-
scientific-computing-with-python-1st-edition-david-e-clough/
https://ebookmeta.com/product/python-for-astronomers-an-
introduction-to-scientific-computing-3rd-edition-imad-pasha/
https://ebookmeta.com/product/an-introduction-to-scientific-
computing-with-matlab-and-python-tutorials-1st-edition-sheng-xu/
https://ebookmeta.com/product/introduction-to-statistics-and-
data-analysis-6th-edition-peck/
https://ebookmeta.com/product/pandas-cookbook-recipes-for-
scientific-computing-time-series-analysis-and-data-visualization-
using-python-1st-edition-theodore-petrou/
13
Mark H. Holmes
Introduction
to Scientific
Computing and
Data Analysis
Editorial Board
Second Edition T. J.Barth
M.Griebel
D.E.Keyes
R.M.Nieminen
D.Roose
T.Schlick
Texts in Computational Science and Engineering
Volume 13
Series Editors
Timothy J. Barth, NASA Ames Research Center, National Aeronautics Space
Division, Moffett Field, CA, USA
Michael Griebel, Institut für Numerische Simulation, Universität Bonn, Bonn,
Germany
David E. Keyes, New York, NY, USA
Risto M. Nieminen, School of Science & Technology, Aalto University, Aalto,
Finland
Dirk Roose, Department of Computer Science, Katholieke Universiteit Leuven,
Leuven, Belgium
Tamar Schlick, Department of Chemistry, Courant Institute of Mathematical
Sciences, New York University, New York, NY, USA
This series contains graduate and undergraduate textbooks on topics described by
the term “computational science and engineering”. This includes theoretical aspects
of scientific computing such as mathematical modeling, optimization methods,
discretization techniques, multiscale approaches, fast solution algorithms, paral-
lelization, and visualization methods as well as the application of these approaches
throughout the disciplines of biology, chemistry, physics, engineering, earth sciences,
and economics.
Mark H. Holmes
Introduction to Scientific
Computing and Data
Analysis
Second Edition
Mark H. Holmes
Department of Mathematical Sciences
Rensselaer Polytechnic Institute
Troy, NY, USA
This Springer imprint is published by the registered company Springer Nature Switzerland AG
The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland
Preface
The objective of this text is easy to state, and it is to investigate ways to use a
computer to solve various mathematical problems. One of the challenges for those
learning this material is that it involves a nonlinear combination of mathematical
analysis and nitty-gritty computer programming. Texts vary considerably in how
they balance these two aspects of the subject. You can see this in the brief history
of the subject given in Figure 1 (which is an example of what is called an ngram
plot). According to this plot, the earlier books concentrated more on the analysis
(theory). In the early 1970s this changed and there was more of an emphasis on
methods (which generally means much less theory), and these continue to dominant
the area today. However, the 1980s saw the advent of scientific computing books,
which combine theory and programming, and you can see a subsequent decline in
the other two types of books when this occurred. This text falls within this latter
group.
There are two important threads running through the text. One concerns under-
standing the mathematical problem that is being solved. As an example, when using
Newton’s method to solve f (x) = 0, the usual statement is that it will work if
Numerical Methods
Percentage
Scientific Computing
2
Numerical Analysis
0
1950 1960 1970 1980 1990 2000 2010
Year
Figure 1 Historical record according to Google. The values are the number of instances that the
expression appeared in a published book in the respective year, expressed as a percentage for that
year, times 105 [Michel et al., 2011].
v
vi Preface
you guess a starting value close to the solution. It is important to know how to deter-
mine good starting points, and, perhaps even more importantly, knowing whether the
problem being solved even has a solution. Consequently, when deriving Newton’s
method, and others like it, an effort is made to explain how to fairly easily answer
these questions.
The second theme is the importance in scientific computing of having a solid grasp
of the theory underlying the methods being used. A computer has the unfortunate
ability to produce answers even if the methods used to find the solution are completely
wrong. Consequently, it is essential to have an understanding of how the method
works, and how the error in the computation depends on the method being used.
Needless to say, is also important to be able to code these methods, and in the
process be able to adapt them to the particular problem being solved. There is consid-
erable room for interpretation on what this means. To explain, in terms of computing
languages, the current favorites are MATLAB and Python. Using the commands they
provide, a text such as this one becomes more of a user’s manual, reducing the entire
book down to a few commands. For example, with MATLAB, this book (as well as
most others in this area) can be replaced with the following commands:
Chapter 1: eps
Chapter 2: fzero(@f,x0)
Chapter 3: A\b
Chapter 4: eig(A)
Chapter 5: polyfit(x,y,n)
Chapter 6: integral(@f,a,b)
Chapter 7: ode45 (@f,tspan,y0)
Chapter 8: fminsearch(@fun,x0)
Chapter 9: svd(A)
Certainly this statement qualifies as hyperbole, and as an example, Chapters 4 and 5
should probably have two commands listed. The other extreme is to write all of the
methods from scratch, something that was expected of students in the early days of
computing. In the end, the level of coding depends on what the learning outcomes
are for the course, and the background and computing prerequisites required for the
course.
Many of the topics included are typical of what are found in an upper division
scientific computing course. There are also notable additions. This includes material
related to data analysis, as well as variational methods and derivative-free minimiza-
tion methods. Moreover, there are differences related to emphasis. An example here
concerns the preeminent role matrix factorizations play in numerical linear algebra,
and this is made evident in the development of the material.
The coverage of any particular topic is not exhaustive, but intended to introduce
the basic ideas. For this reason, numerous references are provided for those who
might be interested in further study, and many of these are from the current research
literature. To quantify this statement, a code was written that reads the tex.bbl file
containing the references for this text, and then uses MATLAB to plot the number as a
function of the year published. The result is Figure 2, and it shows that approximately
Preface vii
15
10
Number
Median = 2006
Mean = 2002
5
0
1950 1960 1970 1980 1990 2000 2010 2020
Year
Figure 2 Number of references in this book, after 1950, as a function of the year they were
published.
half of the references were published in the last ten years. By the way, in terms of
data generation and plotting, Figure 1 was produced by writing a code which reads
the html source code for the ngram webpage and then uses MATLAB to produce the
plot.
The MATLAB codes used to produce almost every figure, and table with numerical
output, in this text are available from the author’s website as well as from Springer-
Link. In other words, the MATLAB codes for all of the methods considered, and the
examples used, are available. These can be used as a learning tool. This also goes to
the importance in computational-based research, and education, of providing open
source to guarantee the correctness and reproducibility of the work. Some interesting
comments on this can be found in Morin et al. [2012] and Peng [2011].
The prerequisites depend on which chapters are covered, but the typical two-year
lower division mathematics program (consisting of calculus, matrix algebra, and
differential equations) should be sufficient for the entire text. However, one topic
plays an oversized role in this subject, and this is Taylor’s theorem. This also tends
to be the topic that students had the most trouble within calculus. For this reason,
an appendix is included that reviews some of the more pertinent aspects of Taylor’s
theorem. It should also be pointed out that there are numerous theorems in the text,
as well as an outline of the proof for many of them. These should be read with care
because they contain information that is useful when testing the code that implements
the respective method (i.e., they provide one of the essential ways we will have to
make sure the computed results are actually correct).
I would like to thank the reviewers of an early draft of the book, who made
several very constructive suggestions to improve the text. Also, as usual, I would like
to thank those who developed and have maintained TeXShop, a free and very good
TeX previewer.
One of the principal reasons for this edition is to include material necessary for an
upper division course in computational linear algebra. So, least squares is covered
more extensively, along with new material covering Householder QR, sparse matrix
methods, preconditioning, and Markov chains. The computational implications of the
Gershgorin, Perron-Frobenius, and Eckart-Young theorems have also been expanded.
It is assumed in the development that a previous course in linear algebra has been
taken, but as a refresher some of the more pertinent facts from such a course are
given in an appendix.
Other significant changes include a reorganization and expansion of the exer-
cises. Also, the material on cubic splines, particularly related to data analysis, has
been expanded (e.g., Section 6.4), and the presentation of Gaussian quadrature has
been modified. There is also a new section providing an introduction to data-based
modeling and dynamic modes.
As with the first edition, the material is developed and presented, independent
of the language used for computing. So, there are no computer codes in the text.
Rather, the procedures are written in a generic format, such as Newton’s method on
page 41. There are, however, a few exercises where example MATLAB commands
are given indicating how the problem can be done (e.g., the commands on page 198
for inputting, and displaying, a grayscale image). All of the codes used in the compu-
tational examples in the text are available from the author’s GitHub repository
(https://github.com/HolmesRPI/IntroSciComp2nd). Other files for the book, such
as an errata page and the answers for selected exercises, are also there.
ix
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
Preface to Second Edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
1 Introduction to Scientific Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Unexpected Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Floating-Point Number System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.1 Normal Floats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.2 Rounding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2.3 Non-Normal Floats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2.4 Significance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.2.5 Flops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.2.6 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.3 Arbitrary-Precision Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.4 Explaining, and Possibly Fixing, the Unexpected Results . . . . . . . 12
1.5 Error and Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.5.1 Over-computing? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.6 Multicore Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2 Solving A Nonlinear Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.1 The Problem to Solve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.2 Bisection Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.2.1 Convergence Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.3 Newton’s Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.3.1 Picking x0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.3.2 Order of Convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
2.3.3 Failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2.3.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.3.5 Convergence Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.4 Secant Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.4.1 Convergence Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
xi
xii Contents
What follows are examples where the computed results are not what is
expected. The reason for the problem is the same for each example. Namely,
the finite precision arithmetic used by the computer generates errors that are
significant enough that they affect the final result. The calculations to follow
use double-precision arithmetic, and this is explained in Section 1.2.
© The Author(s), under exclusive license to Springer Nature Switzerland AG 2023 1
M. H. Holmes, Introduction to Scientific Computing and Data Analysis,
Texts in Computational Science and Engineering 13,
https://doi.org/10.1007/978-3-031-22430-0 1
2 1 Introduction to Scientific Computing
Example 1.1
Example 1.2
The expressions in (1.4) and (1.3) are equal and, given a value of x, either
should be able to be used to evaluate the function. However, when evaluating
them with a computer they do not necessarily produce the same values and
this is shown in Figure 1.1. In the upper graph, where 0.9 ≤ x ≤ 1.1, they
do appear to agree. However, looking at the plots over the somewhat smaller
n S(n) − s(n)
10 0
100 −8.88e−16
1,000 2.66e−15
10,000 −3.73e−14
100,000 −7.28e−14
1,000,000 −7.83e−13
Table 1.1 Difference in partial sums for the harmonic series considered in Example 1.1.
Note that 8.9e−16 = 8.9 × 10−16 .
1.1 Unexpected Results 3
-9
10
10
Using (1.3)
Using (1.4)
y-axis
0
0.9 0.95 1 1.05 1.1
10-14
4
2
y-axis
-2
0.98 0.99 1 1.01 1.02
x-axis
Figure 1.1 Plots of (1.4) and (1.3). Upper graph: the interval is 0.9 ≤ x ≤ 1.1, and the
two functions are so close that the curves are indistinguishable. Lower graph: The interval
is 0.98 ≤ x ≤ 1.02, and now they are not so close.
interval 0.98 ≤ x ≤ 1.02, which is given in the lower graph, the two expres-
sions definitely do not agree. The situation is even worse than the fact that
the graphs differ. First, according to (1.3), y is never negative but according
to the computer (1.4) violates this condition. Second, according to (1.3), y is
symmetric about x = 1 but the computer claims (1.4) is not.
Example 1.3
3/16
1/8
y-axis
1/16
k-axis
√
f (x) = 16 + x. Finally, it needs to be mentioned that the curve shown in
the figure contains a plotting error, and this is corrected in Figure 1.8.
Example 1.4
0
10
Relative Error
-4
10
-8
10
-12
10
10-16
0 5 10 15
10 10 10 10
n-axis
Figure 1.3 The relative error (1.6) when computing y = sin( π4 + 2πn).
1.2 Floating-Point Number System 5
The problems illustrated in the above examples are minor compared to the
difficulties that arose in the early days of computing. It was not unusual to
get irreproducible results, in the sense that two different computers would
calculate different answers to the same formula. To help prevent this, a set
of standards was established that computer manufactures were expected to
comply with. The one of interest here concerns the floating-point system, and
it is based on the IEEE-754 standard set in 1985. It consists of normal floats
(described below), along with zero, ± Inf, and NaN.
Normal (or normalized) floating-point numbers are real numbers that the
computer has the exact value for. The form they are written in is determined
by the binary nature of computer systems. Specifically, they have the form
xf = (±) m × 2E , (1.7)
where
b1 b2 bN −1
m=1+ + 2 + · · · + N −1 . (1.8)
2 2 2
In this representation m, E, and the bi ’s have the following properties:
• m: This is the mantissa. The bi ’s are either zero or one, and for this reason
1 ≤ m < 2. In fact, the largest value of the mantissa is m = 2 − ε, where
ε = 1/2N −1 (see Exercise 1.32). The number ε is known as machine epsilon
and it plays a critical role in determining the spacing of floating-point
numbers.
• E: This is the exponent and it is an integer that satisfies Em ≤ E ≤ EM .
For double precision, −1022 ≤ E ≤ 1023. In general, according to the IEEE
requirements, Em = −EM + 1 and EM = 2M −1 − 1, where M is a positive
integer.
As defined, a floating-point system requires specification of the two integers
N and M , and some of the standard choices are listed in Table 1.2. The one of
particular importance for scientific computing is double precision, for which
N = 53 and M = 11.
Other formats are used, and they are usually connected to specific appli-
cations. An example is bfloat16, which was developed by the Google Brain
project for their machine learning algorithms. These numbers have the
same storage requirements as half-precision floating-point numbers but have
N = M = 8. This means the exponents for bfloat16 cover the same range as
single-precision floating-point numbers but with fewer mantissa values.
6 1 Introduction to Scientific Computing
Preci- N M Em EM xm xM ε Decimal
sion Digits
Table 1.2 Values for various binary normalized floating-point systems specified by IEEE-
754 and its extensions. The values for the smallest positive xm , largest positive xM , and
machine epsilon ε are given to one significant digit. Similarly, the number of decimal digits
is approximate and is determined from the expression N log10 2.
Example 1.5
1. Is x = 3 a floating-point number?
Answer: Yes, because 3 = 2 + 1 = (1 + 12 )× 2. So, E = 1, b1 = 1, and the
other bi ’s are zero.
1
√
3. Examples of numbers that are not floating-point numbers are 10 , 2, and
π.
So, looking at (1.9) one concludes that the floats in this interval are those
in 1 ≤ x < 2, but just multiplied by 2n . This means the floats in the closed
interval 2n ≤ x ≤ 2n+1 are evenly spaced but now the spacing is 2n ε, as
illustrated in Figure 1.4.
A conclusion coming from Figure 1.4 is that for large values of n the dis-
tance between the floats can be huge. For example, take n = 100. For double
precision, between 2100 ≈ 1030 and 2101 ≈ 2 × 1030 they are a distance of
ε × 2100 ≈ 2.8 × 1014 apart. The fact that they are so far apart can cause
problems, and a particular example of this is considered in Section 1.2.6.
Integers
The smallest positive integer that is not included in the floating-point system
is 2N + 1. In other words, all nonzero integers satisfying |x| ≤ 2N are normal-
ized floating-point numbers. An important question is whether the computer
recognizes them as integers. This is needed in programming because integers
are used as counters in a for loop as well as the indices of a vector or matrix.
Figure 1.4 The floating-point numbers in the interval 2n ≤ x ≤ 2n+1 are equally spaced,
being a distance 2n ε apart. So, they are a distance ε/2 apart for 2−1 ≤ x ≤ 1, ε apart for
1 ≤ x ≤ 2, and 2ε apart for 2 ≤ x ≤ 22 .
8 1 Introduction to Scientific Computing
Figure 1.5 The floating-point numbers just to the left and right of x = 1. The red dashed
lines are located halfway between the floats, and any real number between them is rounded
to the floating-point number in that subinterval.
Most computer systems have a way to treat integers as integers, where addi-
tion and subtraction are done exactly as long as the integers are not too big.
For example, for languages such as C and FORTRAN you use a type decla-
ration at the beginning of the program to identify a variable as an integer.
Languages such as MATLAB, Python, and Julia use dynamic typing, which
means they determine the variable type on the fly. This is more convenient,
but it does add to the computing time.
One last comment concerns the biggest and smallest positive normal floats.
In particular, for double precision, xM = (2 − ε) × 21023 ≈ 2 × 10308 is the
largest positive normal float, and xm = 2−1022 ≈ 2 × 10−308 is the smallest
positive normal float.
1.2.2 Rounding
|x − xf | ε
≤ .
|x| 2
To do this it uses a “round-to-nearest” rule, which means xf is the closest float
to x. To illustrate, the floats just to the left of x = 1 are a distance 12 ε apart,
and those just to the right are a distance ε apart. This is shown in Figure 1.5.
So, any number in Region II, which corresponds to 1 − 14 ε < x < 1 + 12 ε, is
rounded to xf = 1. Similarly, any number in Region III, which corresponds to
1 + 12 ε < x < 1 + 32 ε, is rounded to xf = 1 + ε. In the case of a tie, a “round-
to-even” rule is used, where the nearest float with an even least significant
digit is used.
Example 1.6
Evaluate 1 + 14 ε − 1 using floating-point arithmetic.
Answer: Since 1 < 1 + 14 ε < 1 + 12 ε, then 1 + 14 ε is rounded to 1 (see Figure
1.5). So, the answer is zero.
1.2 Floating-Point Number System 9
Zero
Subnormals
1.2.4 Significance
Working with numbers that have a fixed number of digits has the poten-
tial to cause complications that you should be aware of. For example, even
though floating-point addition and multiplication are commutative, they are
not necessarily associative or distributive. Example 1.1 is an illustration of
the non-associativity of addition.
Another complication involves significance. To perform addition, a com-
puter must adjust the exponents before adding. For example, suppose the
base is fixed to have 4 digits. So, letting → denote the exponent adjusting
step,
1.234 × 104 + 1.234 × 102 → 1.234 × 104 + 0.012 × 104 = 1.246 × 104 .
1.234 × 104 + 1.234 × 10−6 → 1.234 × 104 + 0.000 × 104 = 1.234 × 104 .
In this example, 1.234 × 10−6 is insignificant relative to 1.234 × 104 and con-
tributes nothing to the sum. This is why, using double precision, a computer
will claim that (1020 + 1) − 1020 = 0.
For subtraction the potential complication is the loss of significance, which
can arise when the two numbers are very close. For example, assuming that
the base is fixed to have 4 digits, then (1.2344 − 1.2342)/0.002 → (1.234 −
1.234)/0.002 = 0, whereas the exact value is 0.1.
Awareness of the complications mentioned above is important, but it is
outside the purview of this text to explore them in depth. For those inter-
ested in more detail related to floating-point arithmetic, they should consult
Goldberg [1991], Overton [2001], or Muller et al. [2010].
1.2.5 Flops
All numerical algorithms are judged by their accuracy and how long it takes
to compute the answer. As one estimate of the time, an old favorite is to
determine the flop count, where flop is an acronym for floating-point opera-
tion. To use this, it is necessary to have an appreciation of how long various
operations take. In principle these are easy to determine. As an example, to
determine the computing time for an addition one just writes a code where
this is done N times, where N is a large integer, and then divides the total
computing time by N . The outcomes of such tests are shown in Table 1.3,
where the times are scaled by how long it takes to do an addition. Note that
the actual times here are very short, with an addition taking approximately
2 nsec for MATLAB, FORTRAN, and C/C++, and 10 nsec using Python.
1.2 Floating-Point Number System 11
Table 1.3 Approximate relative computing times for various floating-point operations
in MATLAB (R2022a), Python (v3.11), FORTRAN (gfortran v12.2), and C/C++ (clang
v14.0). Note that each column is normalized by the time it takes that language to do an
addition.
Because of this, even though x = 3/2 might take twice as long to compute
than x = 0.5 ∗ 3, it’s really not necessary to worry about this (at least in the
problems considered in this text).
One of the principal reasons why Python and MATLAB differ in execution
times from FORTRAN, even though the same processor is used, involves
branching. They, like Julia and R, use dynamic typing. This means they
check on the type of numbers being used and then branch to the appropriate
algorithm. This way they are able to carry out integer arithmetic exactly. In
comparison, FORTRAN, like C and C++, is statically typed. This means
the typing is done at the start of the program, and so there is no slow down
when the commands are issued. This is one of the reasons most large-scale
scientific computing codes are written in a statically typed language.
1.2.6 Functions
Any computer system designed for scientific computing has routines to eval-
uate√well-known or often used functions. This includes elementary functions
like x; transcendental functions like sin(x), ex , and ln(x); and special func-
tions like erf(x) and Jν (x). To discuss how these fit into a floating-point sys-
tem, these will be written in the generic form of y = f (x). The ideal goal is
that, letting yf denote the computed value and assuming that xm ≤ |y| ≤ xM ,
|y − yf | ε
≤ .
|y| 2
Whether or not this happens depends on the function and the value of x.
12 1 Introduction to Scientific Computing
The problem identified in Example 1.4 was discussed in Section 1.2.6. What
follows is a discussion related to the other examples that were presented in
Section 1.1.
1.4 Explaining, and Possibly Fixing, the Unexpected Results 13
The differences in the two sums are not unexpected when using double-
precision arithmetic. Also, the order of the error is consistent with the accu-
racy obtained for double precision. The question was asked about which sum
might produce the more accurate result. One can argue that it is better to
add from small to big. The reason being that if one starts with the larger
terms, and the sum gets big enough, then the smaller terms are less able
to have an effect on the answer. To check on this, it is necessary to know
the exact value, or at least have an accurate approximate value. This can be
found using what is known as the Euler-Maclaurin formula, from which one
can show that for larger values of n,
n
1 1 1 1 1
= ln(n) + γ + − 2
+ 4
− + ··· ,
k 2n 12n 120n 252n6
k=1
10-11
S
10 -12 s
Error
10-13
10-14
-15
10
104 105 106 107 108
Number of Terms
Figure 1.6 The error in computing the partial sum of the harmonic series using (1.1)
and (1.2).
14 1 Introduction to Scientific Computing
The error in computing s(n) when using this procedure versus just adding
the terms recursively is given in Table 1.4. The improvement in the accuracy
is dramatic. Not only does it gives a more accurate value, but the error does
not increase with n unlike what happens when adding the terms recursively.
Compensated summation is based on estimating the error in a floating-
point addition, and then compensating for this in the calculation. The
sequence of steps involved illustrating how the method works is given in
Table 1.5. To explain, suppose that the mantissa used by the computer has
four digits and base 10 arithmetic is used. To add a = 0.1234 × 103 and
b = 0.1234 × 101 it is first necessary to express them using the same expo-
nent, and write b = 0.001234 × 103 (this is the alignment step in Table 1.5).
Given the four digit mantissa, b gets replaced with b = 0.0012 × 103 . Using
the notation in Table 1.5, the digits b2 = 34 are lost in this shuffle. With
this, sf = 0.1246 × 103 and sf − a = 0.12 × 101 . Accordingly, (sf − a) − b =
−0.0034 × 101 , which means we have recovered the piece missing from the
sum. In Table 1.5, err = b − (sf − a), and this is added back in during the
next iteration step. There are variations on this procedure, and also limita-
tions on its usefulness. Those interested in reading more about this should
consult Demmel and Hida [2004] or Blanchard et al. [2020].
104 0 4 × 10−15
105 0 2 × 10−14
109 0 2 × 10−12
Table 1.4 Comparison between compensated summation, as given in (1.11), and regular
summation. Note E(n) is the exact result, c(n) is the value using compensated summation,
and s(n) is given in (1.2).
1.4 Explaining, and Possibly Fixing, the Unexpected Results 15
Table 1.5 Steps explaining how the error in floating-point addition is estimated for
compensated summation. Adapted from [Higham, 2002].
The first thing to notice is that the values of the function in the lower plot
in Figure 1.2 are close to machine epsilon. The expanded version of the poly-
nomial is required to take values near x = 1 and combine them to produce a
value close to zero. The errors seen here are consistent with arithmetic using
double precision, and the fact that the values are sometimes negative also is
not surprising.
It is natural to ask, given the expanded version of the polynomial (1.4),
whether it is possible to find an algorithm for it that is not so sensitive to
round off error. There are procedures for the efficient evaluation of a polyno-
mial, and two examples are Horner’s method and Estrin’s method. To explain
how these work, Horner’s method is based on the following observations:
a2 x2 + a1 x + a0 = a0 + (a1 + a2 x)x,
a3 x3 + a2 x2 + a1 x + a0 = a0 + (a1 + (a2 + a3 x)x)x,
a4 x4 + a3 x3 + a2 x2 + a1 x + a0 = a0 + (a1 + (a2 + (a3 + a4 x)x)x)x.
Higher order polynomials can be factored in a similar manner, and the result-
ing algorithm for evaluating the nth degree polynomial p(x) = a0 + a1 x +
· · · + an xn is
let: p = an
loop: for i = 1, 2, 3, · · · , n
p = an−i + p ∗ x (1.12)
end
16 1 Introduction to Scientific Computing
10-14
4
Using Horner
Using (1.3)
2
y-axis
-2
0.98 0.99 1 1.01 1.02
x-axis
Figure 1.7 Plot of (1.4) when evaluated using Horner’s method, and using (1.3).
1.4 Explaining, and Possibly Fixing, the Unexpected Results 17
region III to region II, and jumps again when you move into region I. Normally
these jumps are imperceptible in a typical plot, but in the region near where
the drop to zero occurs they are being magnified to the extent that they are
clearly evident in the plot.
It is fairly easy to avoid the indeterminate form at k = 0 by rewriting the
function. For example, rationalizing the numerator you get that
√ √ √
16 + k − 4 16 + k − 4 16 + k + 4
= √
k k 16 + k + 4
1
=√ .
16 + k + 4
With this, letting k → 0 is no longer a problem.
A follow-up question is, how does the computer come up with the value
y√= 0? The short answer is that for k close to zero, the computer rounds
16 + k to 4 and this means that the numerator is rounded to zero. As seen
in Figure 1.8, the k values being considered here are far from the smallest
positive normalized float xm , so the denominator is not also rounded to zero.
Consequently, the computer ends up with y = 0.
To provide more detail about why, and where, y = 0, there are two factors
contributing
√ to this. One is that 16 + k gets rounded to 16, and the other is
that 16 + k gets rounded √ to 4. To investigate where these occur, note that
for small values of k, 16 + k is just a bit larger than 4. The floating-point
numbers the computer has to work with in this region are√4, 4(1 + ε), 4(1 +
2ε), · · · . Given the rounding
√ rule, the computer will claim 16 + k = 4 once
k is small enough that 16 + k < 4(1 + ε/2). Squaring this and dropping the
very small ε2 term you get that k < 16ε. In a similar manner you find that
16 + k gets rounded to 16 for k < 8ε. Based on this, the conclusion is that
if k < 16ε, then the computer will claim that y = 0. It should be mentioned
that if you account for both rounding procedures together that you find the
drop to zero occurs at about k ≈ 24ε.
18 1 Introduction to Scientific Computing
One of the most important words used in this text is error (and it is used
a lot). There are different types of error that we will often make use of. For
example, if xc is a computed value and x is the exact value, then
1. |x − xc | is the error.
|x − xc |
2. is the relative error (assuming x = 0).
|x|
Both are used, but the relative error has the advantage that it is based on
a normalized value. To explain, consider the requirement that the computed
solution should satisfy |x − xc | < 0.1 versus satisfying |x − xc |/|x| < 0.1. If
x = 10−8 then using the error you would accept xc = 10−2 , even though this is
a factor of 106 larger than the solution. With the relative error, you would not
accept xc = 10−2 but would accept any value that satisfies 0.9 < |xc /x| < 1.1.
The other useful aspect of the relative error is that it has a connection to the
number of correct significant digits, and this is explained later.
The error and the relative error require you to know the exact solution.
For this reason, they will play an important role in the derivation and testing
of the numerical methods, but will have little, if any, role in the algorithm
that is finally produced.
One of the problems of not knowing the error is that it can be difficult to
know when to stop a computation. As an example, consider the problem of
calculating the value of
∞
7
s=8− .
n=1
8n
Given that this involves the geometric series, you can show that s = 7. The
value of the series can be computed by first rewriting it as recurrence relation
as follows: s0 = 8 and
7
sk = sk−1 − , for k = 1, 2, 3, 4, · · · . (1.14)
8k
The computed values for sk are given in Table 1.6. It is possible to introduce
a measure for the improvement in the value of sk seen in this table by using
one of the following:
1. |sk − sk−1 | is the iterative error,
|sk − sk−1 |
2. is the relative iterative error (assuming sk = 0).
|sk |
The values for these quantities are given in Table 1.6. As with the relative
error, the preference in this text will be to use the relative iterative error
whenever possible given that it is a normalized value.
1.5 Error and Accuracy 19
1 7.125000000000000
2 7.015625000000000 1.1e−01 1.6e−02 2.2e−03
3 7.001953125000000 1.4e−02 2.0e−03 2.8e−04
4 7.000244140625000 1.7e−03 2.4e−04 3.5e−05
5 7.000030517578125 2.1e−04 3.1e−05 4.4e−06
6 7.000003814697266 2.7e−05 3.8e−06 5.4e−07
Table 1.6 Values of sk , which is given in (1.14), as they approach the exact value of
s = 7. Also given are the iterative error, the relative iterative error, and the relative error.
1.5.1 Over-computing?
Exercises
For an exercise requiring you to compute the solution, you should use double-
precision arithmetic.
1.1. The following are true or false. If true, provide an explanation why it is
true, and if it is false provide an example demonstrating this along with an
22 1 Introduction to Scientific Computing
Section 1.2
1.2. Show that the following are floating-point numbers: (a) 15, (b) −6, (c)
3/2, (d) −5/4.
1.5. Find nonzero numbers for x and y so the computed value of x/y is the
stated result. Also, provide a short explanation why your example does this.
1.6. Compute the following, and provide a plausible explanation for the
answer.
1.7. Letting
a −1 1 a
A= , x= , and y= ,
0 3 −1 0
compute the following, and provide a plausible explanation for the answer.
1.8. Let xf and yf be adjacent floating-point numbers. You can assume they
are positive and normal floats.
(a) What is the minimum possible distance between xf and yf ?
(b) What is the maximum possible distance between xf and yf ?
(c) How many double-precision numbers lie between two consecutive single-
precision numbers? You can assume the single-precision numbers are
positive.
1.9. In double precision, (i) what is the distance from 32 to the next largest
floating-point number and (ii) what is the distance from 32 to the next small-
est floating-point number?
1.10. (a) In double precision, explain why the floating-point numbers in the
interval 252 ≤ x ≤ 253 are exactly the integers in this interval.
(b) In double precision, explain why the only floating-point numbers satis-
fying 253 ≤ xf ≤ xM are integers.
1.11. For a computer, the epoch is the time and date from which it measures
system time. Typically for UNIX systems, the epoch is midnight on January 1,
1970. Assume in this problem that system time is measured in microseconds.
So, for example, if the system time is 86400000000 then it is midnight on
January 2, 1971 since there are 86400000000 microseconds in a day. Assuming
double precision is used, and every year contains 365 days, on what date will
a computer using UNIX be unable to accurately determine the time of day?
Comment: The epoch and system time are used by UNIX programmers to
have “time t parties”. The more notable being the one held on 2/13/2009.
1.12. (a) Find the largest open interval about x = 16 so all real numbers
from the interval are rounded to xf = 16. That is, find the smallest value
of L and largest value of R with L < 16 < R so any number from the
interval (L, R) is rounded to the floating-point number xf = 16. Assume
double precision is used.
(b) Show that x = 50 is a floating-point number, and then redo part (a) for
x = 50.
24 1 Introduction to Scientific Computing
n = 100, T = 1, B = 1
for i = 2, 4, 6, · · · , n
T =T ∗i
end
for i = 3, 5, 7, · · · , n − 1
B =B∗i
end
R = T /B
1.16. Compute the following. Your answer must contain at least 12 signifi-
cant digits. If you must modify the sum(s) in any way to obtain the answer,
explain what you did and why.
1000 1000 k
ek k=0 e
(a) , (d) 1000 ,
1 + ek n=0 ne
n
k=0
1000
1000
cosh(k)
(b) , (e) ln(ek + 1),
1 + sinh(k)
k=0 k=0
1000
1000
√ 1000
(c) 3 + ek − 1 + en ,
(f) ln ek ,
k=0 n=0
k=0
1000
10 1 10 1
(g) k sin π(k + ) − sin π(k − ) .
k k
k=1
1.17. Using the quadratic formula, compute the positive solution of the given
equation. If you run into a complication in computing the solution, explain how
you resolved the problem. (a) x2 + 108 x − 14 = 0, (b) 10−16 x2 + x − 14 = 0.
(d) Write down an algorithm that can be used to accurately evaluate z for
any positive normalized floating-point numbers for x and y.
1.20. Homer Simpson, in the 1998 episode “The Wizard of Evergreen Ter-
race”, claimed he had a counterexample to Fermat’s Last Theorem, and it
was that 398712 + 436512 = 447212 . This exercise considers whether it is pos-
sible to prove numerically that Homer is correct. Note that another (false)
counterexample appeared in the 1995 episode “Treehouse of Horror VI”.
(a) Calculate 398712 + 436512 − 447212 . If Homer is right, what should the
answer be? 1/12
(b) Calculate 398712 + 436512 − 4472. If Homer is right, what should
the answer be?
(c) Calculate 398712 + 436512 /447212 . If Homer is right, what should the
answer be?
1/12 12
(d) Calculate 398712 + 436512 − 447212 . If Homer is right, what
should the answer be?
(e) One argument that Homer could make is that (c) is the correct result and
(a) and (b) can be ignored because if they are correct then you should
not get a discrepancy between (a) and (d). Explain why double-precision
arithmetic cannot be used to prove whether Homer is right or wrong.
Note: Homer’s blackboard containing the stated formula, along with a
few other gems, can be found in Singh [2013]. It also explains why Homer
appears to have an interest in mathematics and physics.
0.8
0.6
y-axis
0.4
0.2
0
-3 -2 -1 0 1 2 3
-7
x-axis 10
Section 1.4
√
1.23. The graph of the function f (x) = ( 1 + x2 − 1)/x2 is shown in Figure
1.9 where the values of f (x) were computed using double precision.
(a) Using l’Hospital’s rule, determine limx→0 f (x).
(b) Rewrite f (x) in such a way that the function is defined at x = 0. Evaluate
this function at x = 0.
(c) Why does the computer state that f (x) = 0 for small values of x? Also,
the graph shows that as x decreases to zero the function drops to zero.
Determine where this occurs (approximately).
1.24. The graph of the function f (x) = (ex − 1)/x is shown in Figure 1.10.
In this problem, the quadratic Taylor polynomial approximation ex ≈ 1 +
x + x2 /2, for |x| 1, is useful.
(a) Using l’Hospital’s rule, determine limx→0 f (x).
(b) Redo part (a) but use the quadratic Taylor polynomial approximation.
(c) Suppose that x is positive. Why does the computer state that f (x) = 0
for small values of x? Approximately, where does the drop to zero occur?
(d) Redo part (c) when x is negative.
28 1 Introduction to Scientific Computing
Section 1.5
1.5
y-axis
0.5
0
-3 -2 -1 0 1 2
x-axis 10-15
∞
1.27. This problem concerns computing k=1 1/k 2 . The exact value of the
sum is π 2 /6.
(a) Suppose that the sum is computed using the algorithm given below.
Explain how the stopping condition works.
s = 1, ss = 0, k = 1
while s = ss
k =k+1
ss = s
s = s + 1/k 2
end
(b) Compute the sum using the procedure in part (a) and report its value to
12 digits. At what value of k does the algorithm stop? How many digits
of the computed sum are correct?
(c) Assuming the number of correct digits in your answer is part (b) is m,
compute the sum so the value is correct to, at least, m + 2 digits. Make
sure to explain how you do this. Also, your procedure cannot use the
known value of the sum.
LONGEING.
BENDING LESSONS.
SADDLING.
MOUNTING.
REARING.
Should the horse rear, the rider must yield the hand when the
horse is up, and urge him vigorously forward when he is coming
down; if the horse is punished while up, he may spring and fall
backward.
Use the running-rein with a rearing horse.
KICKING.
SHYING.
The horses are at first equipped with the watering-bridle, and are
without saddles. The reins are on the horse's neck just in front of
the withers, and knotted so that they will not hang low enough to
entangle the horse's feet, care being taken to have them loose
enough to permit the horse to push his nose well out, so as to have
entire freedom of the head. The horse should be watered before
putting him into the stream.
When the rider gets into deep water, he drops the reins, seizes a
lock of the mane with the up-stream hand, allows his body to drift
off quietly to the down-stream side of the horse, and floats or swims
flat on the water, guiding the horse as much as possible by splashing
water against his head, only using the reins when splashing fails.
The horse is easily controlled when swimming; he is also easily
confused, and it is therefore necessary that the rider should be
gentle and deliberate. The rider must be cautioned that the horse is
easily pulled over backward by the reins when swimming, and also
that he may plunge when he touches bottom. When the horse
touches the bottom at the landing, the rider pulls himself on the
horse's back and takes the reins.
The rider may also be required to swim, holding the horse's tail,
allowing the horse to tow him.
After the man and horse have gained confidence, the rider may
be required to be seated on the horse while swimming. As the extra
weight presses the horse down and impedes his movements, the
rider should hold his knees well up to lessen the resistance, and
steady his seat by holding on to the mane or pommel of the saddle.
The men are instructed, in crossing running water, to keep their
eyes fixed on the opposite bank.
The practice of swimming gives horses confidence in deep water
when in harness. Streams deep and wide enough to swim one and
even two pairs of a team have been crossed by light artillery in our
service.
BREAKING IN THE YOUNG HORSE TO HARNESS.
The horse is thrown and one end of each of the long straps is
made fast to the bit-rings; the other ends are passed through the
rings on the leather surcingle and secured to the hind pasterns.
When thus secured, all means should be resorted to in order to
make the horse kick, and this should be repeated until he no longer
struggles or attempts to move his hind legs under any provocation
whatever.
Horses require gentle treatment. Docile, but bold, horses are apt
to retaliate upon those who abuse them, while persistent kindness
often reclaims vicious animals.
A horse must never be kicked in the belly, or struck about the
head with the hands, reins, or any instrument whatever.
Never threaten, strike, or otherwise abuse a horse.
Before entering a stall speak to the horse gently, and then go in
quietly.
Never take a rapid gait until the horse has been warmed up by
gentle exercise.
Never put up a horse brought to the stable or line heated, but
throw a blanket over him and rub his legs, or walk him until cool. If
he is wet, put him under shelter and wisp him against the hair until
dry.
Never feed grain to a horse, or allow him to stand uncovered,
when heated. Hay will not hurt a horse no matter how warm he may
be.
Never water a horse when heated, unless the exercise or march is
to be immediately resumed. A few mouthfuls of water, however, will
do no harm, and should ordinarily be given him.
Never throw water over a horse coming in hot, not even over his
legs or feet.
Never allow a horse's back to be cooled suddenly by washing or
even removing the blanket unnecessarily.
To cool the back gradually, the blanket may be removed and
replaced with the dry side next the horse.
At least two hours' exercise daily is necessary to the health and
good condition of horses; they should be marched a few miles when
cold weather, muddy ground, etc., prevent drill.
Horses' legs will be often hand-rubbed, particularly after severe
exercise, as this removes enlargement and relieves or prevents
stiffness.
In mild weather the sheath will be washed out once a month with
warm water and castile soap and then greased; during the cold
season the intervals between washings should be longer.
Sore backs and galled shoulders are generally occasioned by
neglect. The greatest pains will be taken in the fitting of the saddles
and collars; the men must never be allowed to lounge or sit
unevenly in their saddles. Every driver should keep a pair of soft
leather pads, stuffed with hair, about six inches by four; the moment
any tenderness is noticed in a horse's shoulder, the pressure is
removed by placing these pads under the collar above and below the
tender part.
DESTRUCTION OF HORSES.
Occasions arise rendering the destruction of horses necessary.
The following instructions will enable one to arrive at a point directly
over the summit of the brain, and which when fired upon will cause
instantaneous death. Draw a line, A A, horizontally across the
forehead from the upper margin of one zygomatic ridge to the other,
and from its central point, B, measure vertically upward on the
forehead 3½ to 4½ inches. The point, D, thus obtained is directly
over the brain-cavity.
Fig. 76.
Before firing, the horse should be induced to lower his head,
which is easily accomplished by placing a little food upon the
ground, the muzzle of the weapon being brought directly over the
spot indicated.
It is a mistake to suppose that the star, or curl, is over the brain-
cavity, for it is generally below the cavity.
CHAPTER VII.
Organization of Artillery. Composition of Light Batteries. Equipment. Equipment and Clothing for
Marches. Marches. Selection of Camps. Making Camp. Breaking Camp. Allowance of
Wagons.
ORGANIZATION OF ARTILLERY.
Artillery troops are divided into light artillery and heavy artillery. To the light
artillery belongs the service of the batteries which manœuvre with troops in the
field.
The light-artillery batteries include horse-batteries, in which the cannoneers are
mounted on horseback; field-batteries, in which the cannoneers march by the side
of their pieces, or are mounted on the ammunition-chests, axle-seats, and off
horses; and mountain-batteries, in which the pieces may be transported on pack-
animals.
Machine-batteries are designated, according to their equipment and model of
gun, as horse, field, or mountain, Gatling, Gardner, etc., batteries.
The 3.2-inch gun is used in both field-and horse-batteries; the 3.6-inch gun is
used in field-batteries only.
A field-battery equipped with the 3.2-inch gun is called a light field-battery; one
equipped with the 3.6-inch gun is called a heavy field-battery. A battalion of artillery
consists of two, three, or four batteries, and is commanded by a field-officer of
artillery.
The heavy artillery of an army in the field consists of those batteries which serve
the siege-and position-guns, and the artillery-ammunition and supply trains.
The light artillery of an army corps consists of divisional artillery and corps
artillery.
The Divisional Artillery consists of a battalion of from two to four batteries, is
an integral part of the division, and is commanded by a field-officer who has a staff
consisting of an adjutant (lieutenant), sergeant-major, quartermaster-sergeant, and
chief trumpeter.
The Corps Artillery consists of two or more battalions; it is composed of field-
and horse-batteries in suitable proportions, and is commanded by a colonel who has
a staff consisting of an adjutant (lieutenant), a quartermaster and commissary
(lieutenant) sergeant-major, quartermaster-sergeant, and chief trumpeter. All the
artillery attached to an army corps constitutes an artillery brigade. A battalion of
horse-artillery is attached to and is part of each division of cavalry. In smaller
commands a battery may be attached to an infantry or cavalry brigade.
The proportion of artillery is from three to four guns to one thousand men. The
chief of artillery of an army or corps is a brigadier-general, and is on the staff of the
commander of the corps. The corps artillery is under the orders of the brigadier-
general, chief of artillery, and he also assumes control of the divisional artillery in
action when ordered to do so by the corps commander.
The field-officer commanding the divisional artillery is the chief of artillery of the
division, and is on the staff of the division commander, but he will encamp with the
divisional artillery.
Instruction. War.
6 Guns, 6 Guns,
Field-battery.
4 Caissons. 9 Caissons.
Officers. Men. Horses. Officers. Men. Horses.
Commanding the
Captain 1 1 platoons and
caissons.
Lieutenants 3 4
a. First sergeant,
stable and
Staff-sergeants 2a 2 3b 3
veterinary
sergeant.
Sergeants 6 6 6 6
b. First sergeant,
quartermaster
and stable
Corporals 9c 3 15d 9
and
veterinary
sergeants.
Artificers 4e 5f 5
c. Six gunners and
Trumpeters 2 2 2 2 three caisson
corporals.
Guidon 1 1 1 1
d. Six gunners
and nine
Wagoner 1 4
caisson
corporals.
Drivers 24 48 48 96
e. Two
blacksmiths,
Cannoneers 36 84 one saddler,
one
machinist.
Supernumerary
8
drivers
f. Three
blacksmiths,
Spare horses 4 16
one saddler,
one machinist
Range-finders. 2 2
Total 4 84 66 5 175 144
The machinist should be conversant with the construction and mechanism of the
gun, and competent to make the ordinary repairs it may require.
The men should be intelligent, active, and muscular, and not less than five feet
five inches, nor more than six feet, in height; very large men are specially
undesirable. The great majority should be men accustomed to horses; a suitable
proportion must be mechanics.
If a public horse be allowed to each subaltern, the number of horses in the above
table will be proportionately increased.
The battery-wagon and forge and the artillery-wagon, when not horsed, must be
kept with the battery and equipped with the proper tools and stores.
When a battery on the instruction footing is ordered to march, it must be
supplied with additional horses necessary to horse all the carriages.
In horse-batteries, in addition to the number of horses above described, ten
saddle-horses (including one spare horse) are required for each gun detachment.
EQUIPMENT.
In garrison the first sergeant, quartermaster-sergeant, stable and veterinary
sergeants, and chiefs of section are armed with the sabre, and the caisson
corporals, trumpeters, guidon, and drivers also, when specially directed.
In the field the first sergeant, quartermaster-sergeant, stable sergeant, and chiefs
of section are armed with the sabre and revolver; all other men are armed with the
revolver and knife.
In preparing for a march or field service the kinds and quantities of supplies
required will depend on the duration and character of the work. Having determined
what is required, divide the work of preparing for service among the officers and
non-commissioned officers immediately in charge, and then carefully superintend
the work yourself.
Attention is called to the following points:
Rations, forage, medicines, veterinary medicines, instruments, and bandages,
leather and spare parts for repairs to harness, carriages, etc., horseshoes,
horseshoe-nails, blacksmith's, saddler's, and carpenter's tools (if there be no
battery-wagon and forge), field-desk, with a supply of blanks, paper, envelopes,
pens, ink, and pencils, the necessary company-books, and a book of telegraph
blanks, ammunition (shell, shrapnel, canister, cartridges, fuzes, fuze-cutters, friction-
primers, lanyards), oil for harness, cosmoline for guns, equipment and clothing for
each man, number and kind of tents, Sibley stoves, axes, hatchets, mauls, scythes,
sickles, buckets, spades, shovels, pickaxes, wagon-tongues, coupling-poles, hame-
strings, open links, odometer, rope, axle-grease, picket-rope, light jacks, lanterns,
matches, cooking utensils, personal outfit.
COOKING UTENSILS.
PACK IN BOX A.
75 150
Article.
Men. Men.
Dishpans 2 3
Coffee-mill 1 1
Bread-knives 2 2
Meat-knives 2 2
Steel 1 1
Cleaver 1 1
Saw 1 1
Forks, carving 2 3
Forks, spit 2 2
Spoons, long 2 2
Can-openers 2 2
Ladles 2 2
Frying-pans 2 2
Small rations
PACK IN BOX B.
75 150
Article.
Men. Men.
Coffee-boiler 1 2
Camp-kettles 4 6
Water-buckets 2 3
Dipper 1 1
Hash machine 1 1
1 axe, 1 spade, 1 shovel, tied together and fastened to outside of box.
Put the camp-kettles inside the coffee-boilers.
Vinegar-keg, 1, Dutch ovens, 2, or Buzzacott oven, 1, for 75 men; double the number for 150
men.
One of the boxes may be large enough to contain the Buzzacott oven. In order to
pack it put in the top inverted, and then invert the body of the oven and set it inside
the top.
1 water-bucket
1 dipper
1 quart cup, tin
1 washbasin, rubber
1 small looking-glass
1 lantern, with oil or candles for same
1 small oil-stove, fitted in box
1 oil-can
5 gals. oil
1 tin matchbox
Box of matches
1 or 2 folding-chairs
1 folding-bed
1 folding-table
1 rubber blanket
1 small strip carpet
1 pillow
Necessary bedding
1 pair trousers, extra
1 blouse, extra
1 pair shoes
½ doz. shoestrings
1 pair overshoes
1 pair slippers
1 pair gauntlets, extra
1 campaign hat
1 overcoat
1 rubber coat
2 pairs drawers, extra
2 undershirts, extra
2 flannel shirts
4 pairs socks
4 towels
½ doz. handkerchiefs
1 sponge, in oil-silk bag
Packages of toilet-paper
1 portfolio, with pens, ink, paper, envelopes, and stamps
1 hold-all, containing comb, brush, clothes-brush, scissors, soap (in soapbox),
toothbrush and tooth-powder, shaving materials
1 housewife, with needles, thread and buttons
Pipe, tobacco, and fuzees
1 piece stout cord
1 tape-measure
1 pocket-map
In Cold Climate.
Sticking-plaster, lint, safety-pins, tin of mustard-leaves, and a few simple remedies in case of
dysentery, diarrhœa, constipation, etc.
If messing alone, 1 tin kettle, 1 frying-pan, 2 baking-pans (small), 1 wire gridiron, 1
corkscrew, salt-and pepper-boxes, 1 can-opener, 1 small meat-knife, 1 iron fork (long), 1 iron
spoon (long), 1 small soup-ladle, 2 plates, 2 tin cups, 2 spoons, 2 teaspoons, 2 knives, 2 forks,
tablecloths and napkins, and such stores as one may wish.
MARCHES.
The "general," sounded one hour before the time designated for marching, is the
signal to strike tents, load wagons, pack animals, and send them to the place of
assembly.
The execution of marching orders must not be delayed. If the commander is not
with the troops when they are to march, the next in rank puts the column in motion.
When a march is in prospect, it is well to go out daily, for a week or ten days
previously, for a couple of hours' march. This will harden the horses' shoulders and
discover what corrections are to be made. The average march for field-artillery on
good roads is from 15 to 20 miles a day; horse-artillery, 25 miles.
A single battery, when the march is a long one, will do well to trot occasionally;
so doing shortens the road and greatly relieves man and horse. If the country is
undulating, the platoons should march with considerable distance between them,
and the trot should be taken up by each in succession on arrival at the level ground
where the preceding platoon began to increase its pace. The walk should be
resumed in the same manner.
When marching with other troops, these liberties cannot be taken, and the walk
is, with rare exceptions, the gait used. In rapid marches the slow trot alternates with
the walk.
When the services of artillery are urgently needed, it may be required to trot four
or five miles without breaking the gait.
Long marches or expeditions should be begun moderately, particularly with new
horses. Ten or twelve miles a day is enough for the first marches, which, on good
roads, may be increased to 20 or 25 miles when necessary, after the horses are
inured to their work. Should the march be continued for a long period, at least one
day in seven should be devoted to rest. It is also important that the horses and
equipments be thoroughly inspected at least once a week. On ordinary roads horse-
artillery with cavalry marches usually at the rate of 4 or 5 miles an hour. Field-
batteries, by themselves, can march 3½ to 4 miles an hour on a good road, but on
heavy or hilly roads, or when the battery forms part of a column, the rate of
progress will depend entirely upon circumstances. Should a long march be made,
the horses should be fed on the road; ordinarily watering will be sufficient. In very
hot weather frequent watering will be advisable. To keep horses in condition, it is
essential that they should be in no wise stinted of water. No matter how warm a
horse is six to ten swallows of water will not hurt him.
Always march with a feed of grain; if not used on the road, it enables the horses
to be fed as soon after arriving in camp as desirable. Horses should be arranged in
teams, as far as possible, so as to be of uniform pace in walking, and of similar
disposition.
On long marches it may be advisable to change the near and off horses days
about. Drivers should be required to ride off horses during part of each day's march;
and, unless the entire battery be dismounted by order of the captain, all mounted
men and cannoneers will ordinarily be permitted to mount and dismount at will
when the battery is moving at a walk on level ground.
Cannoneers of field-batteries should always walk up and down hill.
The care of horses on the march is one of the most important duties of an
artillery officer; by constant attention on the part of the captain, chiefs of platoon,
and chiefs of section many horses that would otherwise be disabled for months may
be kept in serviceable condition.
The men must not be allowed to lounge in their saddles, which leads to galls, and
the drivers should be made to pay continual attention to their driving, and see that
every horse does his fair share of work.
The lead-drivers of each team must keep their distance from the team in their
front; swing-drivers must keep the traces to their front stretched, and the wheel-
drivers those to their front.
Have the wheels greased daily, and oil the bearing of the lunette on the pintle-
hook.
Grease on the soles of horses' hoofs prevents snow from balling.
On starting from camp the first two miles should be made at an easy walk; a halt
of from 10 to 15 minutes should then be made to allow the men to relieve
themselves and to rearrange harness, after which a halt of from 5 to 10 minutes is
made at the end of every hour for the purpose of adjusting harness, tightening
girths, etc. When troops march for the greater part of the day, a halt of about an
hour is usually made about noon. At each halt pole-props will be let down; collars
unlocked and thrown back on the saddle or withers, and cleaned if necessary;
saddles replaced if they have moved; cinchas tightened if necessary, and horses'
feet examined.
The march is usually in column of sections; when practicable, it will be in column
of platoons at close intervals; but the front of the column must not be frequently
diminished or increased, as this unavoidably adds to the fatigue of the horses,
particularly of those in rear. The column of platoons should not be used when it fills
the road from side to side so as to prevent the passage of carriages, staff-orderlies,
etc.
A non-commissioned officer may be sent forward to reconnoitre the road or
ground that the battery is to pass over.
The distance of two yards between carriages is maintained, except in bad or
difficult ground, when it may be increased to four or more yards. The strictest
attention should be paid by the chiefs of platoon and of section to the preservation
of distances, which should not be increased more than is absolutely necessary. The
leading guide should maintain a slow and steady walk, and under no circumstances
is a carriage to move at a trot without the orders of the battery commander; when
necessary to close up, it should be done at a quick walk; no practice is more
fatiguing to horses and injurious to their shoulders than the alternate trotting and
walking so often seen at the rear of a column.
If the leading carriage is temporarily stopped for any cause, the rear carriages
should, if practicable, draw up alongside each other, in order to avoid or diminish as
much as possible any check to the column.
Chiefs of platoons must never be permitted to leave their platoons to march at
the head of the column; when not marching at the rear of their platoons, they will
halt frequently to see that their carriages are well up and marching properly.
Chiefs of platoon and of section, without waiting for express instructions, give
such orders as may be necessary for helping horses out of difficulty, for the passage
of obstacles, etc.; the cannoneers assist at the piece or caisson as may be required.
A small bunch of bale-wire, in lengths of from one to two feet, if carried by each
chief of section in his saddle-pouch, is very useful for temporary repairs of harness.
If the ruts be very deep, the carriages quarter the road, unless it be very narrow
and sunken; in this case the horses will be left to themselves and not hurried; a
skilful driver can help his horses greatly, particularly the wheelers.
When water-call is sounded, the chiefs of section, under the supervision of the
chiefs of platoon or of the first sergeant, have the watering-buckets taken off the
carriages, and their horses watered without confusion. When water is very scarce,
the nostrils may be sponged, which gives great relief, particularly in hot weather,
when it is not possible to let the horses drink.
Toward the close of the march an officer or non-commissioned officer may be
sent forward to select a camp-ground. The last two miles or more should be made
at a walk, and the horses brought into camp without excitement.
Upon the arrival of the battery in camp damages must be repaired without delay,
horses shod, wheels and pintles greased, etc. On the march artificers and cooks
should always ride, or be mounted on the chests; if fatigued from marching, they
cannot be expected to work efficiently after getting into camp.
The march of larger bodies of artillery is conducted on the same principles. A long
column cannot move as rapidly as a small one, and at the same time preserve equal
order; an allowance is therefore made for every column proportionate to its length.
When the roads are good, or even tolerable, the artillery is always obliged to wait
for the infantry, which is attended with much additional fatigue to the horses, from
having the harness so much longer on them. Likewise, when the roads are at all
bad, artillery can only keep up with cavalry, when the latter are marching at the
ordinary rate, by forcing their horses too much and wearing them out very rapidly.
When, therefore, there is no danger, the artillery should be allowed to march by
itself so as to regulate its own rate of march.
Chiefs of section should carry nippers in their saddle-pouches to cut wire fences if
necessary.
ACCIDENTS TO CARRIAGES.