two-point boundary value problems - computer science at rpi

41

Upload: others

Post on 04-Feb-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Part TwoPoint Boundary ValueProblems

Chapter

Fundamental Problems and Methods

Problems to be Solved

Several problems arising in science and engineering are modeled by dierential equations

that involve conditions that are specied at more than one point Some examples follow

PP

s θ

1

Figure Deformation of an elastica

r

u

u

u

z

Ω

θ

r

z

Figure Swirling ow above a rotating disk

Deformation of an Elastica The transverse deformation of a thin elastic inexten

sional rod subjected to an axial loading and clamped at its ends is governed by the

dierential systemd

ds P sin s

As shown in Figure the rod has unit length the magnitude of the loading

is P and is the angle that the deformed rod makes with the initial undeformed

axis This classical secondorder nonlinear twopoint boundary value problem is

called the elastica problem One solution is This solution however becomes

unstable as P increases and the rod bends into a deformed shape as shown in Figure

Hence this boundary value problem is also a dierential eigenvalue problem

that consists of determining theta and the critical load P for deformed shapes to

exist Once has been determined the Cartesian coordinates of a deformed point

on the rod can be determined as the solution of the initial value problems

dx

ds cos

dy

ds sin

x y

Swirling Flow The swirling ow of a viscous incompressible uid over a disk

spinning with speed Figure can be analyzed by solving the nonlinear

twopoint boundary value problem

df

dx f

df

dx

df

dx g

dg

dx f

dg

dx

df

dxg x

f df

dx g

limx

df x

dx lim

xg x

where is the Rosby number The dimensionless variable x is related to the axial

coordinate z Figure by

x z

r

where is the kinematic viscosity The radial tangential and axial components of

the velocity vector respectively are obtained from the functions f x and g x as

ur rdf x

dx u rg x uz f x

p

This problem involves a boundary value problem for a pair of secondorder nonlinear

ODEs An interesting feature of this problem is that one of the boundaries is at

innity

As indicated in these two examples boundary value problems BVPs have several

forms The two that will be most important to us are

A vector system of rstorder equations

y x f xy x

where y dydx and y and f are mdimensional vectors We have changed the

independent variable from t to x since it frequently corresponds to a spatial position

rather than time

A scalar m thorder dierential equation

um g x u u um

Naturally the higherorder scalar problem can be reduced to a rstorder vector

system as described in Section however it may sometimes be convenient to work

with the higherorder scalar problem

Focusing on the vector system for the moment if

f xy A xy b x

the ODE is linear otherwise it is nonlinear

If is to be solved on a x b then m conditions are needed to uniquely

determine the solution of the BVP These may be of the general form

g y ay b a

where g has dimension m For the most part we will consider simpler boundary condi

tions having the form

gL y a gR y b b

where gL has dimension l and gR has dimension r m l Conditions of the form

b are called separated while the more general form a are unseparated

Linear versions of a and b have the forms

Ly a Ry b c a

and

LLy a cL RRy b cR b

The matrices L and R are of dimension mm and the vector c is mdimensional For

the separated conditions b LL is lmdimensional RR is rmdimensional cL

is ldimensional and cR is rdimensional

There are three standard numerical approaches to solving twopoint boundary value

problems

Shooting An appropriate IVP is dened and solved by initial value techniques and

software The IVP is dened so that solutions iteratively converge to the solution

of the original BVP

Finite Dierences A mesh is introduced on a b and derivatives in the ODE are

replaced by nitedierences relative to the mesh This leads to a linear or nonlinear

algebraic problem which may be solved to produce a discrete approximation of the

solution of the BVP

Projections The solution of the BVP is approximated by simpler functions eg

piecewise polynomials and the dierential equations and boundary conditions are

satised approximately Collocation or nite element techniques often furnish these

approximations

In the next three Sections we illustrate the basic ideas of these methods by using

simple BVPs

Introduction to Shooting

Let us consider a secondorder nonlinear twopoint BVP

u x f x u u a x b u a A u b B

Writing the ODE as a rstorder system let us also consider the related IVP

y y y a A a

y f x y y y a b

In what follows well need to emphasize the dependence of the solution on the parameter

appearing in the initial conditions so well write the solution of as yk x

k

Solutions of satisfy the original dierential equation and the initial condition

at x a but fail to satisfy the terminal condition at x b Thus shooting consists of

