Docsity

Solution to Boundary Value Problem: Discretization of a Differential Equation, Study notes of Mathematics

Toggle sidebar
bg1
Boundary Value Problem Example
Igor Yanovsky (Math 151B TA)
Section 11.3, Problem 3(b): Write the discretization of the following boundary value
problem
y00 =−4
xy0+2
x2y−2
x2log x,
1≤x≤2,
y(1) = −1
2, y(2) = log 2,
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) = −4
xi
y0(xi) + 2
x2
i
y(xi)−2
x2
i
log xi.(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+4
xiµwi+1 −wi−1
2h−2
x2
i
wi=−2
x2
i
log xi.(2)
Multiplying both sides of (2) by −h2gives
−(wi+1 −2wi+wi−1)−2h
xi
(wi+1 −wi−1) + 2h2
x2
i
wi=2h2
x2
i
log xi.
Collecting wi−1,wi, and wi+1 terms, we obtain
−³1−2h
xi´wi−1+³2 + 2h2
x2
i´wi−³1 + 2h
xi´wi+1 =2h2
x2
i
log xi.(3)
The resulting system of equations can be expressed in the tridiagonal N×Nmatrix form
Aw=b,where
A=
2 + 2h2
x2
1
−1−2h
x1
0· · · 0
−1 + 2h
x2
2 + 2h2
x2
2
−1−2h
x2
....
.
.
0.........0
.
.
..........−1−2h
xN−1
0· · · 0−1 + 2h
xN
2 + 2h2
x2
N
,
1
pf2

Partial preview of the text

Download Solution to Boundary Value Problem: Discretization of a Differential Equation and more Study notes Mathematics in PDF only on Docsity!

Boundary Value Problem Example

Igor Yanovsky (Math 151B TA)

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

problem

y

′′ = −

x

y

′

x^2

y −

x^2

log x,

1 ≤ x ≤ 2 ,

y(1) = −

, y(2) = log 2,

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) = −

xi

y

′ (xi) +

x

2 i

y(xi) −

x

2 i

log xi. (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

xi

wi+1 − wi− 1

2 h

x^2 i

wi = −

x^2 i

log xi. (2)

Multiplying both sides of (2) by −h

2 gives

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

2 h

xi

(wi+1 − wi− 1 ) +

2 h

2

x^2 i

wi =

2 h

2

x^2 i

log xi.

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

2 h

xi

wi− 1 +

2 h

2

x

2 i

wi −

2 h

xi

wi+1 =

2 h

2

x

2 i

log xi. (3)

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

Aw = b, where

A =

2 h

2

x

2 1

2 h

x 1

2 h

x 2

2 h

2

x^2 2

2 h

x 2

2 h

xN − 1

2 h

xN

2 h

2

x

2 N

w =

w 1

w 2

. . .

wN − 1

wN

, and b =

2 h

2

x

2 1

log x 1 +

2 h

x 1

w 0

2 h

2

x

2 2

log x 2

2 h

2

x

2 N − 1

log xN − 1

2 h

2

x^2 N

log xN +

2 h

xN

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:

2 h

x 2

w 1 +

2 h

2

x^22

w 2 −

2 h

x 2

w 3 =

2 h

2

x^22

log 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 h

2

x^2 1

w 1 −

2 h

x 1

w 2 =

2 h

2

x^2 1

log x 1 +

2 h

x 1

w 0 ,

or

2 h

x 1

w 0 +

2 h

2

x^21

w 1 −

2 h

x 1

w 2 =

2 h

2

x^21

log x 1 ,

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) = −

x

, q(x) =

x^2

, and r(x) = −

x^2

log x. Plugging these values

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