You are on page 1of 54

Numerical Solution of Differential

Equations: Introduction to Finite


Difference and Finite Element Methods
1st Edition Zhilin Li
Visit to download the full and correct content document:
https://textbookfull.com/product/numerical-solution-of-differential-equations-introductio
n-to-finite-difference-and-finite-element-methods-1st-edition-zhilin-li/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Numerical Differential Equations Theory and Technique


ODE Methods Finite Differences Finite Elements and
Collocation John Loustau

https://textbookfull.com/product/numerical-differential-
equations-theory-and-technique-ode-methods-finite-differences-
finite-elements-and-collocation-john-loustau/

Extended finite element and meshfree methods Timon


Rabczuk

https://textbookfull.com/product/extended-finite-element-and-
meshfree-methods-timon-rabczuk/

Computational Finite Element Methods in Nanotechnology


Sarhan M. Musa(Editor)

https://textbookfull.com/product/computational-finite-element-
methods-in-nanotechnology-sarhan-m-musaeditor/

Mathematical Theory of Subdivision Finite Element and


Wavelet Methods 1st Edition Sandeep Kumar (Author)

https://textbookfull.com/product/mathematical-theory-of-
subdivision-finite-element-and-wavelet-methods-1st-edition-
sandeep-kumar-author/
Finite Difference Methods in Heat Transfer, Second
Edition M. Necati Özi■ik

https://textbookfull.com/product/finite-difference-methods-in-
heat-transfer-second-edition-m-necati-ozisik/

Fundamentals of RCS Prediction Methodology using


Parallelized Numerical Electromagnetics Code NEC and
Finite Element Pre processor Vineetha Joy

https://textbookfull.com/product/fundamentals-of-rcs-prediction-
methodology-using-parallelized-numerical-electromagnetics-code-
nec-and-finite-element-pre-processor-vineetha-joy/

Electromagnetics through the Finite Element Method: A


Simplified Approach Using Maxwell's Equations 1st
Edition José Roberto Cardoso

https://textbookfull.com/product/electromagnetics-through-the-
finite-element-method-a-simplified-approach-using-maxwells-
equations-1st-edition-jose-roberto-cardoso/

Finite Element Analysis A Primer 2nd Edition Musa

https://textbookfull.com/product/finite-element-analysis-a-
primer-2nd-edition-musa/

Pricing Derivatives Under Lévy Models Modern Finite


Difference and Pseudo Differential Operators Approach
1st Edition Andrey Itkin (Auth.)

https://textbookfull.com/product/pricing-derivatives-under-levy-
models-modern-finite-difference-and-pseudo-differential-
operators-approach-1st-edition-andrey-itkin-auth/
NUMERICAL SOLUTION OF
DIFFERENTIAL EQUATIONS

This introduction to finite difference and finite element methods is aimed at


advanced undergraduate and graduate students who need to solve differential
equations. The prerequisites are few (basic calculus, linear algebra, and ordi-
nary and partial differential equations) and so the book will be accessible and
useful to readers from a range of disciplines across science and engineering.
Part I begins with finite difference methods. Finite element methods are
then introduced in Part II. In each part, the authors begin with a comprehen-
sive discussion of one-dimensional problems, before proceeding to consider
two or higher dimensions. An emphasis is placed on numerical algorithms,
related mathematical theory, and essential details in the implementation, while
some useful packages are also introduced. The authors also provide well-tested
Matlab® codes, all available online.

ZHILIN LI is a tenured full professor at the Center for Scientific Computation &
Department of Mathematics at North Carolina State University. His research
area is in applied mathematics in general, particularly in numerical analysis
for partial differential equations, moving interface/free boundary problems,
irregular domain problems, computational mathematical biology, and sci-
entific computing and simulations for interdisciplinary applications. Li has
authored one monograph, The Immersed Interface Method, and also edited sev-
eral books and proceedings.
ZHONGHUA QIAO is an associate professor in the Department of Applied
Mathematics at the Hong Kong Polytechnic University.
TAO TANG is a professor in the Department of Mathematics at Southern
University of Science and Technology, China.

13:40:38, subject to the Cambridge Core


13:40:38, subject to the Cambridge Core
NUMERICAL SOLUTION OF
DIFFERENTIAL EQUATIONS
Introduction to Finite Difference and
Finite Element Methods

ZH I L I N LI
North Carolina State University, USA

Z H O N G H UA QIAO
Hong Kong Polytechnic University, China

T A O T ANG
Southern University of Science and Technology, China

13:40:38, subject to the Cambridge Core


University Printing House, Cambridge CB2 8BS, United Kingdom
One Liberty Plaza, 20th Floor, New York, NY 10006, USA
477 Williamstown Road, Port Melbourne, VIC 3207, Australia
314–321, 3rd Floor, Plot 3, Splendor Forum, Jasola District Centre, New Delhi – 110025, India
79 Anson Road, #06-04/06, Singapore 079906

Cambridge University Press is part of the University of Cambridge.


It furthers the University’s mission by disseminating knowledge in the pursuit of
education, learning, and research at the highest international levels of excellence.

www.cambridge.org
Information on this title: www.cambridge.org/9781107163225
DOI: 10.1017/9781316678725
© Zhilin Li, Zhonghua Qiao, and Tao Tang 2018
This publication is in copyright. Subject to statutory exception
and to the provisions of relevant collective licensing agreements,
no reproduction of any part may take place without the written
permission of Cambridge University Press.
First published 2018
Printed in the United Kingdom by Clays, St Ives plc
A catalogue record for this publication is available from the British Library.
ISBN 978-1-107-16322-5 Hardback
ISBN 978-1-316-61510-2 Paperback
Cambridge University Press has no responsibility for the persistence or accuracy
of URLs for external or third-party internet websites referred to in this publication
and does not guarantee that any content on such websites is, or will remain,
accurate or appropriate.

13:40:38, subject to the Cambridge Core


Table of Contents

Preface page ix

1 Introduction 1
1.1 Boundary Value Problems of Differential Equations 1
1.2 Further Reading 5

PART I FINITE DIFFERENCE METHODS 7

2 Finite Difference Methods for 1D Boundary Value Problems 9


2.1 A Simple Example of a Finite Difference Method 9
2.2 Fundamentals of Finite Difference Methods 14
2.3 Deriving FD Formulas Using the Method of Undetermined
Coefficients 19
2.4 Consistency, Stability, Convergence, and Error Estimates of
FD Methods 21
2.5 FD Methods for 1D Self-adjoint BVPs 27
2.6 FD Methods for General 1D BVPs 29
2.7 The Ghost Point Method for Boundary Conditions Involving
Derivatives 30
2.8 An Example of a Nonlinear BVP 34
2.9 The Grid Refinement Analysis Technique 37
2.10 * 1D IIM for Discontinuous Coefficients 39
Exercises 44

3 Finite Difference Methods for 2D Elliptic PDEs 47


3.1 Boundary and Compatibility Conditions 49
3.2 The Central Finite Difference Method for Poisson Equations 51
3.3 The Maximum Principle and Error Analysis 55

13:40:46, subject to the Cambridge Core


vi Table of Contents

3.4 Finite Difference Methods for General Second-order Elliptic


PDEs 60
3.5 Solving the Resulting Linear System of Algebraic Equations 61
3.6 A Fourth-order Compact FD Scheme for Poisson Equations 67
3.7 A Finite Difference Method for Poisson Equations in Polar
Coordinates 69
3.8 Programming of 2D Finite Difference Methods 72
Exercises 75
4 FD Methods for Parabolic PDEs 78
4.1 The Euler Methods 80
4.2 The Method of Lines 85
4.3 The Crank–Nicolson scheme 87
4.4 Stability Analysis for Time-dependent Problems 89
4.5 FD Methods and Analysis for 2D Parabolic Equations 97
4.6 The ADI Method 99
4.7 An Implicit–explicit Method for Diffusion and Advection
Equations 104
4.8 Solving Elliptic PDEs using Numerical Methods for Parabolic
PDEs 105
Exercises 105
5 Finite Difference Methods for Hyperbolic PDEs 108
5.1 Characteristics and Boundary Conditions 109
5.2 Finite Difference Schemes 110
5.3 The Modified PDE and Numerical Diffusion/Dispersion 115
5.4 The Lax–Wendroff Scheme and Other FD methods 117
5.5 Numerical Boundary Conditions 120
5.6 Finite Difference Methods for Second-order Linear
Hyperbolic PDEs 121
5.7 Some Commonly Used FD Methods for Linear System of
Hyperbolic PDEs 127
5.8 Finite Difference Methods for Conservation Laws 127
Exercises 131