repeatedly solving for dierent choices of until the terminal condition

y b B

is also satised Regarding as a nonlinear function of convergence to the

solution of the BVP can be enhanced by using an iterative strategy for nonlinear algebraic

equations Secant and Newton iteration are two possible procedures Let us illustrate

the simpler secant method rst

Solve the IVP for two choices of say and The corresponding

solutions y x and y x may appear as illustrated in Figure The

various choices of alter the initial slope y a y a Regarding the solution

y x as the trajectory of a projectile red from a cannon at x a y a A

the problem is to alter the initial angle of the cannon so that the projectile hits a

target at at x b y a B hence the name shooting

Assuming that y b is locally a linear function of we use the two values

y b and y b to compute the next value in the sequence thus is the

B

A

b x

y

a

y (b;

y (b;

1

1

1α )

α )1

0

α1

α0

Figure Solutions y x and y x of the IVP y (b;

α α

α)

0 1

1

y (b;1

y (b;1

α )

α )

0

1

B

xα2

Figure Secant method of using two guesses and to select another guess

such that y b B

solution of Figure

y bB

y b y b

Solving for yields

y b B

y b y b

This can be repeated to yield the general relation

y b B

y b y b

The iteration may be terminated when eg

y b B

B

for a prescribed value of Other termination criteria should be used when B

Remark If the ODE is linear then y b is a linear function of and y x is

the exact solution neglecting round o errors of the BVP

The nonlinear equation can also be solved by Newtons method If for exam

ple is a suciently close guess to the solution of then the next guess may

be generated as

y bByb

An expression for y b may be obtained by dierentiating the IVP with

respect to to obtain

y

y

y a

a

y

f x y y

y

y

f x y y

y

y

y a

b

These equations are linear in the partial derivatives y and y

An algorithm for performing shooting with Newtons method is shown in Figure

In order to simplify the notation let

z y

z y

In order to solve the IVP functions to evaluate fy and fy must be available

In contrast the secant method only requires knowledge of f In fact the secant method

can be viewed as an approximation of Newtons method with backward

procedure newtonbegin

Select an initial guess repeat

Solve the IVP for x a by y y a Ay f x y y y a z z z a z fy x y yz fy x y yz z a

if not converged then

begin

yb Bzb

end

until convergedend

Figure The shooting method for solving with Newton iteration

dierences replacing y b For secondorder BVPs Newtons method requires

the solution of a fourdimensional IVP while the secant method only requires a two

dimensional IVP

Convergence of Newtons method is generally secondorder quadratic ie

j j Cj j

where is the value of that satises the terminal condition Convergence of

the secant method is slightly slower typically

j j Cj j

Thus the secant method would generally be preferred to Newtons method This how

ever may not be the case with higherdimensional BVPs

Example Consider the solution of the clamped elastica problem

P sin

by shooting methods using Newton iteration Symmetry considerations have been used

to cut the domain of the problem illustrated in Figure in half

Letting

y y

we introduce the IVP

y y y

y P sin y y

Dierentiating this system with respect to yields

z z z

z Pz cos y z

where zk k satises Iterates are computed by the relation

y

z

Using a convergence test of

jy j

we found that Newtons method converged in ve iterations when P and

Introduction to Finite Dierence Methods

Well again use the secondorder scalar nonlinear twopoint boundary value problem

y x f x y y a x b y a A y b B

to describe the essential details of nite dierence methods

To begin we divide the domain a x b into N uniform subintervals of width

h b a

N a

as shown in Figure Restriction to uniform subintervals is not essential but is

introduced here for simplicity We also let

xi a ih i N b

x x

x

a = x

y

y = A

h

y(x )

yy

N0 1x = b

0

1

1

1N

y = B

i

Figure Domain discretization and notation used for nite dierence solutions of

In solving the BVP by nite dierences all derivatives are replaced by nite

dierence approximations These can be constructed from interpolating polynomials but

well illustrate a dierent approach using Taylors series expansions of the solution y x

Thus consider

y x y xi x xiy xi

x xi

y xi

x xik

kyk

where is between xi and x Specically choosing x xi xi h yields

y xi y xi hy xi h

y xi

h

y xi

hk

kyk i a

Similarly selecting x xi xi h produces

y xi y xi hy xi h

y xi h

y xi

hkk

yk i b

Setting k in a and solving for y xi yields

