0% found this document useful (0 votes)
35 views6 pages

Differences Finies

The document summarizes the finite-difference method for numerically solving second-order boundary value problems involving differential equations. It describes discretizing the domain, using central difference formulas to approximate derivatives, and setting up a system of equations to solve for the numerical solution at discrete points. As an example, it applies the method to solve a particular boundary value problem and compares the numerical solutions to the exact analytic solution.

Uploaded by

Kawtar Kabbi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views6 pages

Differences Finies

The document summarizes the finite-difference method for numerically solving second-order boundary value problems involving differential equations. It describes discretizing the domain, using central difference formulas to approximate derivatives, and setting up a system of equations to solve for the numerical solution at discrete points. As an example, it applies the method to solve a particular boundary value problem and compares the numerical solutions to the exact analytic solution.

Uploaded by

Kawtar Kabbi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

-'

536 CH,o,p, 9 SOLUTToN on DtpnengruTrAL EeuATroNS

9.9 Finite-Difference Method


Methods involving difference quotient approxinations
for derrvatives can be used for
solving certain second-order boundary valLre ploblens.
Consider the linear equation
(l) x" : p(t)x'(t) + q(t)x(t) + r(t)
over fa, ôl with x(a) : a and x(b):
B. Forn a parrition of
a : tO < /1 <'.. < t1y : b, where h : (b _ a)lN andti : [a,bl jhforT _
Lrsing rhe points
cL + 0, -,
central-difference fbrmulas discLrssed in chapter 6
:"^'I. 113
tne oeftvatlves
are r-rsed to approximare

(2) x'(1.i):'t(ri'-r)-x(ri-r) -rO(h2)


' 2lt
and

(3) x"ç111 : x(ti-t) - 2xQi) -f x(ti- t)


, O(h27.
To start the derivation, we replace each term x(r7) on
the right side of (2) and (3)
with 17, and the resulting equations ale sr:bstitr-rted into (l)
to obtain the relation

!fI-2x1i'_.ti 1 t o(tt')
^.1 : /r.,,r_ r.,.1 "\
(4) -;r- P(tit l'+
\
r oth21\
_/l
/

-t c1lt.1)x1 i r(t1),
Next, we drop the two terms o(h2) i, (4) and intr.odr,rce the notation p7 : pG),
q.i : q (rr), and r j : r(ri)i this prodLrc s the cliffèrence eqnation

(5) ti-t-2rit\L-t I Ln.v,..


It2 t'.t
--n,r.lri-\'i. .r(li^j tt-i.
2h
which is used to compute nr-tmerical approximations to
the differential equation (1).
This is carried oLrt by multiplying each side of (5) by h2
and then collectirg terms
' involvin g x j
-t ' x i , and x 1a1 ana àr.ang ing them in a system of linear equations:
/ _ lt \
(6) -,)r,-r F(2. tr2t1i)t1r(!r,i-')",- t:-h2,j.
lî,,,
Sec. 9.9 FrnrrE-DTpIERENCE METHoD 537

for j : 1,2,., N- 1, where x0 : aand,rry : p. Thesystemin (6)has thefamiliar


tridiagonal folm, which is r.nore visible wlien displayed with rnatlix notation:

h,
/ + n-ql
^
!)

;pt - | x

Jn^-
2 rz
|
2 * h2qz Tpr- t o xz

,)
^zïn-qj
-h
2 vJ tPt-t xj
h.^
o -+DN-)
-h
- ) 2 + h2qN-z l UN-) -
t
r xN-2
-11
ïPN-t - t /+
^
t')
n-qN_l .ïN- I

-h2'r + eo
t)
-n-12
_hrrj
-h2, N -z
-h2ry-1 * e1y

where
/h \ /-h \
eo:lit, t t1" and ur-lipr-t+tlB
\Z ,/ \ L /
When computations wrth step size h are used, the numerical approximation to the
solution is a set of discrete points {(/;, x;)}; if the analytic solLrtion x(ri) is known, we
can compare x. j and x (t j ) ,

Example 9.18. Solve the boundary valr"re ploblen-r

..2t2
x"(t) : (t) +
4 px - U Ux(r)
I