PART II FINITE ELEMENT METHODS 133


6 Finite Element Methods for 1D Boundary Value Problems 135
6.1 The Galerkin FE Method for the 1D Model 135
6.2 Different Mathematical Formulations for the 1D Model 138
6.3 Key Components of the FE Method for the 1D Model 143

13:40:46, subject to the Cambridge Core


Table of Contents vii

6.4 Matlab Programming of the FE Method for the 1D Model


Problem 152
Exercises 156
7 Theoretical Foundations of the Finite Element Method 158
7.1 Functional Spaces 158
7.2 Spaces for Integral Forms, L2 (Ω) and Lp (Ω) 160
7.3 Sobolev Spaces and Weak Derivatives 164
7.4 FE Analysis for 1D BVPs 168
7.5 Error Analysis of the FE Method 173
Exercises 178
8 Issues of the FE Method in One Space Dimension 181
8.1 Boundary Conditions 181
8.2 The FE Method for Sturm–Liouville Problems 185
8.3 High-order Elements 189
8.4 A 1D Matlab FE Package 195
8.5 The FE Method for Fourth-order BVPs in 1D 208
8.6 The Lax–Milgram Lemma and the Existence of FE Solutions 214
8.7 *1D IFEM for Discontinuous Coefficients 221
Exercises 223
9 The Finite Element Method for 2D Elliptic PDEs 228
9.1 The Second Green’s Theorem and Integration by Parts in 2D 228
9.2 Weak Form of Second-order Self-adjoint Elliptic PDEs 231
9.3 Triangulation and Basis Functions 233
9.4 Transforms, Shape Functions, and Quadrature Formulas 246
9.5 Some Implementation Details 248
9.6 Simplification of the FE Method for Poisson Equations 251
9.7 Some FE Spaces in H1 (Ω) and H2 (Ω) 257
9.8 The FE Method for Parabolic Problems 272
Exercises 275
Appendix: Numerical Solutions of Initial Value Problems 279
A.1 System of First-order ODEs of IVPs 279
A.2 Well-posedness of an IVP 280
A.3 Some Finite Difference Methods for Solving IVPs 281
A.4 Solving IVPs Using Matlab ODE Suite 284
Exercises 288
References 289
Index 291

13:40:46, subject to the Cambridge Core


13:40:46, subject to the Cambridge Core
Preface

The purpose of this book is to provide an introduction to finite difference and


finite element methods for solving ordinary and partial differential equations
of boundary value problems. The book is designed for beginning graduate stu-
dents, upper level undergraduate students, and students from interdisciplinary
areas including engineers and others who need to obtain such numerical solu-
tions. The prerequisite is a basic knowledge of calculus, linear algebra, and
ordinary differential equations. Some knowledge of numerical analysis and
partial differential equations would also be helpful but not essential.
The emphasis is on the understanding of finite difference and finite element
methods and essential details in their implementation with reasonably mathe-
matical theory. Part I considers finite difference methods, and Part II is about
finite element methods. In each part, we start with a comprehensive discus-
sion of one-dimensional problems before proceeding to consider two or higher
dimensions. We also list some useful references for those who wish to know
more in related areas.
The materials of this textbook in general can be covered in an academic year.
The two parts of the book are essentially independent. Thus it is possible to use
only one part for a class.
This is a textbook based on materials that the authors have used, and some
are from Dr. Randall J. LeVeque’s notes, in teaching graduate courses on the
numerical solution of differential equations. Most sample computer program-
ming is written in Matlab® . Some advantages of Matlab are its simplicity, a
wide range of library subroutines, double precision accuracy, and many existing
and emerging tool-boxes.
A website www4.ncsu.edu/~zhilin/FD_FEM_Book has been set up, to post or
link computer codes accompanying this textbook.
We would like to thank Dr. Roger Hoskin, Lilian Wang, Peiqi Huang, and
Hongru Chen for proofreading the book, or for providing Matlab code.
ix

08:57:00, subject to the Cambridge Core terms of use,


01
08:57:00, subject to the Cambridge Core terms of use,
01
1
Introduction

1.1 Boundary Value Problems of Differential Equations


We discuss numerical solutions of problems involving ordinary differential
equations (ODEs) or partial differential equations (PDEs), especially linear
first- and second-order ODEs and PDEs, and problems involving systems of
first-order differential equations.
A differential equation involves derivatives of an unknown function of one
independent variable (say u(x)), or the partial derivatives of an unknown
function of more than one independent variable (say u(x, y), or u(t, x), or
u(t, x, y, z), etc.). Differential equations have been used extensively to model
many problems in daily life, such as pendulums, Newton’s law of cooling,
resistor and inductor circuits, population growth or decay, fluid and solid
mechanics, biology, material sciences, economics, ecology, kinetics, thermo-
dynamics, sports and computer sciences.1 Examples include the Laplace equa-
tion for potentials, the Navier–Stokes equations in fluid dynamics, biharmonic
equations for stresses in solid mechanics, and Maxwell equations in electro-
magnetics. For more examples and for the mathematical theory of PDEs, we
refer the reader to Evans (1998) and references therein.
However, although differential equations have such wide applications, too
few can be solved exactly in terms of elementary functions such as polynomials,
log x, ex , trigonometric functions (sin x, cos x, . . .), etc. and their combina-
tions. Even if a differential equation can be solved analytically, considerable
effort and sound mathematical theory are often needed, and the closed form
of the solution may even turn out to be too messy to be useful. If the analytic
solution of the differential equation is unavailable or too difficult to obtain, or

1 There are other models in practice, for example, statistical models.

08:59:40, subject to the Cambridge Core terms of use,


02
2 Introduction

Real problem Physical laws/ Mathematical/physical


other approach models

Analytic/exact
Solution techniques
Approximated
Use computers

Interpret solution Applications

Visualization Products
Experiments
Prediction
Better models

Figure 1.1. A flowchart of a problem-solving process.

takes some complicated form that is unhelpful to use, we may try to find an
approximate solution. There are two traditional approaches:
1. Semi-analytic methods. Sometimes we can use series, integral equations,
perturbation techniques, or asymptotic methods to obtain an approximate
solution expressed in terms of simpler functions.
2. Numerical solutions. Discrete numerical values may represent the solution
to a certain accuracy. Nowadays, these number arrays (and associated tables
or plots) are obtained using computers, to provide effective solutions of
many problems that were impossible to obtain before.
In this book, we mainly adopt the second approach and focus on numeri-
cal solutions using computers, especially the use of finite difference (FD) or
finite element (FE) methods for differential equations. In Figure 1.1, we show
a flowchart of the problem-solving process.
Some examples of ODE/PDEs are as follows.
1. Initial value problems (IVP). A canonical first-order system is
dy
= f(t, y), y(t0 ) = y0 ; (1.1)
dt
and a single higher-order differential equation may be rewritten as a first-
order system. For example, a second-order ODE
u′′ (t) + a(t)u′ (t) + b(t)u(t) = f(t),
(1.2)
u(0) = u0 , u′ (0) = v0 .

08:59:40, subject to the Cambridge Core terms of use,


02
1.1 Boundary Value Problems of Differential Equations 3

can be converted into a first-order system by setting y1 (t) = u and


y2 (t) = u′ (t).
An ODE IVP can often be solved using Runge–Kutta methods, with
adaptive time steps. In Matlab, there is the ODE-Suite which includes ode45,
ode23, ode23s, ode15s, etc. For a stiff ODE system, either ode23s or ode15s
is recommended; see Appendix for more details.
2. Boundary value problems (BVP). An example of an ODE BVP is

u′′ (x) + a(x)u′ (x) + b(x)u(x) = f(x), 0 < x < 1,


(1.3)
u(0) = u0 , u(1) = u1 ;

and a PDE BVP example is

uxx + uyy = f(x, y), (x, y) ∈ Ω,


(1.4)
u(x, y) = u0 (x, y), (x, y) ∈ ∂Ω,
2
∂ u 2
∂ u
where uxx = ∂x 2 and uyy = ∂y2 , in a domain Ω with boundary ∂Ω. The above
PDE is linear and classified as elliptic, and there are two other classifications
for linear PDE, namely, parabolic and hyperbolic, as briefly discussed below.
3. BVP and IVP, e.g.,
ut = auxx + f(x, t),
u(0, t) = g1 (t), u(1, t) = g2 (t), BC (1.5)
u(x, 0) = u0 (x), IC,
where BC and IC stand for boundary condition(s) and initial condition,
respectively, where ut = ∂u
∂t .
4. Eigenvalue problems, e.g.,

u′′ (x) = λu(x),


(1.6)
u(0) = 0, u(1) = 0.

In this example, both the function u(x) (the eigenfunction) and the scalar λ
(the eigenvalue) are unknowns.
5. Diffusion and reaction equations, e.g.,
∂u
= ∇ · (β∇u) + a · ∇u + f(u) (1.7)
∂t
where a is a vector, ∇ · (β∇u) is a diffusion term, a · ∇u is called an
advection term, and f(u) a reaction term.

08:59:40, subject to the Cambridge Core terms of use,


02
4 Introduction

6. Systems of PDE. The incompressible Navier–Stokes model is an important


nonlinear example:

ρ (ut + (u · ∇)u) = ∇p + µ∆u + F,


(1.8)
∇ · u = 0.

In this book, we will consider BVPs of differential equations in one dimen-


sion (1D) or two dimensions (2D). A linear second-order PDE has the following
general form:

a(x, y)uxx + 2b(x, y)uxy + c(x, y)uyy

+ d(x, y)ux + e(x, y)uy + g(x, y)u(x, y) = f(x, y) (1.9)


where the coefficients are independent of u(x, y) so the equation is linear in u
and its partial derivatives. The solution of the 2D linear PDE is sought in some
bounded domain Ω; and the classification of the PDE form (1.9) is:
• Elliptic if b2 − ac < 0 for all (x, y) ∈ Ω,
• Parabolic if b2 − ac = 0 for all (x, y) ∈ Ω, and
• Hyperbolic if b2 − ac > 0 for all (x, y) ∈ Ω.
The appropriate solution method typically depends on the equation class. For
the first-order system

∂u ∂u
= A(x) , (1.10)
∂t ∂x

the classification is determined from the eigenvalues of the coefficient


matrix A(x).
Finite difference and finite element methods are suitable techniques to
solve differential equations (ODEs and PDEs) numerically. There are other
methods as well, for example, finite volume methods, collocation methods,
spectral methods, etc.

1.1.1 Some Features of Finite Difference and Finite


Element Methods
Many problems can be solved numerically by some finite difference or finite
element methods. We strongly believe that any numerical analyst should be
familiar with both methods and some important features listed below.

08:59:40, subject to the Cambridge Core terms of use,


02
1.2 Further Reading 5

Finite difference methods:


• Often relatively simple to use, and quite easy to understand.
• Easy to implement for regular domains, e.g., rectangular domains in Carte-
sian coordinates, and circular or annular domains in polar coordinates.
• Their discretization and approximate solutions are pointwise, and the
fundamental mathematical tool is the Taylor expansion.
• There are many fast solvers and packages for regular domains, e.g., the
Poisson solvers Fishpack (Adams et al.) and Clawpack (LeVeque, 1998).
• Difficult to implement for complicated geometries.
• Have strong regularity requirements (the existence of high-order derivatives).
Finite element methods:
• Very successful for structural (elliptic type) problems.
• Suitable approach for problems with complicated boundaries.
• Sound theoretical foundation, at least for elliptic PDE, using Sobolev space
theory.
• Weaker regularity requirements.
• Many commercial packages, e.g., Ansys, Matlab PDE Tool-Box, Triangle,
and PLTMG.
• Usually coupled with multigrid solvers.
• Mesh generation can be difficult, but there are now many packages that do
this, e.g., Matlab, Triangle, Pltmg, Fidap, Gmsh, and Ansys.

1.2 Further Reading


This textbook provides an introduction to finite difference and finite element
methods. There are many other books for readers who wish to become expert
in finite difference and finite element methods.
For FD methods, we recommend Iserles (2008); LeVeque (2007);
Morton and Mayers (1995); Strikwerda (1989) and Thomas (1995). The text-
books by Strikwerda (1989) and Thomas (1995) are classical, while Iserles
(2008); LeVeque (2007) and Morton and Mayers (1995) are relatively new.
With LeVeque (2007), the readers can find the accompanying Matlab code from
the author’s website.
A classic book on FE methods is Ciarlet (2002), while Johnson (1987) and
Strang and Fix (1973) have been widely used as graduate textbooks. The series
by Carey and Oden (1983) not only presents the mathematical background
of FE methods, but also gives some details on FE method programming in
Fortran. Newer textbooks include Braess (2007) and Brenner and Scott (2002).

08:59:40, subject to the Cambridge Core terms of use,


02
08:59:40, subject to the Cambridge Core terms of use,
02
Part I
Finite Difference Methods

13:34:07, subject to the Cambridge Core


13:34:07, subject to the Cambridge Core
2
Finite Difference Methods for 1D
Boundary Value Problems

2.1 A Simple Example of a Finite Difference Method


Let us consider a model problem

u′′ (x) = f (x), 0 < x < 1, u(0) = ua , u(1) = ub ,

to illustrate the general procedure using a finite difference method as follows.

1. Generate a grid. A grid is a finite set of points on which we seek the function
values that represent an approximate solution to the differential equa-
tion. For example, given an integer parameter n > 0, we can use a uniform
Cartesian grid
1
xi = i h, i = 0, 1, . . . , n, h= .
n
The parameter n can be chosen according to accuracy requirement. If we
wish that the approximate solution has four significant digits, then we can
take n = 100 or larger, for example.
2. Represent the derivative by some finite difference formula at every grid point
where the solution is unknown, to get an algebraic system of equations. Note
that for a twice differentiable function ϕ(x), we have

ϕ(x − ∆x) − 2ϕ(x) + ϕ(x + ∆x)


ϕ′′ (x) = lim .
∆x→0 (∆x)2

Thus at a grid point xi , we can approximate u′′ (xi ) using nearby function
values to get a finite difference formula for the second-order derivative
u(xi − h) − 2u(xi ) + u(xi + h)
u′′ (xi ) ≈ ,
h2

09:05:56, subject to the Cambridge Core terms of use,


03
10 Finite Difference Methods for 1D Boundary Value Problems

with some error in the approximation. In the finite difference method, we


replace the differential equation at each grid point xi by
u(xi − h) − 2u(xi ) + u(xi + h)
= f (xi ) + error,
h2
where the error is called the local truncation error and will be reconsidered
later. Thus we define the finite difference (FD) solution (an approximation)
for u(x) at all xi as the solution Ui (if it exists) of the following linear system
of algebraic equations:
ua − 2U1 + U2
= f (x1 )
h2
U1 − 2U2 + U3
= f (x2 )
h2
U2 − 2U3 + U4
= f (x3 )
h2
··· = ···
Ui−1 − 2Ui + Ui+1
= f (xi )
h2
··· = ···
Un−3 − 2Un−2 + Un−1
= f (xn−2 )
h2
Un−2 − 2Un−1 + ub
= f (xn−1 ).
h2
Note that the finite difference equation at each grid point involves solution
values at three grid points, i.e., at xi−1 , xi , and xi+1 . The set of these three
grid points is called the finite difference stencil.
3. Solve the system of algebraic equations, to get an approximate solution at
each grid point. The system of algebraic equations can be written in the
matrix and vector form
 2 1    
− h2 h2 U1 f (x1 ) − ua /h2
 1    
 2 − 22 12   U2   f (x2 ) 
 h h h    
    
 1
− h2 h2
2 1   U3   f (x3 ) 
 h2    
  =  (2.1)
 .. .. ..   .   .. 
 . . .   ..   . 
    
     
 1
− 2 1 U   f (x ) 
 h 2 h 2 h 
2 n−2   n−2 
1
h2
− h2
2 Un−1 f (xn−1 ) − ub /h 2

09:05:56, subject to the Cambridge Core terms of use,


03
2.1 A Simple Example of a Finite Difference Method 11

The tridiagonal system of linear equations above can be solved efficiently


in O(Cn) operations by the Crout or Cholesky algorithm, see for example,
Burden and Faires (2010), where C is a constant, typically C = 5 in this case.
4. Implement and debug the computer code. Run the program to get the output.
Analyze and visualize the results (tables, plots, etc.).
5. Error analysis. Algorithmic consistency and stability implies convergence of
the finite difference method, which will be discussed later. The convergence is
pointwise, i.e., lim ∥u(xi ) − Ui ∥∞ = 0. The finite difference method requires
h→0
the solution u(x) to have up to second-order continuous derivatives.

2.1.1 A Matlab Code for the Model Problem


Below we show a Matlab function called two_point.m, for the model problem,
and use this Matlab function to illustrate how to convert the algorithm to a
computer code.
function [x,U] = two_point(a,b,ua,ub,f,n)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This matlab function two_point solves the following %
% two-point boundary value problem: u''(x) = f(x) %
% using the centered finite difference scheme. %
% Input: %
% a, b: Two end points. %
% ua, ub: Dirichlet boundary conditions at a and b %
% f: external function f(x). %
% n: number of grid points. %
% Output: %
% x: x(1),x(2),...x(n-1) are grid points %
% U: U(1),U(2),...U(n-1) are approximate solution at %
% grid points %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

h = (b-a)/n; h1=h*h;

A = sparse(n-1,n-1);
F = zeros(n-1,1);

for i=1:n-2,
A(i,i) = -2/h1; A(i+1,i) = 1/h1; A(i,i+1)= 1/h1;
end
A(n-1,n-1) = -2/h1;

for i=1:n-1,
x(i) = a+i*h;
F(i) = feval(f,x(i));

09:05:56, subject to the Cambridge Core terms of use,


03
12 Finite Difference Methods for 1D Boundary Value Problems

end
F(1) = F(1) - ua/h1;
F(n-1) = F(n-1) - ub/h1;

U = A\F;

return
%%%%%--------- End of the program -------------------------

We can call the Matlab function two_point directly in a Matlab command


window, but a better way is to put all Matlab commands in a Matlab file (called
an M-file), referred to here as main.m. The advantage of this is to keep a record,
and we can also revisit or modify the file whenever we want.
To illustrate, suppose the differential equation is defined in the interval of
(0, 1), with f (x) = −π 2 cos(πx), u(0) = 0, and u(1) = −1. A sample Matlab
M-file is then as follows.
%%%%%%%% Clear all unwanted variables and graphs.
clear; close all
%%%%%%% Input

a=0; b=1; n=40;


ua=1; ub=-1;

%%%%%% Call the solver: U is the FD solution at the grid


points.

[x,U] = two_point(a,b,ua,ub,'f',n);

%%%%%%%%%%%%%%%%% Plot and show the error %%%%%%%%%%%%%%%%%%

plot(x,U,'o'); hold % Plot the computed solution

u=zeros(n-1,1);
for i=1:n-1,
u(i) = cos(pi*x(i));
end
plot(x,u) %%% Plot the true solution at the grid
%%% points on the same plot.
%%%%%%% Plot the error

figure(2); plot(x,U-u)

norm(U-u,inf) %%% Print out the maximum error.