y xi y xi y xi

h h

y i a

Finite dierence approximations are obtained by neglecting the error term of the Taylors

series thus the rst forward nite dierence approximation of y xi is

yi yi yi

h b

and the local discretization error of this approximation is

i h

y i c

Subscripts on y denote nite dierence approximations hence yi denotes an approxima

tion of y xi etc

In a similar manner the rst backward dierence approximation of y xi is obtained

by setting k in b

yi yi yi

h i

h

y i

Notice however that a higherorder and symmetric dierence approximation can be

obtained by subtracting b from a and setting k to get

y xi y xi hy xi h

y i

Solving for y xi

yi yi yi

h i h

y i

The dierence formula is called the rst central dierence approximation of y xi

In Chapter we found that this approximation led to the leap frog scheme which had

poor stability characteristics Here with secondorder ODEs central dierences will

generally be preferred to either forward or backward dierences because of their higher

order local discretization errors

Remark The higherorder accuracy of relative to or only

occurs on a uniform mesh With nonuniform spacing the second derivative terms in

a and b would not cancel upon subtraction

A central dierence approximation of the second derivative y xi is obtained by

adding a and b while setting k to obtain

yi yi yi yi

h i h

yiv i

No further approximations are needed to solve by nite dierences however

we note that approximations of higher derivatives are obtained by using Taylors series

at more points For example consider evaluating the Taylors series at x xi

and xi to obtain

y xi y xi hy xi hy xi h

y xi

h

yiv xi a

and

y xi y xi hy xi hy xi h

y xi

h

yiv xi b

Subtracting b from a yields

y xi y xi hy xi h

y xi O h

A similar subtraction of b from a yields

y xi y xi hy xi h

y xi O h

Elimination of the rst derivative term yields a central dierence approximation of the

third derivative as

yi yi yi yi yi

h

The local discretization error i O h

Similar combinations of and yield an O h central dierence approxi

mation of the fourth derivative as

yivi yi yi yi yi yi

h

Now let us return to the task of solving by nite dierence approximations

Well try centraldierence approximations because of their higher order Thus evaluat

ing at x xi and replacing derivatives by central dierences using a and

a we obtain

yi yi yih

f xi yiyi yi

h a

Writing a at each interior mesh point i N and using the two

boundary conditions

y A yN B b

gives a system of N nonlinear algebraic equations in the N unknowns yi i

N This system is too complex for an introductory example so let us conne

our attention to linear problems with

f x y y p xy q xy r x

In this case the approximation a becomes

yi yi yih

piyi yi

h qiyi ri i N

where pi p xi etc Referring to this as the centraldierence approximation of the

ODE we dene the local discretization error as follows

Denition Consider an ODE in the form Ly x and let Lhy be a dierence

approximation of it with L and Lh being dierential and dierence operators The local

discretization error or the local truncation error at x xi is

i Lhy xi

Example The dierential and dierence operators for the linear ODE

satisfy

Ly x y p xy q xy r x

and

Lhy xi y xi y xi y xi

h p xi

y xi y i

h q xiy xi r xi

Using and we nd

i y xi h

yiv i p xiy

xi h

y i q xiy xi r xi

Using the dierential equation

i h

yiv i p xi

h

y i

Thus as we might have expected the local discretization of the central dierence ap

proximation of is O h

The algebraic system b is linear for the linear BVP b

and may be solved by eg Gaussian elimination Towards this end let us write

in the form

biyi aiyi ciyi hri i N a

where

bi h

pi ai hqi ci

h

pi b

The boundary conditions b may be used in conjunction with a to create

a system of dimension N or used to explicitly eliminate y and yN as unknowns from

a The latter approach is preferred for simple problems like this one Thus using

b with a when i we nd

ay cy hr bA a

Similarly using b with a when i N yields

bNyN aNyN hrN cNB b

Grouping the N equations a b and a i N

yields

Ay f a

where

A

a cb a c

bN aN cNbN aN

b

y

yy

yN

f

hr bAhr

hrNhrN cNB

c

The linear algebraic problem requires the solution of a tridiagonal system to

determine the N unknowns yi i N The basic solution strategy is

Gaussian elimination Pivoting is frequently unnecessary As seen from b A will

be diagonally dominant unless jp xj is large relative to jq xj or h is too small Pivoting