with .r(0) : 1.25 and x(4) : -0,95 over the interval [0, 4l
The functions p, q,and r are p(t) : 2t l0 ) r2), q(t) : -21(l * t2), and r(t) : l,
respectively. The linite-diffel'ence nrethod is r.rsed to constrLrcl numelical solutions {-v;} us-
ing the system of eqr-rations (6). Sample values of the zrpploximations {xi t}, {x i,z}, {xi t},
and {x7,+) con'esponcLing to the step sizes ht : 0.2, hy : Q 1, hj :0.05, and hq :0.025
are given in Table 9.17. Figuu-e 9.26 shows the graph of the polygonal path formed from
{(t1, x1,t)} fol the case hr : 0 2. There are 4l terms in the sequence generated with
hz:0.1 , and the sequence {xJ.2} only inclirdes evely other tet'm from these computations;
they correspond to the 21 valr,res of {r;} given in Table 9.17. Similally, the seqLrences {xl.:}
and [x7.+] ale a poltion of the valires genelated with step sizes hr : 0.05 and h4: 0.025,
respectively, and they correspond to the 2l values of {ti} in Tabte 0.t2.
Next we compal'e numelical solutions in Table 9.17 with the analytic solirtion: x(t1 :
L25 + 0 486089652t - 2,2512 +2t arÇTan(r) - j lnç I l- t') + lt2 tnçt + 12 ). The numerical
538 CHp.p. 9 SolurroN oF DTFFERENTTAL EouArroNS

)t )
Table 9.17 Nr"rrnelical Approximations fbr v"ll) : -- r'(r) - .-
| +f' -r(l) + l
I +r-
rj, r
x j.2 ri3 j'l x(t 1)
h-0.2 /r-01 h:005 h :' 0.025 exzrct

00 r 250000 I.250000 1.250000 r.250000 r 250000


02 l 3r4s03 | 316646 | 3r1t74 t.311306 I 3 17350
04 | 320607 | 325045 1 326141 |.326414 1 326s05
0.6 1.272'7 55 | 219533 r.28t206 |.28t623 t,281'762
08 ) t77399 I l 86438 | | 88670 1 t89227 |
189412
l0 | 042t06 1 053226 | 0-5_s973 l 056658 r 056886
12 0.874878 0 887823 0 89 r023 0.89 r 82 l 0 892086
1.4 0 6837 12 0 698181 0 7017-58 0.702650 0 702947
l6 0 416312 0 49202'7 0 495900 0 49686s 0 49'7r8'7
1.8 0 260264 0,276'749 0 280828 0 281846 0 282184
20 0 042399 0 059343 0 063537 0 064s83 0 06493 1

2,2 -0 r70616 -0 r 53592


-0 149378
-0 148321 -0 1419't'7
2,4 -0 312551 -0.355841 -0.35 t702 -0.350669 -0 3-50325
26 -0 5s7565 -0 s4t546 -0 -537_580 -0 536590 -0 53626 I

28 -0 1201 t4 -0 705 r B8 -0 101492 -0 700570 -0 100262


30 -0 854988 -0,84 1 55 1
-0.838223 -0 837393 -0 8371 l6
32 -0 L)51250 0 945100 -0 942839 -0 942125 -0 94 r 888
1t1
-I 022221 - I 0t 2958 - | 010662 - r .01 0090 -r 009899
36 - | 04s4s'7 - I 038880 - | ,031250 - r 036844 -1 036'709
3.8 -r 02272'7 - | 019238 -1 018373 -r0l8l58 -l 018086
4.0 -0 950000 -0 950000 -0 950000 -0.950000 -0 950000

