25.08.2021 Views

082-Engineering-Mathematics-Anthony-Croft-Robert-Davison-Martin-Hargreaves-James-Flint-Edisi-5-2017

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

20.6 Euler’s method 617

and we can therefore generate a whole sequence of approximate values ofy. Naturally,

theaccuracyofthesolutionwilldependuponthestepsize,h.Infact,forEuler’smethod,

theerrorincurredisroughlyproportionaltoh,sothatbyhalvingthestepsizeweroughly

halve the error.

An alternative way of deriving Euler’s method is to use a Taylor series expansion.

Recall from Chapter 18 that

y(x 0

+h) =y(x 0

) +hy ′ (x 0

) + h2

2! y′′ (x 0

)+···

If wetruncate afterthe second termwe find

thatis,

y(x 0

+h) ≈y(x 0

) +hy ′ (x 0

)

y 1

=y 0

+hy ′ (x 0

)=y 0

+hf(x 0

,y 0

)

sothatEuler’smethodisequivalenttotheTaylorseriestruncatedafterthesecondterm.

Example20.4 UseEuler’s methodwithh = 0.25 toobtain a numericalsolution of

dy

dx = −xy2

subject toy(0) = 2, giving approximate values ofyfor 0 x 1. Work throughout

tothreedecimal places and determine the exact solution for comparison.

Solution We need to calculatey 1

,y 2

,y 3

andy 4

. The correspondingxvalues arex 1

= 0.25,x 2

=

0.5,x 3

= 0.75 andx 4

= 1.0.Euler’s method becomes

We find

y i+1

=y i

+0.25(−x i

y 2 i ) with x 0 =0 y 0 =2

y 1

= 2 −0.25(0)(2 2 ) = 2.000

y 2

= 2 −0.25(0.25)(2 2 ) = 1.750

y 3

= 1.750 −0.25(0.5)(1.750 2 ) = 1.367

y 4

= 1.367 −0.25(0.75)(1.367 2 ) = 1.017

The exact solution can be found by separating the variables:

∫ ∫ dy

y = − xdx

2

so that

− 1 y = −x2 2 +C

Imposingy(0) = 2 givesC = − 1 so that

2

Finally,

− 1 y = −x2 2 − 1 2

y = 2

x 2 +1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!