and other special treatment may be necessary in these exceptional situations Let us

proceed without pivoting and write A in the slightly more general form

A

a cb a c

bn an cnbn an

a

where in our case n N We factor A as

A LU b

where L is a lower triangular matrix and U is an upper triangular matrix Having

performed this factorization we write a as

LUy f

let

Uy z c

and solve

Lz f d

Since L is lower triangular d may be solved for z by forward substitution Know

ing z we determine y by solving c by backward substitution All that remains is

the determination of L andU Let us hypothesize that they have the following bidiagonal

forms

L

n

U

n nn

Using with ab we nd

a a

i bii b

i ai ii i n c

i ci i n d

Using a and d we nd the forward substitution step to be

z f a

zi fi izi i n b

Similarly using b and c the backward substitution step is

yn znn a

yi zi iyii i n n b

The solution procedure dened by is the basis of the famous tridiag

onal algorithm We state it as a pseudoPASCAL algorithm in Figure The version

implemented in Figure overwrites ai bi and ci with i i and i to reduce stor

age By counting we see that the algorithm requires approximately n multiplications or

divisions and n additions and subtractions The work required to factor a full matrix

by Gaussian elimination is approximately n Thus the ratio of the work to factor

a tridiagonal matrix to that of a full matrix is approximately n This is a signif

icant savings even for small matrices and one should never use a Gaussian elimination

procedure for full matrices to solve a tridiagonal system

Example Evidence from the Taylors series expansion would suggest that the

global error of the nite dierence solution of the BVP b has an

Procedure tridi n integer var ab c f y array n of realbegin

f Factorization gfor i to n do

begin

bi biaiai ai bici

end

f Forward substitution gy ffor i to n do yi fi biyi

f Backward substitution gyn ynanfor i n downto do yi yi ciyiai

end

Figure Tridiagonal algorithm

expansion in even powers of h beginning with O h terms Lets assume that this is the

case Then Richardsons extrapolation can be used to both estimate the global error

and to improve the solution To this end we calculate two solutions using dierent step

sizes of eg h and h In order to emphasize the dependence of the discrete solution

on step size let yhi denote the nite dierence solution yi at xi a ih obtained with

step size h With the assumed error dependence we have

y a ih yhi Ch O h

and

y a ih yhi C

h

O h

The variable yhi is the nite dierence solution at a i h a ih

Subtracting the two error equations to eliminate the exact solution yields

Ch

y

hi yhi O h

Using this result we estimate the error in the ner grid solution as

y a ih yhi y

hi yhi

Furthermore

yhi y

hi

yhi yhi

i N

is an O h approximation of the solution

Let us apply Richardsons extrapolation to the simple BVP

y y y y

This problem has the form of with p x r x and q x Thus the

elements of the tridiagonal system are

ai h i N

bi i N ci i N

Centraldierence solutions with h the solution by Richardsons extrapo

lation and the exact solution

y x sinhx

sinh

are shown in Table Using the error at x as a measure of accuracy we have

jy y j

jy y j

jy y j

jy y j

These results indicate that

the global error of the centered nite dierence solution is approximately O h

since decreasing h by onehalf quarters the error and

Richardsons extrapolation furnishes a good approximation of the error while also

improving accuracy

i xi y xi yhi yhi yhi

Table Solution of Example using central dierence approximations andRichardsons extrapolation

As a next step let us consider a linear BVP with a prescribed Robin boundary

condition eg

y p xy q xy r x a x b a

y a A b

y b Cy b B c

As distinct from the Dirichlet conditions used in y b is now an unknown We

could approximate y b by backward dierences and use the discrete version of the

terminal condition c to determine an approximation of y b however this has

some drawbacks If rstorder backward dierences were used to approximate y b

xa = x

y

y = A

h

0 1

0

x = bN

x

xxN+1N-1

Figure Domain and discretization used to approximate a Robin terminal condition

then the boundary condition c would only be accurate to O h while the discrete

approximation of the ODE a is accurate to O h If higherorder backward

dierences were used to approximate y b then the tridiagonal structure of the discrete

system would be lost

The usual strategy is to introduce a ctitious external point xN b h as shown

in Figure Extending the solution to this exterior point we use central dierences

to approximate the terminal condition c to O h as

yN yNh

CyN B a

This does little to solve the problem since weve introduced both another equation

a and another unknown yN The additional equation that we need is the central