solutiorls can be shown to have error of order O0t2). Hence reducing the step size by a
factor of j resLrlts iu the errol being reduced by aboLrt ]. A calefirl scl'utiny of Table 9.18
will reveal that this is happening. For instance, ar ti : 1.0 the erlors incr"rn'ed with step
sizes/r1,h2,h3, and/r4are e1t:0 014780. e1.z:0 003660. ei.,:0 0009 13, ande14:
0 000228, respectively. Their successive latios e i.2le i.r - 0 003660 10.014180 - 0 2416.
e1tle1.z: 0 000913/0 003660 :0.2495, and e 1.+le i: : 0 000228/0 000913 :0.2491
are approaching ].
Finally, we show how Richalclson's improvemenf scheme can be used to extrapolate
the seemingly inaccurate seqLrences {x7. 1}, {x7 z}, {xi 3},.and {xr.+} and obtain six digits
of precision, Elirninate the ellol terms O(h2) ancl O((hl2)25 in the apploxirr-rations {x; r)
and{.xi.z} bygenerating-l-heexl-rapolaLedseqLrence{iir}: {(4x12-x1t)13} Similarly,
the ellor terms O((h/2)r.) ancl Ottlt1412 l for {r;,u } ancl {-r, j) are eliminatecl by generat-
ing {27 z) : {(4,r7..t - x1ù13|. It has been shown that the seconcl level of Richardson's
improvement schene applies to the sequences {zi 1} and {i; z}, so the third improvement
is {(162, 2- z j,t)115).Let Lrs illustrate the situation by finding the extrapolared values that
Sec. 9.9 FINITE-DIFFERENCE METHoD s39

0.0

-05

-1.0
Figure 9.26 The graph of the nnmerical approximation for
x(t1 : u(t) + w(t), which is the solution to

,,2t
x'(l): 2

r+t. - rx(r)
ta t" I I

(using /z :0.2).
-l'(r)

colrespond to /; : I 0. The lirst extrapolated valr-re is

4x;t - x; t 4(1.053226\ - 1.042106


3 - 3
-tns60'tr-...
- '.vJv/JL-4j,t.

The second extlapolated valLre is

4xj,3 - xj,z 4(1.055973) - 1.053226

Finally, the third extrapolation involves the terms z j.t and z j.2:
-:-:l'05688e
162;) - z.i | 16(1.056889) - 1.056932
: : I 056886.
15 15

This last computation contains six decirnal places of accuracy. The vah,res at the other
points are given in Table 9,19. r
Program 9,12 will call Program 9.11 to solve the tridiagonal system (6). Pro-
gram 9.12 requires that the coeflicient functions p(r), cl (r), and r(r) (boLrndary value
problem ( 1)) be saved in M-files p ,m, q.m, and r . m, respectively.

Program 9.11 (Tridiagonal Systems). To solve the tridiagonal system C.X : B,


where C is a tridiagonal matnx.

function X=trisys (A, D,C, B)


540 CHap. 9 SoLUrroN oF DTFFERENTTAL ÊeuArroNS

Table 9'18 Ert'ors in Numerical Approximations


Using rhe Finite-Differ.ence Method

x(tj)-xj,4
: j.4 e

lt1 :9 2 h2:01 h3 :
00 0.000000
9.95 114 :0.025
0 000000 0 000000
02 0 002841 0 000000
0.000704 0 000176
04 0 005898 0.00 | 460
0.000044
0 000364 0 00009 I
06 0 009007 0 002229 0 000556 0.000r39
0.8 0.012013 0.002914 0.000742
10 0 014780 0 0001 85
0 003660 0 000913
1.2 0 017208 0.000228
0.004263 0 001063
1.4 0.019235 0 000265
0.004766 0.001 189
].O 0 02081s 0.000297
0.005160 0.001281
l8 0.021920 0 005435
0 000322
0 0013s6 0 000338
2.0 0.022533 0 00-5588 0.001 394
2.2 0.022639 0.000348
0 0056t5 0.00 t40l
2.4 0.022232 0 000350
0 005516 0 00t31'7
z,o 0 02t304 0.000344
0 00s2Bs 0 001319
28 0.0i9852 0.000329
0.004926 0 001230
30 0 017872 0 000308
0 00443s 0 001 107
J.Z 0.015362 0.000277
0.0038 t2 0.0009s l
3.4 0.0t2322 0 000237
0 0030s9 0 000763
36 0 008749 0 000191
0 002t1) 0 000s4r
38 0 00464r 0 000135
0 001 152 0 000287
40 0 000000 0 000072
0 000000 0 000000 0 000000
Sec, 9.9 FrulrE-DTFpnRENCE METHOD 54:

Table 9'19 Extrapolation of the NLrmericar Approximarions


{.r;, ,}, {x 1 ù, {.xr,:r} obtained
with the Fi nite-Difference Methocl

4x j,2-r j.l l6z. j.2-z j.l x(t 1)


3 3 Exact
ti solntion
0.0 1 250000 | 250000 I 250000 1.250000
0.2 1.317360 r 3 t73-s l 1 311350 1.31'73s0
0.4 I 326524 | 326506 | 326s04 I 326505
0.6 1.281792 t 28tl64 ).281162 1,281762
08 I 189451 I t894t4 r t894r2 1 189412
10 r 056932 I 056889 1.056886 1.056886
T,2 0.892138 0.892090 0 892086 0.892086
1.4 0.703003 0'702951 0 70294'7 0.702948
l.o 0.497246 0.497191 0 497 t87 0 491187
1.8 0.282244 0 282188 0.282184 0.282184
2.0 0.064991 0 064935 0 064931 0 064931
2.2 -0 147918 t4'7913
2.4
-0. -0 147917
-0.t4797'r
-0 3-50268 -0 350322 -0 350325 -0 350325
26 -0 536201
28
-0.53 625 8
-0 53626r -0 536261
-0.7002)3 -0 700259
-0.100263 -0.'/00262
3.0 -0.837012 -0.837113 -0.837116 -0.837 1 16
3.2
-0 941850 -0 941885
-0.941888 -0 941888
34 - I .009870 -r 009898
- l 009899 - I 009899
3.6 -l 036688
-t 036107
- L036708 - 1.036708
3.8
- 1 01 807-5
- r.0 t8085
-r 018086
-l 018086
40 -0.950000 -0 9-50000
-0.950000 -0 950000

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy