Docsity

Solved Homework 5 - Applied Numerical Methods | MATH 151A, Assignments of Mathematics

Toggle sidebar
bg1
Homework 5 Solutions
Igor Yanovsky (Math 151B TA)
Section 5.10, Problem 7: Investigate stability for the difference method
wi+1 =−4wi+ 5wi−1+ 2hhf(ti, wi)+2hf(ti−1, wi−1)i,
for i= 1,2, . . . , N −1, with starting values w0,w1.
Solution: For a multistep method to be stable, it has to satisfy the root condition. A
multistep method is said to satisfy the root condition if all roots λiof the characteristic
polynomial P(λ) are such that |λi| ≤ 1, and if |λi|= 1, then λiis simple.
For the multistep method
wi+1 + 4wi−5wi−1= 2hhf(ti, wi) + 2hf(ti−1, wi−1)i,
the characteristic polynomial is
P(λ) = −5+4λ+λ2,
which has roots
λ1= 1, λ2=−5.
Since |λ2|>1, this multistep method does not satisfy the root condition, and therefore is
unstable. X
Section 11.3, Problem 3(a): Write the discretization of the following boundary value
problem
y00 =−3y0+ 2y+ 2x+ 3,
0≤x≤1,
y(0) = 2, y(1) = 1,
in matrix-vector notation Aw=b.
Solution: At the interior points xi, for i= 1,2, . . . , N, the differential equation to be
approximated is
y00(xi) = −3y0(xi)+2y(xi)+2xi+ 3.(1)
Since
y00(xi) = y(xi+1)−2y(xi) + y(xi−1)
h2−h2
12y(4)(ξi),
y0(xi) = y(xi+1)−y(xi−1)
2h−h2
6y000(ηi),
we can write the numerical approximation to (1) as
wi+1 −2wi+wi−1
h2+ 3µwi+1 −wi−1
2h−2wi= 2xi+ 3.(2)
1
pf3
pf4

Partial preview of the text

Download Solved Homework 5 - Applied Numerical Methods | MATH 151A and more Assignments Mathematics in PDF only on Docsity!

Homework 5 Solutions

Igor Yanovsky (Math 151B TA)

Section 5.10, Problem 7: Investigate stability for the difference method

wi+1 = − 4 wi + 5wi− 1 + 2h

[

f (ti, wi) + 2hf (ti− 1 , wi− 1 )

]

for i = 1, 2 ,... , N − 1, with starting values w 0 , w 1.

Solution: For a multistep method to be stable, it has to satisfy the root condition. A

multistep method is said to satisfy the root condition if all roots λi of the characteristic

polynomial P (λ) are such that |λi| ≤ 1, and if |λi| = 1, then λi is simple.

For the multistep method

wi+1 + 4wi − 5 wi− 1 = 2h

[

f (ti, wi) + 2hf (ti− 1 , wi− 1 )

]

the characteristic polynomial is

P (λ) = −5 + 4λ + λ

2 ,

which has roots

λ 1 = 1, λ 2 = − 5.

Since |λ 2 | > 1, this multistep method does not satisfy the root condition, and therefore is

unstable. X

Section 11.3, Problem 3(a): Write the discretization of the following boundary value

problem

y

′′ = − 3 y

′

  • 2y + 2x + 3,

0 ≤ x ≤ 1 ,

y(0) = 2, y(1) = 1,

in matrix-vector notation Aw = b.

Solution: At the interior points xi, for i = 1, 2 ,... , N , the differential equation to be

approximated is

y

′′ (xi) = − 3 y

′ (xi) + 2y(xi) + 2xi + 3. (1)

Since

y

′′ (xi) =

y(xi+1) − 2 y(xi) + y(xi− 1 )

h^2

h

2

y

(4) (ξi),

y

′ (xi) =

y(xi+1) − y(xi− 1 )

2 h

h

2

y

′′′ (ηi),

we can write the numerical approximation to (1) as

wi+1 − 2 wi + wi− 1

h

2

wi+1 − wi− 1

2 h

− 2 wi = 2xi + 3. (2)

Multiplying both sides of (2) by −h

2 gives

−(wi+1 − 2 wi + wi− 1 ) −

3 h

(wi+1 − wi− 1 ) + 2h

2 wi = −h

2 (2xi + 3).

Collecting wi− 1 , wi, and wi+1 terms, we obtain

3 h

wi− 1 + (2 + 2h

2 )wi −

3 h

wi+1 = −h

2 (2xi + 3). (3)

The resulting system of equations can be expressed in the tridiagonal N × N matrix form

Aw = b, where

A =

2 + 2h

2 − 1 −

3 h

3 h

2

2 + 2h

2 − 1 −

3 h

2

3 h

3 h

2 + 2h

2

w =

w 1

w 2

. . .

wN − 1

wN

, and b =

−h

2 (2x 1 + 3) +

3 h

2

w 0

−h

2 (2x 2 + 3)

. . .

−h

2 (2xN − 1 + 3)

−h

2 (2xN + 3) +

3 h

wN +

. X

In order to see that this system satisfies (3), look at a couple of rows of matrix A, for

example, the second row:

3 h

w 1 + (2 + 2h

2 )w 2 −

3 h

w 3 = −h

2 (2x 2 + 3).

Also, first and last elements of b might be a little daunting. However, if we look at the

first row (for example), we see that

(2 + 2h

2 )w 1 −

3 h

w 2 = −h

2 (2x 1 + 3) +

3 h

w 0 ,

or

3 h

w 0 + (2 + 2h

2 )w 1 −

3 h

w 2 = −h

2 (2x 1 + 3),

which satisfies equation (3).

Also, note that the book considers the general second-order boundary value problem:

y

′′ (x) = p(x)y

′ (x) + q(x)y(x) + r(x).

For our problem, p(x) = −3, q(x) = 2, and r(x) = 2x + 3. Plugging these values into the

formulas in the book, we can verify whether our calculations are correct.

In order to see that this system satisfies (6), look at a couple of rows of matrix A, for

example, the second row:

(x 2 + 1)h

w 1 + (2 + 2h

2 )w 2 −

(x 2 + 1)h

w 3 = −h

2 (1 − x

2 2 )e

−x 2 .

Also, first and last elements of b might be a little daunting. However, if we look at the

first row (for example), we see that

(2 + 2h

2 )w 1 −

(x 1 + 1)h

w 2 = −h

2 (1 − x

2 1 )e

−x 1

(x 1 + 1)h

w 0 ,

or

(x 1 + 1)h

w 0 + (2 + 2h

2 )w 1 −

(x 1 + 1)h

w 2 = −h

2 (1 − x

2 1 )e

−x 1 ,

which satisfies equation (6).

Also, note that the book considers the general second-order boundary value problem:

y

′′ (x) = p(x)y

′ (x) + q(x)y(x) + r(x).

For our problem, p(x) = −(x + 1), q(x) = 2, and r(x) = (1 − x^2 )e−x. Plugging these

values into the formulas in the book, we can verify whether our calculations are correct.