dierence approximation of the ODE a at x xN Thus using a with

i N we have

bNyN aNyN cNyN hrN b

Once again It is common to eliminate yN by combining a and b to

obtain

bN cNyN aN hCcNyN hrN hcNB c

Observing that bN cN by use of b we obtain the tridiagonal system

a cb a c

bN aN cN aN hCcN

yyyN

hr bAhr

hrNhrN hcNB

which may be solved by the tridiagonal algorithm of Figure

Now let us return to the original nonlinear problem Most iterative schemes

for solving nonlinear algebraic equations can be used to determine the solution but well

illustrate the use of Newtons method which is the most popular To begin let us write

the nite dierence system a in the form

Fi y yi yi yi hf xi yiyi yi

h i N

subject to the Dirichlet boundary conditions b and the denition of the vector of

unknowns y given by c

Newtons iteration involves solving

Fy y y y F y a

where

F y

F yF y

FN y

Fy y

Fy

Fy

FyN

Fy

Fy

FyN

FN

y

FN

y FN

yN

b

Dierentiating the Jacobian Fy y is

Fi

yj

hfy

if j i

h fy if j i

hfy

if j i

otherwise

Letting

bi

h

f

y xi y

i

yi y

i

h a

ai h

f

y xi y

i

yi y

i

h b

ci h

f

y xi y

i

yi y

i

h c

gives

Fy y

a c

b a

c

bN a

N c

N

bN aN

d

Each Newton iteration requires the solution of a tridiagonal system The Jacobian of

this system need not be reevaluated and factored after each Newton step thus only the

forward and backward substitution steps of the tridiagonal algorithm shown in Figure

need be performed at each iterative step The derivatives fy and fy can

be approximated by nite dierences

Convergence of Newtons method is typically quadratic except at a bifurcation point

where it is often linear The use of nite dierence approximations in the Jacobian also

slows the convergence rate

Example Consider the elastica problem described in Section and repeated

here using the notation of this Section as

y P sin y y y

Hence

f x y y P sin y

f

y P cos y

f

y

and

bi c

i a

i hP cos y

i

Using the convergence criteria that

jjF yjj maxiN

jFi yj

and setting P we found the number of Newton iterations and solution at x

to be as recorded in Table The number of Newton iterations decreases as the mesh

becomes ner This is a result of the solution appearing to be smoother The convergence

rate seems to be nearly quadratic

h K i yi

Table Number of iterations K to reach convergence and the approximate solutionat x for Example

The development and description of nite dierence equations may be simplied by

introducing a set of nite dierence operators as shown in Table

The next several examples illustrate some applications of these nite dierence oper

ators

Example The centered dierence formula can be expressed in terms of

the central dierence and averaging operators and as

yih

yi yi

h

yi yih

Example An operator raised to a positive integer power is iterated eg

yi yi yi yi yi yi

Thus the centered second dierence approximation of the second derivative can

be written as

yi yih

Example Expanding y xi in a Taylors series about xi yields

y xi y xi hy xi h

y xi

h

y xi

Using the derivative operator D dened in Table

y xi hD h

D y xi

Operator Symbol Denition

Forward Dierence yi yi yi

Backward Dierence r ryi yi yi

Central Dierence yi yi yi

Average yi yi yi

Shift E Eyi yi

Derivative D Dyi yi

Table Denition of nite dierence operators

This suggests the shorthand operator notation

Ey xi y xi ehDy xi

where E is the shift operator Table We thus infer the identity between the shift

exponential and derivative operators

E ehD

Additional relationships can be obtained by noting that yi E yi which implies

that E or E Using this with gives

hD lnE ln

a

where the series expansion of ln x jxj has been used A similar relation in terms

of the backward dierence operator can be constructed by noting that r E thus

hD lnE ln r r

r

r b

These identities can be used to derive highorder nite dierence approximations of

rst derivatives For example suppose that we retain the rst two terms in a

ie

hDyi

yi

or

hDyi yi yi yi yi yi

or

Dyi yi yi yih

This formula can be veried as an O h approximation of y xi

Example Let us use with h replaced by h to obtain

y xi eh

Dy xi y xi e

h

Dy xi

Subtracting the two formulas and using the central dierence operator gives

y xi eh

D e

h

Dy xi sinh

h

Dy xi

Thus

sinhh

D

or

hD sinh

which can be used to construct central dierence approximations of y xi

Example We can square cube etc relations and to construct

approximations of second third etc derivatives For example squaring gives

hDy xi hy xi

y xi

At some point these formal manipulations would have to be veried as being correct

and estimates of their local discretization errors would have to be obtained Nevertheless

using the formal operators of Table provides us with a simple way of developing

highorder nite dierence approximations

Introduction to Collocation Methods

Unlike nite dierence methods projection methods such as collocation give a continuous

approximation of the solution as a function of x The basic idea is to approximate the

solution y x of a BVP by a simpler function Y x and then determine Y x so that it

is the best approximation of y x in some sense Two reasonable choices for Y x are

a discrete Fourier series

Y x MXk

ckeikx

and a polynomial

Y x MXk

ckxk

It is convenient to regard the BVP solution y x as an element of an innitedimensional

function space and Y x as an element of an M dimensional subspace of it Thus as

suming that y x has continuous second derivatives on a x b we would write

y x C a b which is read y x is an element of the space of functions that have

continuous second derivatives on a b Then Y x SM C a b where the space

SM consists of those C functions having a prescribed form The chosen functions eg

eikx or xk k M comprise a basis for SM

In order to introduce some concepts well again focus on the secondorder nonlinear

scalar BVP After selecting a basis the coordinates ck k M

can be determined by eg the least squares technique

minY sM

Z b

a

R xdx

where R x is the residual

R x Y f x Y Y

In this case it is clear that Y x is the best approximation of y x in the sense of

minimizing the square of the integral of the residual

Using Galerkins method we determine Y x so that the residualR x is orthogonal

to every function in SM ie

Z b

a

w xR xdx w x SM

The optimality of this procedure is not clear however since Galerkins method is pri

mariliy used with partial dierential equations we will not pursue it further

Collocation has been shown to be a successful procedure tor twopoint BVPs and is

the one on which we focus Collocation consists of satisfying

R i i M

with

a M b

The optimality of collocation is also not clear but well pursue this elsewhere

Global approximations such as the Fourier series and the polynomials introduced

above lead to illconditioned algebraic problems It is far better to use piecewise poly

nomial approximations that result in sparse and wellconditioned algebraic systems It

is also unwise to infer more continuity than necessary Discontinuous and continuous

piecewise polynomial approximations might have the forms shown in Figure The

discontinuous polynomial on the left has jumps at xi i N Thus the

rst derivative doesnt exist at these points and this would be an unsuitable function to

approximate the solution of a secondorder ODE The continuous approximation on the

right has jumps in its rst derivative at xi i N and its second derivative

doesnt exist at these points Hence minimally Y x C a b In this case the rst

derivative of Y x is continuous and the second derivative is piecewise continuous

x

Y(x) Y(x)

x x

x

x x x

x

0 1 0 1 NN

Figure Discontinuous left and continuous right piecewise polynomial functionY x having jumps left and jumps in its rst derivative right at xi i N

Perhaps the simplest way of satisfying the continuity requirements is to select a basis

for SM that includes them For example a basis for a space of piecewise constant

functions could be chosen as

i x

if x xi xi otherwise

i N

The approximation Y x would then be written in the form

Y x NXi

cii x

and is shown in Figure In this case the dimension of the subspace M and the

number of subintervals N are identical however this need not be so

x x0

x

xN

x x1 1ii-1

c

c

c1

2

Nφ (x)

10

1

Y

Figure Piecewise constant basis element i x and the resulting piecewise constantapproximation Y x

Using and we see that

Y x ci x xi xi

We may interpret ci as Y xi however this is not necessary As shown in Figure

the basis i x Ca b thus Y x Ca b

Of course the basis doesnt satisfy any continuity requirements however it

can be used to generate a continuous basis More generally a piecewisepolynomial basis

whose continuity increases with increasing degree can be constructed by integrating a

linear combination of basis elements of a piecewisepolynomial space having one degree

less than the desired degree For example let us construct a C piecewiselinear basis by

integrating i and i as

i x

Z x

x

i s i sds

The appropriate continuity will be automatically obtained by the integration The result

for this example is

i x

if x xi x xi if xi x xihi x xi if xi x xi

hi hi if xi x

where

hi xi xi

The parameters and are at our disposal Let us pick them so that the resulting

approximation has compact support ie so that

i x x xi

Let us furthermore normalize the basis so that

i xi

Then we nd

i

hi i

hi

and the nal result

i x

xxihi

if xi x xixixhi

if xi x xi

otherwise

The approximation Y x has the form

Y x NXi

cii x

x x0

x x1 1ii-1

1

x

xN

cN

c1

c0

xi+1

ci

φ (x)11

Y(x)

Y

Figure Piecewiselinear basis element i x and the resulting piecewiselinear approximation

The basis element i x and the piecewiselinear approximation Y x are shown in Figure

Using we see that i xj ij where ij is the Kronecker delta Using this

with yields Y xi ci i N The restriction of Y x to the subinterval

xi xi is the linear function

Y x cii x ci

i x x xi xi

Well continue by constructing a C piecewisequadratic polynomial basis as

i x

Z x

x

i s i sds

Proceeding in three steps we see that

Z x

x

i sds

if x xixxi

hi if xi x xi

hi hi

xix

hi if xi x xi

hi hi

if xi x

and

i x

if xi x

xxi

hi if xi x xi

hi hi xix

hi xxi

hi if xi x xi

hi hi hi hi xix

hi if xi x xi

hi hi hi hi if xi x

Enforcing the condition that i x x xi implies

hi hi

hi hi

Thus

i x

xxi

hihihi if xi x xi

xix

hihihi xxi

hihihi if xi x xi

xix

hihihi if xi x xi

otherwise

a

Normalizing the result so that i xi yields

hi

hi hi hi

hi hi

b

−1 −0.5 0 0.5 1 1.5 20

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Figure Quadratic spline basis element i x relative to a mesh with xi xi xi and xi

The basis fi xgNi denes a quadratic spline The element i is shown in Figure

Evaluating ab at a node xj yields

i xj

hihihi

if j i hi

hihi if j i

otherwise

c

The basis simplies when the mesh is uniform thus if hi h i N

i x

xxih

if xi x xi xix

h xxi

h if xi x xi

xixh

if xi x xi

otherwise

d

The quadratic spline approximation is written in the form

Y x NXi

cii x a

and its restriction to xi xi is

Y x

c x c

x x x x

cii x ci

i x ci

i x x xi xi i N

cNN x cN

N x x xN xN

b

Thus three elements of the spline basis are nonzero on any interval except the rst and

the last where there are only two nonzero elements

Using with b we see that

Y xi

chhh

if i cihicihi

hihi if i N

cNhNhNhN

if i N

c

One could take h h and hN hN

When solving BVPs or interpolation and approximation problems its convenient to

introduce an extra basis element and unknown at each end of the domain and write Y x

as

Y x

NXi

cii x

Now there are three nonzero basis elements on every subinterval For interpolation prob

lems the coecients ci i N may be determined by satisfying

Y xi f xi i N

This yields N equations for the N unknowns The extra two equations could be

obtained by

interpolating f x at x and xN

prescribing f x at x and xN or

prescribing Y x Y xN

Regardless of the boundary prescription this interpolation problem requires the solution

of a tridiagonal linear algebraic problem to determine ci i N

Its possible to continue in this manner introducing more continuity with increasing

polynomial degree however usually well want approximations having the minimum al

lowable continuity Since higherdegree approximations increase the convergence rate of

smooth solutions we seek alternative spline constructions that do not increase smooth

ness with increasing polynomial degree Such procedures exist however for the

moment well examine piecewise cubic Hermite approximation Thus let us consider a

function of the form

Y x NXi

cii x di

i x

The basis fi x i xgNi is constructed to satisfy the following conditions

i x and i x are piecewise cubic polynomials on x xN

i x i x C x xN

i x and i x are nonzero only on xi xi and

i xi and i xi i N

These conditions imply that

i xj ij i xj i j N a

i xj

i xj ij i j N b

Together and give Y xi ci and Y xi di i N

Given these requirements the piecewise cubic Hermite basis is

i x

xxihi

xxihi

if xi x xi xxi

hi xxi

hi if xi x xi

otherwise

a

−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1−0.2

0

0.2

0.4

0.6

0.8

1

1.2

Figure Cubic Hermite polynomial basis elements i x solid and i x dashed

relative to a mesh with xi xi and xi

i x

x xi xxihi

if xi x xi x xi xxi

hi if xi x xi

otherwise

b