It is easy to check that the exact solution of the BVP is cos(πx). If we plot
the computed solution, the finite difference approximation to the true solution
at the grid points (use plot(x, u, ′o′ ), and the exact solution represented by the

09:05:56, subject to the Cambridge Core terms of use,


03
2.1 A Simple Example of a Finite Difference Method 13

(a) (b)
1 × 10−4
1.5
0.8
0.6 1
0.4
0.5
0.2
0 0
−0.2
−0.4 −0.5

−0.6
−1
−0.8
−1 −1.5
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Figure 2.1. (a) A plot of the computed solution (little ‘o’s) with n = 40, and
the exact solution (solid line). (b) The plot of the error.

solid line in Figure 2.1(a), the difference at the grid points is not too evident.
However, if we plot the difference of the computed solution and the exact solu-
tion, which we call the error, we see that there is indeed a small difference of
O(10−3 ), cf. Figure 2.1(b), but in practice we may nevertheless be content with
the accuracy of the computed numerical solution.

Questions One May Ask from This Example:


• Are there other finite difference formulas to approximate derivatives? If so,
how do we derive them? The reader may have already encountered other
formulas in an elementary numerical analysis textbook.
• How do we know whether a finite difference method works or not? If it works,
how accurate is it? Specifically, what is the error of the computed solution?
• Do round-off errors affect the computed solution? If so, by how much?
• How do we deal with boundary conditions other than Dirichlet condi-
tions (involving only function values) as above, notably Neumann conditions
(involving derivatives) or mixed boundary conditions?
• Do we need different finite difference methods for different problems? If so,
are the procedures similar?
• How do we know that we are using the most efficient method? What are the
criteria, in order to implement finite difference methods efficiently?

We will address these questions in the next few chapters.

09:05:56, subject to the Cambridge Core terms of use,


03
14 Finite Difference Methods for 1D Boundary Value Problems

2.2 Fundamentals of Finite Difference Methods


The Taylor expansion is the most important tool in the analysis of finite
difference methods. It may be written as an infinite series

h2 ′′ hk
u(x + h) = u(x) + hu′ (x) + u (x) + · · · + u(k) (x) + · · · (2.2)
2 k!
if u(x) is “analytic” (differentiable to any order), or as a finite sum

h2 ′′ hk
u(x + h) = u(x) + hu′ (x) + u (x) + · · · + u(k) (ξ), (2.3)
2 k!
where x < ξ < x + h (or x + h < ξ < x if h < 0), if u(x) is differentiable up to
k-th order. The second form of the Taylor expansion is sometimes called the
extended mean value theorem. As indicated earlier, we may represent deriva-
tives of a differential equation by finite difference formulas at grid points to get
a linear or nonlinear algebraic system. There are several kinds of finite differ-
ence formulas to consider, but in general their accuracy is directly related to the
magnitude of h (typically small).

2.2.1 Forward, Backward, and Central Finite Difference


Formulas for u′ (x)
Let us first consider the first derivative u′ (x) of u(x) at a point x̄ using the
nearby function values u(x̄ ± h), where h is called the step size. There are three
commonly used formulas:
u(x̄ + h) − u(x̄)
Forward FD: ∆+ u(x̄) = ∼ u′ (x̄), (2.4)
h
u(x̄) − u(x̄ − h)
Backward FD: ∆− u(x̄) = ∼ u′ (x̄), (2.5)
h
u(x̄ + h) − u(x̄ − h)
Central FD: δu(x̄) = ∼ u′ (x̄). (2.6)
2h
Below we derive these finite difference formulas from geometric intuitions and
calculus.
From calculus, we know that
u(x̄ + h) − u(x̄)
u′ (x̄) = lim .
h→0 h

Assume |h| is small and u′ (x) is continuous, then we expect that u(x̄+h)−u(x̄)
h
is close to but usually not exactly u′ (x̄). Thus an approximation to the first

09:05:56, subject to the Cambridge Core terms of use,


03
2.2 Fundamentals of Finite Difference Methods 15

derivative at x̄ is the forward finite difference denoted and defined by


u(x̄ + h) − u(x̄)
∆+ u(x̄) = ∼ u′ (x̄) , (2.7)
h
where an error is introduced and h > 0 is called the step size, the distance
between two points. Geometrically, ∆+ u(x̄) is the slope of the secant line that
connects the two points (x̄, u(x̄)) and (x̄ + h, u(x̄ + h)), and in calculus we
recognize it tends to the slope of the tangent line at x̄ in the limit h → 0.
To determine how closely ∆+ u(x̄) represents u′ (x̄), if u(x) has second-order
continuous derivatives we can invoke the extended mean value theorem (Taylor
series) such that
1 ′′
u(x̄ + h) = u(x̄) + u′ (x̄)h + u (ξ) h2 , (2.8)
2
where 0 < ξ < h. Thus we obtain the error estimate

u(x̄ + h) − u(x̄) 1
Ef (h) = − u′ (x̄) = u′′ (ξ)h = O(h), (2.9)
h 2
so the error, defined as the difference of the approximate value and the exact
one, is proportional to h and the discretization (2.7) is called first-order accurate.
In general, if the error has the form

E(h) = Chp , p > 0, (2.10)

then the method is called p-th order accurate.


Similarly, we can analyze the backward finite difference formula

u(x̄) − u(x̄ − h)
∆− u(x̄) = , h > 0, (2.11)
h
for approximating u′ (x̄), where the error estimate is

u(x̄) − u(x̄ − h) 1
Eb (h) = − u′ (x̄) = − u′′ (ξ) h = O(h) , (2.12)
h 2
so this formula is also first-order accurate.
Geometrically (see Figure 2.2), one may expect the slope of the secant line
that passes through (x̄ + h, u(x̄ + h)) and (x̄ − h, u(x̄ − h)) is a better approxi-
mation to the slope of the tangent line of u(x̄) at (x̄, u(x̄)), suggesting that the
corresponding central finite difference formula
u(x̄ + h) − u(x̄ − h)
δu(x̄) = , h > 0, (2.13)
2h

09:05:56, subject to the Cambridge Core terms of use,


03
16 Finite Difference Methods for 1D Boundary Value Problems

Tangent line at x̄

u(x)

x̄ − h x̄ x̄ + h
Figure 2.2. Geometric illustration of the forward, backward, and central
finite difference formulas for approximating u′ (x̄).
for approximating the first-order derivative may be more accurate. In order
to get the relevant error estimate, we need to retain more terms in the Taylor
expansion:
1 1 1
u(x + h) = u(x) + hu′ (x) + u′′ (x)h2 + u′′′ (x)h3 + u(4) (x)h4 + · · · ,
2 6 24
1 1 1
u(x − h) = u(x) − hu′ (x) + u′′ (x)h2 − u′′′ (x)h3 + u(4) (x)h4 + · · · ,
2 6 24
which leads to
u(x̄ + h) − u(x̄ − h) 1
Ec (h) = − u′ (x̄) = u′′′ (x̄)h2 + · · · = O(h2 ) (2.14)
2h 6
where · · · stands for higher-order terms, so the central finite difference formula
is second-order accurate. It is easy to show that (2.13) can be rewritten as
u(x̄ + h) − u(x̄ − h) 1 ( )
δu(x̄) = = ∆+ + ∆− u(x̄).
2h 2
There are other higher-order accurate formulas too, e.g., the third-order
accurate finite difference formula
2u(x̄ + h) + 3u(x̄) − 6u(x̄ − h) + u(x̄ − 2h)
δ3 u(x̄) = . (2.15)
6h

2.2.2 Verification and Grid Refinement Analysis


Suppose now that we have learned or developed a numerical method and associ-
ated analysis. If we proceed to write a computer code to implement the method,
how do we know that our code is bug-free and our analysis is correct? One way
is by a grid refinement analysis.
Grid refinement analysis can be illustrated by a case where we know the
exact solution.1 Starting with a fixed h, say h = 0.1, we decrease h by half to
1Of course, we usually do not know it and there are other techniques to validate a computed solution to be
discussed later.

09:05:56, subject to the Cambridge Core terms of use,


03
2.2 Fundamentals of Finite Difference Methods 17

Grid refinement analysis and comparison

100

10−2

Slope of FW and BW = 1
10−4
Error

10−6

10−8

Slope of CT = 2

10−10

10−12
10−12 10−10 10−8 10−6 10−4 10−2 100
Step size h

Figure 2.3. A plot of a grid refinement analysis of the forward, backward,


and central finite difference formulas for u′ (x) using the log–log plot. The
curves for forward and backward finite difference are almost identical and
have slope one. The central formula is second-order accurate and the slope
of the plot is two. As h gets smaller, round-off errors become evident and
eventually dominant.

see how the error changes. For a first-order method, the error should decrease
by a factor of two, cf. (2.9), and for a second-order method the error should
be decrease by a factor of four, cf. (2.14), etc. We can plot the errors versus
h in a log–log scale, where the slope is the order of convergence if the scales
are identical on both axes. The forward, backward, and central finite difference
formula rendered in a Matlab script file compare.m are shown below. For exam-
ple, consider the function u(x) = sin x at x = 1, where the exact derivative is of
course cos 1. We plot the errors versus h in log–log scale in Figure 2.3, where
we see that the slopes do indeed correctly produce the convergence order. As
h decreases further, the round-off errors become dominant, which affects the
actual errors. Thus for finite difference methods, we cannot take h arbitrarily
small hoping to improve the accuracy. For this example, the best h that would

09:05:56, subject to the Cambridge Core terms of use,


03
Another random document with
no related content on Scribd:
“Reckless age!” scoffed Tavia. “When does a boy or a man ever
cease to be reckless?”
“Right-oh!” agreed Nat, looking back along the towline of the sled.
“See how he forever puts himself within the danger zone of pretty
girls. Gee! but Ned and I are a reckless team! What say, Neddie?”
“I say do your share of the pulling,” returned his brother. “Those
girls are no feather-weights, and this is up hill.”
“Oh, to be so insulted!” murmured Tavia. “To accuse us of bearing
extra flesh about with us when we all follow Lovely Lucy Larriper’s
directions, given in the Evening Bazoo. Not a pound of the
superfluous do we carry.”
“Dorothy’s getting chunky,” announced Nat, wickedly.
“You’re another!” cried Tavia, standing up for her chum. “Her lovely
curves are to be praised—oh!”
At that moment the young men ran the runners on one side of the
sled over an ice-covered stump, and the girls all joined in Tavia’s
scream. If there had not been handholds they would all three have
been ignominiously dumped off.
“Pardon, ladies! Watch your step!” Ned said. “And don’t get us
confused with your ‘beauty-talks’ business. Besides, it isn’t really
modest. I always blush myself when I inadvertently turn over to the
woman’s page of the evening paper. It is a delicate place for mere
man to tread.”
“Hooray!” ejaculated his brother, making a false step himself just
then. “Wish I had creepers on. This is a mighty delicate place for a
fellow to tread, too, my boy.”
In fact, they soon had to order the girls off the sled. The way was
becoming too steep and the side of the hill was just as slick as the
highway had been.
With much laughter and not a few terrified “squawks,” to quote
Tavia, the girls scrambled up the slope after the boys and the sled.
Suddenly piercing screams came from above them.
“Those rascals!” ejaculated Ned.
“Oh! they are sliding on this side,” cried Dorothy. “Stop them, Ned!
Please, Nat!”
“What do you expect us to do?” demanded the latter. “Run out and
catch ’em with our bare hands?”
They had come to a break in the path now and could see out over
the sloping pasture in which the boys had been sliding for an hour.
Their sled had worked a plain path down the hill; but at the foot of it
was an abrupt drop over the side of a gully. Dorothy Dale—and her
cousins, too—knew that gully very well. There was a cave in it, and
in and about that cave they had once had some very exciting
adventures.
Joe and Roger had selected the smoothest part of the pasture to
coast in, it was true; but the party of young folk just arrived could see
that it was a very dangerous place as well. At the foot of the slide
was a little bank overhanging the gully. The smaller boys had been
stopping their sled right on the brink, and with a jolt, for the watchers
could see Joe’s heelprints in the ground where the ice had been
broken away.
They could hear the boys screaming out a school song at the top
of the hill. Ned and Nat roared a command to Joe and Roger to halt
in their mad career; but the two smaller boys were making so much
noise that it was evident their cousins’ shout was not heard by them.
They came down, Joe sitting ahead on the sled with his brother
hanging on behind, the feet of the boy sitting in front thrust out to halt
the sled. But if the sled should jump over the barrier, the two reckless
boys would fall twenty feet to the bottom of the gully.
“Stop them, do!” groaned Jennie Hapgood, who was a timid girl.
It was Dorothy who looked again at the little mound on the edge of
gully’s bank. The frost had got into the earth there, for it had been
freezing weather for several days before the ice storm of the
previous night. Now the sun was shining full on the spot, and she
could see where the boys’ feet, colliding with that lump of earth on
the verge of the declivity, had knocked off the ice and bared the
earth completely. There was, too, a long crack along the edge of the
slight precipice.
“Oh, boys!” she called to Ned and Nat, who were struggling up the
hill once more, “stop them, do! You must! That bank is crumbling
away. If they come smashing down upon it again they may go over
the brink, sled and all!”
CHAPTER XVI
THE FLY IN THE AMBER

“Oh, Dorothy!” cried Tavia.


Jennie, with a shudder, buried her face in her hands.
Joe and Roger Dale were fairly flying down the hill, and would
endeavor to stop by collision with the same lump of frozen earth that
had previously been their bulwark.
“See! Ned! Nat!” cried Dorothy again. “We must stop them!”
But how stop the boys already rushing down hill on their coaster?
It seemed an impossible feat.
The White brothers dropped the towline of the big sled and
scrambled along the slippery slope toward the edge of the gully.
With a whoop of delight the two smaller boys, on their red coaster,
whisked past the girls.
“Stop them!” shrieked the three in chorus.
Ned reached the edge of the gully bank first. His weight upon the
cracking earth sent the slight barrier crashing over the brink. Just as
they had supposed there was not a possible chance of Joe’s
stopping the sled when it came down to this perilous spot.
Tavia groaned and wrung her hands. Jennie burst out crying.
Dorothy knew she could not help, yet she staggered after Ned and
Nat, unable to remain inactive like the other girls.
Ned recovered himself from the slippery edge of the bank; but by a
hair’s breadth only was he saved from being thrown to the bottom of
the gully. He crossed the slide in a bound and whirled swiftly,
gesturing to his brother to stay back. Nat understood and stopped
abruptly.
“You grab Roger—I’ll take Joe!” panted Ned.
Just then the smaller boys on the sled rushed down upon them.
Fortunately, the steeper part of the hill ended some rods back from
the gully’s edge. But the momentum the coaster had gained brought
it and its burden of surprised and yelling boys at a very swift pace,
indeed, down to the point where Ned and Nat stood bracing
themselves upon the icy ground.
“Oh, boys!” shrieked Tavia, without understanding what Ned and
Nat hoped to accomplish. “Do something!”
And the very next instant they did!
The coaster came shooting down to the verge of the gully bank.
Joe Dale saw that the bank had given way and he could not stop the
sled. Nor did he dare try to swerve it to one side.
Ned and Nat, staring at the imperilled coasters, saw the look of
fear come into Joe’s face. Ned shouted:
“Let go all holds! We’ll grab you! Quick!”
Joe was a quick-minded boy after all. He was holding the steering
lines. Roger was clinging to his shoulders. If Joe dropped the lines,
both boys would be free of the sled.
That is what he did. Ned swooped and grabbed Joe. Nat seized
upon the shrieking and surprised Roger. The sled darted out from
beneath the two boys and shot over the verge of the bank, landing
below in the gully with a crash among the icy branches of a tree.
“Wha—what did you do that for?” Roger demanded of Nat, as the
latter set him firmly on his feet.
“Just for instance, kid,” growled Nat. “We ought to have let you
both go.”
“And I guess we would if it hadn’t been for Dorothy,” added Ned,
rising from where he had fallen with Joe on top of him.
“Cracky!” gasped Joe. “We’d have gone straight over that bank
that time, wouldn’t we? Gee, Roger! we’d have broken our necks!”
Even Roger was impressed by this stated fact. “Oh, Dorothy!” he
cried, “isn’t it lucky you happened along, so’s to tell Ned and Nat
what to do? I wouldn’t care to have a broken neck.”
“You are very right, kid,” growled Nat. “It’s Dorothy ‘as does it’—
always. She is the observant little lady who puts us wise to every
danger. ‘Who ran to catch me when I fell?’ My cousin!”
“Hold your horses, son,” advised his brother, with seriousness. “It
was Dorothy who smelled out the danger all right.”
“I do delight in the metaphors you boys use,” broke in Dorothy. “I
might be a beagle-hound, according to Ned. ‘Smelled out,’ indeed!”
“Aren’t you horrid?” sighed Jennie, for they were all toiling up the
hill again.
Ned put the cup of his hand under Jennie’s elbow and helped her
over a particularly glary spot. “Boys are very good folk,” he said,
smiling down into her pretty face, “if you take them just right. But
they are explosive, of course.”
Nat, likewise helping to drag the big sled, was walking beside
Tavia. Dorothy looked from one couple to the other, smiled, and then
found that her eyes were misty.
“Why!” she gasped under her breath, “I believe I am getting to be a
sour old maid. I am jealous!”
She turned her attention to the smaller boys and they all went gaily
up the hill. Nobody was going to discover that Dorothy Dale felt blue
—not if she could possibly help it!
Over on the other side of the hill where the smooth road lay the
party had a wonderfully invigorating coasting time. They all piled
upon the double-ripper—Joe and Roger, too—and after the first two
or three slides, the runners became freed of rust and the heavy sled
fairly flew.
“Oh! this is great—great!” cried Tavia. “It’s just like flying. I always
did want to fly up into the blue empyrean——”
They were then resting at the top of the hill. Nat turned over on his
back upon the sled, struggled with all four limbs, and uttered a soul-
searching: “Woof! woof! Ow-row-row! Woof!”
“Get up, silly!” ordered Tavia. “Whenever I have any flight of fancy
you always make it fall flat.”
“And if you tried a literal flight into the empyrean—ugh!—you’d fall
flat without any help,” declared Nat. “But we don’t want you to fly
away from us, Tavia. We couldn’t get along without you.”
“‘Thank you, kindly, sir, she said,’” responded his gay little friend.
However, Tavia and Nat could be serious on occasion. This very
day as the party tramped home to luncheon, dragging the sleds,
having recovered the one from the gully, they walked apart, and
Dorothy noted they were preoccupied. But then, so were Ned and
Jennie. Dorothy’s eyes danced now. She had recovered her poise.
“It’s great fun,” she whispered to her aunt, when they were back in
the house. “Watching people who are pairing off, I mean. I know
‘which is which’ all right now. And I guess you do, too, Aunt Winnie?”
Mrs. White nodded and smiled. There was nothing to fear
regarding this intimacy between her big sons and Dorothy’s pretty
friends. Indeed, she could wish for no better thing to happen than
that Ned and Nat should become interested in Tavia and Jennie.
“But you, my dear?” she asked Dorothy, slyly. “Hadn’t we better be
finding somebody for you to walk and talk with?”
“I must play chaperon,” declared Dorothy, gaily. “No, no! I am
going to be an old maid, I tell you, Auntie dear.” And to herself she
added: “But never a sour, disagreeable, jealous one! Never that!”
Not that in secret Dorothy did not have many heavy thoughts when
she remembered Garry Knapp or anything connected with him.
“We must send those poor girls some Christmas remembrances,”
Dorothy said to Tavia, and Tavia understood whom she meant
without having it explained to her.
“Of course we will,” she cried. “You would not let me give Forty-
seven and her sister as much money as I wanted to for finding my
bag.”
“No. I don’t think it does any good to put a premium on honesty,”
Dorothy said gravely.
“Huh! that’s just what Garry Knapp said,” said Tavia, reflectively.
“But now,” Dorothy hastened to add, “we can send them both at
Christmas time something really worth while.”
“Something warm to wear,” said Tavia, more than ordinarily
thoughtful. “They have to go through the cold streets to work in all
weathers.”
It seemed odd, but Dorothy noticed that her chum remained rather
serious all that day. In the evening Nat came in with the mail bag and
dumped its contents on the hall table. This was just before dinner
and usually the cry of “Mail!” up the stairway brought most of the
family into the big entrance hall.
Down tripped Tavia with the other girls; Ned lounged in from the
library; Joe and Roger appeared, although they seldom had any
letters, only funny postal cards from their old-time chums at Dalton
and from local school friends.
Mrs. White took her mail off to her own room. She walked without
her crutch now, but favored the lame ankle. Joe seized upon his
father’s mail and ran to find him.
Nat sorted the letters out swiftly. Everybody had a few. Suddenly
he hesitated as he picked up a rather coarse envelope on which
Tavia’s name was scrawled. In the upper left-hand corner was
written: “L. Petterby.”
“Great Peter!” he gasped, shooting a questioning glance at Tavia.
“Does that cowpuncher write to you still?”
Perhaps there was something like an accusation in Nat’s tone. At
least, it was not just the tone to take with such a high-spirited person
as Tavia. Her head came up and her eyes flashed. She reached for
the letter.
“Isn’t that nice!” she cried. “Another from dear old Lance. He’s
such a desperately determined chap.”
At first the other young folk had not noted Nat’s tone or Tavia’s
look. But the young man’s next query all understood:
“Still at it, are you, Tavia? Can’t possibly keep from stringing ’em
along? It’s meat and drink to you, isn’t it?”
“Why, of course,” drawled Tavia, two red spots in her cheeks.
She walked away, slitting Lance Petterby’s envelope as she went.
Nat’s brow was clouded, and all through dinner he said very little.
Tavia seemed livelier and more social than ever, but Dorothy
apprehended “the fly in the amber.”
CHAPTER XVII
“DO YOU UNDERSTAND TAVIA?”

“You got this old timer running round in circles, Miss Tavia, when
you ask about a feller named Garford Knapp anywhere in this
latitude, and working for a feller named Bob. There’s more ‘Bobs’
running ranches out here than there is bobwhites down there East
where you live. Too bad you can’t remember this here Bob’s last
name, or his brand.
“Now, come to think, there was a feller named ‘Dimples’ Knapp
used to be found in Desert City, but not in Hardin. And you ought to
see Hardin—it’s growing some!”

This was a part of what was in Lance Petterby’s letter. Had Nat
White been allowed to read it he would have learned something else
—something that not only would have surprised him and his brother
and cousin, but would have served to burn away at once the debris
of trouble that seemed suddenly heaped between Tavia and himself.
It was true that Tavia had kept up her correspondence with the
good-natured and good-looking cowboy in whom, while she was
West, she had become interested, and that against the advice of
Dorothy Dale. She did this for a reason deeper than mere mischief.
Lance Petterby had confided in her more than in any of the other
Easterners of the party that had come to the big Hardin ranch. Lance
was in love with a school teacher of the district while the party from
the East was at Hardin; and now he had been some months married
to the woman of his choice.
When Tavia read bits of his letters, even to Dorothy, she skipped
all mention of Lance’s romance and his marriage. This she did, it is
true, because of a mischievous desire to plague her chum and Ned
and Nat. Of late, since affairs had become truly serious between Nat
and herself, she would have at any time explained the joke to Nat
had she thought of it, or had he asked her about Lance.
The very evening previous to the arrival of this letter from the
cowpuncher to which Nat had so unwisely objected, Nat and Tavia
had gone for a walk together in the crisp December moonlight and
had talked very seriously.
Nat, although as full of fun as Tavia herself, could be grave; and
he made his intention and his desires very plain to the girl. Tavia
would not show him all that was in her heart. That was not her way.
She was always inclined to hide her deeper feelings beneath a light
manner and light words. But she was brave and she was honest.
When he pinned her right down to the question, yes or no, Tavia
looked courageously into Nat’s eyes and said:
“Yes, Nat. I do. But somebody besides you must ask me before I
will agree to—to ‘make you happy’ as you call it.”
“For the good land’s sake!” gasped Nat. “Who’s business is it but
ours? If you love me as I love you——”
“Yes, I know,” interrupted Tavia, with laughter breaking forth. “‘No
knife can cut our love in two.’ But, dear——”
“Oh, Tavia!”
“Wait, honey,” she whispered, with her face close pressed against
his shoulder. “No! don’t kiss me now. You’ve kissed me before—in
fun. The next time you kiss me it must be in solemn earnest.”
“By heaven, girl!” exclaimed Nat, hoarsely. “Do you think I am
fooling now?”
“No, boy,” she whispered, looking up at him again suddenly. “But
somebody else must ask me before I have a right to promise what
you want.”
“Who?” demanded Nat, in alarm.
“You know that I am a poor girl. Not only that, but I do not come
from the same stock that you do. There is no blue blood in my
veins,” and she uttered a little laugh that might have sounded bitter
had there not been the tremor of tears in it.
“What nonsense, Tavia!” the young man cried, shaking her gently
by the shoulders.
“Oh no, Nat! Wait! I am a poor girl and I come of very, very
common stock. I don’t mean I am ashamed of my poverty, or of the
fact that my father and mother both sprang from the laboring class.
“But you might be expected when you marry to take for a wife a
girl from a family whose forebears were something. Mine were not.
Why, one of my grandfathers was an immigrant and dug ditches
——”
“Pshaw! I had a relative who dug a ditch, too. In Revolutionary
times——”
“That is it exactly,” Tavia hastened to say. “I know about him. He
helped dig the breastworks on Breeds Hill and was wounded in the
Battle of Bunker Hill. I know all about that. Your people were Pilgrim
and Dutch stock.”
“Immigrants, too,” said Nat, muttering. “And maybe some of them
left their country across the seas for their country’s good.”
“It doesn’t matter,” said the shrewd Tavia. “Being an immigrant in
America in sixteen hundred is one thing. Being an immigrant in the
latter end of the nineteenth century is an entirely different pair of
boots.”
“Oh, Tavia!”
“No. Your mother has been as kind to me—and for years and
years—as though I were her niece, too, instead of just one of
Dorothy’s friends. She may have other plans for her sons, Nat.”
“Nonsense!”
“I will not answer you,” the girl cried, a little wildly now, and began
to sob. “Oh, Nat! Nat! I have thought of this so much. Your mother
must ask me, or I can never tell you what I want to tell you!”
Nat respected her desire and did not kiss her although she clung,
sobbing, to him for some moments. But after she had wiped away
her tears and had begun to joke again in her usual way, they went
back to the house.
And Nat White knew he was walking on air! He could not feel the
path beneath his feet.
He was obliged to go to town early the next morning, and when he
returned, as we have seen, just before dinner, he brought the mail
bag up from the North Birchland post-office.
He could not understand Tavia’s attitude regarding Lance
Petterby’s letter, and he was both hurt and jealous. Actually he was
jealous!
“Do you understand Tavia?” he asked his cousin Dorothy, right
after dinner.
“My dear boy,” Dorothy Dale said, “I never claimed to be a seer.
Who understands Tavia—fully?”
“But you know her better than anybody else.”
“Better than Tavia knows herself, perhaps,” admitted Dorothy.
“Well, see here! I’ve asked her to marry me——”
“Oh, Nat! my dear boy! I am so glad!” Dorothy cried, and she
kissed her cousin warmly.
“Don’t be so hasty with your congratulations,” growled Nat, still red
and fuming. “She didn’t tell me ‘yes.’ I don’t know now that I want her
to. I want to know what she means, getting letters from that fellow
out West.”
“Oh, Nat!” sighed Dorothy, looking at him levelly. “Are you sure you
love her?”
He said nothing more, and Dorothy did not add a word. But Tavia
waited in vain that evening for Mrs. White to come to her and ask the
question which she had told Nat his mother must ask for him.
CHAPTER XVIII
CROSS PURPOSES

Tavia was as loyal a girl as ever stepped in shoe-leather. That was


an oft-repeated expression of Major Dale’s. He loved “the flyaway”
for this very attribute.
Tavia was now attempting to bring joy and happiness for Dorothy
out of chaos. Therefore, she felt she dared take nobody into her
confidence regarding Lance Petterby’s letter.
She replied to Lance at once, explaining more fully about Garry
Knapp, the land he was about to sell, and the fact that Eastern
schemers were trying to obtain possession of Knapp’s ranch for
wheat land and at a price far below its real worth.
Satisfaction, Tavia might feel in this attempt to help Dorothy; but
everything else in the world was colored blue—very blue, indeed!
When one’s ear has become used to the clatter of a noisy little
windmill, for instance, and the wind suddenly ceases and it remains
calm, the cessation of the mill’s clatter is almost a shock to the
nerves.
This was about the way Tavia’s sudden shift of manner struck all
those observant ones at The Cedars. As the season of joy and
gladness and good-will approached, Tavia Travers sank lower and
lower into a Slough of Despond.
Had it not been for Dorothy Dale, the others must have audibly
remarked Tavia’s lack of sparkle. Though Dorothy did not imagine
that Tavia was engaged in any attempt to help her, and because of
that attempt had refused to explain Lance Petterby’s letter to Nat
White, yet she loyally began to act as a buffer between the others
and the contrary Tavia. More than once did Dorothy fly to Tavia’s
rescue when she seemed to be in difficulties.
Tavia had a streak of secrecy in her character that sometimes
placed her in a bad light when judged by unknowing people. Dorothy,
however, felt sure that on this present occasion there was no real
fault to be found with her dear friend.
Nat refused to speak further about his feeling toward Tavia;
Dorothy knew better than to try to tempt Tavia herself to explain. The
outstanding difficulty was the letter from the Westerner. Feeling sure,
as she did, that Tavia liked Nat immensely and really cared nothing
for any other man, Dorothy refrained from hinting at the difficulty to
her chum. Let matters take their course. That was the better way,
Dorothy believed. She felt that Nat’s deeper affections had been
moved and that only the surface of his pride and jealousy were
nicked. On the other hand she knew Tavia to be a most loyal soul,
and she could not imagine that there was really any cause, other
than mischief, for Tavia to allow that letter to stand between Nat and
herself.
To smooth over the rough edges and hide any unpleasantness
from the observation of the older members of the family, Dorothy
became very active in the social life of The Cedars again. No longer
did she refuse to attend the cousins and Jennie and Tavia in any
venture. It was a quintette of apparently merry young people once
more; never a quartette. Nor were Nat and Tavia seen alone together
during those few short weeks preceding Christmas.
Secretly, Dorothy was very unhappy over the misunderstanding
between her chum and Nat. That it was merely a disagreement and
would not cause a permanent break between the two was her dear
hope. For she wished to see them both happy. Although at one time
she thought the steadier Ned, the older cousin, might be a better
mate for her flyaway friend, she had come to see it differently of late.
If anybody could understand and properly appreciate Tavia Travers it
was Nathaniel White. His mind, too, was quick, his imagination
colorful. Dorothy Dale, with growing understanding of character and
the mental equipment to judge her associates better than most girls,
or young women, of her age, believed in her heart that neither Tavia
nor Nat would ever get along with any other companion as well as
the two could get along together.
The two “wildfires,” as Aunt Winnie sometimes called them, had
always had occasional bickerings. But a dispute is like a
thunderstorm—it usually clears the air.
Nor did Dorothy doubt for a moment that her cousin and her friend
were deeply in love now, the one with the other. That Tavia had
turned without explanation about Lance Petterby’s letter from Nat
and that the latter had told Dorothy he was not sure he wished Tavia
to answer the important question he had put to her, sprang only from
pique on Nat’s side, and, Dorothy was sure, from something much
the same in her chum’s heart.
Light-minded and frivolous as Tavia had always appeared, Dorothy
knew well that the undercurrent of her chum’s feelings was both
deep and strong. Where she gave affection Tavia herself would have
said she “loved hard!”
Dorothy had watched, during these past few weeks especially, the
intimacy grow between her chum and Nat White. They were bound
to each other, Dorothy believed, by many ties. Disagreements did
not count. All that was on the surface. Underneath, the tide of their
feelings intermingled and flowed together. She could not believe that
any little misunderstanding could permanently divide Tavia and Nat.
But they were at cross purposes—that was plain. Nat was irritated
and Tavia was proud. Dorothy knew that her chum was just the sort
of person to be hurt most by being doubted.
Nat should have understood that if Tavia had given him reason to
believe she cared for him, her nature was so loyal that in no
particular could she be unfaithful to the trust he placed in her. His
quick appearance of doubt when he saw the letter from the West had
hurt Tavia cruelly.
Yet, Dorothy Dale did not try to make peace between the two by
going to Nat and putting these facts before him in the strong light of
good sense. She was quite sure that if she did so Nat would come to
terms and beg Tavia’s pardon. That was Nat’s way. He never took a
middle course. He must be either at one extreme of the pendulum’s
swing or the other.
And Dorothy was sure that it would not be well, either for Nat or for
Tavia, for the former to give in without question and shoulder the
entire responsibility for this lover’s quarrel. For to Dorothy Dale’s
mind there was a greater shade of fault upon her chum’s side of the
controversy than there was on Nat’s. Because of the very fact that all
her life Tavia had been flirting or making believe to flirt, there was
some reason for Nat’s show of spleen over the Petterby letter.
Dorothy did not know what had passed between Tavia and Nat the
evening before the arrival of the letter. She did not know what Tavia
had demanded of Nat before she would give him the answer he
craved.
Nat kept silence. Mrs. White did not come to Tavia and ask the
question which meant so much to the warm-hearted girl. Tavia
suffered in every fiber of her being, but would not betray her feelings.
And Dorothy waited her chance to say something to her chum that
might help to clear up the unfortunate state of affairs.
So all were at cross purposes, and gradually the good times at
The Cedars became something of a mockery.
CHAPTER XIX
WEDDING BELLS IN PROSPECT

Four days before Christmas Dorothy Dale, her cousins, and Tavia
all boarded the train with Jennie Hapgood, bound for the latter’s
home in Pennsylvania. On Christmas Eve Jennie’s brother Jack was
to be married, and he had written jointly with the young lady who was
to be “Mrs. Jack” after that date, that the ceremony could not
possibly take place unless the North Birchland crowd of young folk
crossed the better part of two states, to be “in at the finish.”
“Goodness me,” drawled Tavia, when this letter had come from
Sunnyside Farm. “He talks as though wedded bliss were something
like a sentence to the penitentiary. How horrid!”
“It is. For a lot of us men,” Nat said, grinning. “No more stag
parties with the fellows for one thing. Cut out half the time one might
spend at the club. And then, there is the pocket peril.”
“The—the what?” demanded Jennie. “What under the sun is that?”
“A new one on me,” said Ned. “Out with it. ’Thaniel. What is the
‘pocket peril’?”
“Why, after a fellow is married they tell me that he never knows
when he puts his hand in his pocket whether he will find money there
or not. Maybe Friend Wife has beaten him to it.”
“For shame!” cried Dorothy. “You certainly deserve never to know
what Tavia calls ’wedded bliss.’”
“I have my doubts as to my ever doing so,” muttered Nat, his face
suddenly expressing gloom; and he marched away.
Jennie and Ned did not observe this. Indeed, it was becoming so
with them that they saw nobody but each other. Their infatuation was
so plain that sometimes it was really funny. Yet even Tavia, with her
sharp tongue, spared the happy couple any gibes. Sometimes when
she looked at them her eyes were bright with moisture. Dorothy saw
this, if nobody else did.
However, the trip to western Pennsylvania was very pleasant,
indeed. Dorothy posed as chaperon, and the boys voted that she
made an excellent one.
The party got off gaily; but after a while Ned and Jennie slipped
away to the observation platform, cold as the weather was, and Nat
plainly felt ill at ease with his cousin and Tavia. He grumbled
something about Ned having become “an old poke,” and sauntered
into another car, leaving Tavia alone with Dorothy Dale in their
compartment. Almost at once Dorothy said to her chum:
“Tavia, dear, are you going to let this thing go on, and become
worse and worse?”
“What’s that?” demanded Tavia, a little tartly.
“This misunderstanding between you and Nat? Aren’t you risking
your own happiness as well as his?”
“Dorothy——”
“Don’t be angry, dear,” her chum hastened to say. “Please don’t. I
hate to see both you and Nat in such a false position.”
“How false?” demanded Tavia.
“Because you are neither of you satisfied with yourselves. You are
both wrong, perhaps; but I think that under the circumstances you,
dear, should put forth the first effort for reconciliation.”
“With Nat?” gasped Tavia.
“Yes.”
“Not to save my life!” cried her friend. “Never!”
“Oh, Tavia!”
“You take his side because of that letter,” Tavia said accusingly.
“Well, if that’s the idea, here’s another letter from Lance!” and she
opened her bag and produced an envelope on which appeared the
cowboy’s scrawling handwriting. Dorothy knew it well.
“Oh, Tavia!”
“Don’t ‘Oh, Tavia’ me!” exclaimed the other girl, her eyes bright
with anger. “Nobody has a right to choose my correspondents for
me.”
“You know that all the matter is with Nat, he is jealous,” Dorothy
said frankly.
“What right has he to be?” demanded Tavia in a hard voice, but
looking away quickly.
“Dear,” said Dorothy softly, laying her hand on Tavia’s arm, “he told
me he—he asked you to marry him.”
“He never!”
“But you knew that was what he meant,” Dorothy said shrewdly.
Tavia was silent, and her friend went on to say:
“You know he thinks the world of you, dear. If he didn’t he would
not have been angered. And I do think—considering everything—
that you ought not to continue to let that fellow out West write to you
——”
Tavia turned on her with hard, flashing eyes. She held out the
letter, saying in a voice quite different from her usual tone:
“I want you to read this letter—but only on condition that you say
nothing to Nat White about it, not a word! Do you understand,
Dorothy Dale?”
“No,” said Dorothy, wondering. “I do not understand.”
“You understand that I am binding you to secrecy, at least,” Tavia
continued in the same tone.
“Why—yes—that,” admitted her friend.
“Very well, then, read it,” said Tavia and turned to look out of the
window while Dorothy withdrew the closely written, penciled pages
from the envelope and unfolded them.
In a moment Dorothy cried aloud:

You might also like