Representative basis elements are illustrated in Figure Examining we see

that there are four nontrivial basis elements i i i and i on the subinterval

xi xi i N

Having constructed appropriate piecewise polynomial approximations let us use them

to dene a collocation method by satisfying at a prescribed number of points per

subinterval and typically satisfying the boundary conditions Thus

Y ij f ij Y ij Y ij j J i N a

Y a A Y b B b

As indicated there are J collocation points ij j J per subinterval For

the piecewise quadratic spline approximation we would determine the N

unknowns ci i N by collocating at J point per subinterval and satisfying

the boundary conditions b With the piecewise cubic Hermite polynomial

we would determine the N unknowns ci di i N by collocating at J

point per subinterval and satisfying b

Example Well develop the collocation equations when piecewise quadratic

splines are applied to a linear problem with f x y y given by For

simplicity well assume that the mesh is uniform with spacing h Utilizing and

the boundary conditions b are

Y a A

c c Y b B

cN cN a

Selecting the sole collocation point

i xi xi xi

i N

at the center of each subinterval Figure and using and we have

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Figure Piecewise quadratic spline basis used for collocation on a mesh with spacingh on

Y xi

ci ci ci

Y xi

h ci ci

and

Y xi

h ci ci ci

Substituting these results into a while using we nd

h ci ci ci

pih

ci ci qi

ci ci ci ri

i N b

These dierence equations are similar but not identical to the central nite dierence

equations The relationship can be made more precise by rewriting in

terms of the nodal unknowns Y xi and comparing this result with Problem

The system may be written in a tridiagonal form as

N N N N N

cccNcN

ArrNB

a

where

N

i

h qi i N b

i

h pi

hqi

i N N

c

i

h

pih

qi

i N d

As a simple numerical example lets suppose p q r A and

B This is the problem of Example which has the exact solution

y x sinh x

sinh

Solution and pointwise at xi i N error data are presented in Table

for N The maximum pointwise errors for collocation solutions computed with

i xi Y xi y xi Y xi

E E E E E E E E E E E

Table Solution and pointwise errors for Example using collocation with piecewise quadratic splines at the center of each of ten subintervals

N kY yk NkY yk

Table Maximum pointwise errors for the solution of Example using collocationwith piecewise quadratic splines at the center of each of N subintervals

N and subintervals are presented in Table Solutions appear to be

converging as O h Pointwise errors are about half of those found using central nite

dierences Table

Example In the previous example it seemed natural to place the single collo

cation point at the center of each subinterval Were we to used piecewise cubic Hermite

approximations however we would have two collocation points per subinterval Placing

them at the ends of each subinterval is one possibility however our work with implicit

RungeKutta methods Section would suggest that the GaussLegendre points give

a higher rate of convergence DeBoor and Swartz showed that this is the case and we

will repeat this analysis in Chapter however for the moment let us assume it so and

consider the collocation solution of Chapter

y y

x

x x

y y

N jjY yjj

Table Maximum pointwise errors for the solution of Example using collocationwith piecewise cubic Hermite polynomials at two GaussLegendre points per subinterval

which has the exact solution

y x ln

x

The solution is smooth on x but the coecient p x x is unbounded at

x This would lead to problems with nite dierence or shooting methods but not

with collocation methods that collocate at points other than subinterval ends Ascher

et al solve this problem by a variety of techniques Well report their results using

piecewise cubic Hermite polynomials with collocation at the two GaussLegendre points

i

xi xi hp

i

xi xi

hp

per subinterval The maximum pointwise errors are presented in Table A simple

calculation veries that the solution is converging as O N

Problems

Construct the basis for a cubic spline approximation that is of class C and has

support on xi xi by integrating the quadratic splines i x and i x of

and imposing appropriate normalization and compact support conditions

For simplicity assume that the mesh is uniform with spacing h

Using c show that

Y xi

ci ci

on a uniform mesh of spacing h Use this to rewrite the quadraticspline collocation

equations in terms of Y xi i N instead of ci i N

Compare the results with the nite dierence equations

Bibliography

UM Ascher R Mattheij and R Russell Numerical Solution of Boundary Value

Problems for Ordinary Dierential Equations SIAM Philadelphia second edition

C de Boor and B Swartz Collocation at gaussian points SIAM J Numer Anal

C deBoor A Practical Guide to Splices SpringerVerlag Berlin