0% found this document useful (0 votes)
97 views2 pages

Runge-Kutta-Fehlberg: (T K4 (T K I :K1 - ) K4)

The Runge-Kutta-Fehlberg method is used to numerically approximate solutions to initial value problems. It takes in the endpoints, initial condition, tolerance, maximum and minimum step sizes. It then iteratively calculates intermediate values using the RK formulas to estimate the solution at each step, checking the error tolerance and adapting the step size accordingly, until it reaches the endpoint or minimum step size is exceeded. For example, it was used to approximate the solution to y'=(y-t^2+1), 0≤t≤2, y(0)=0.5, comparing to the exact solution, calculating the first step with h=0.25max.

Uploaded by

baba
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)
97 views2 pages

Runge-Kutta-Fehlberg: (T K4 (T K I :K1 - ) K4)

The Runge-Kutta-Fehlberg method is used to numerically approximate solutions to initial value problems. It takes in the endpoints, initial condition, tolerance, maximum and minimum step sizes. It then iteratively calculates intermediate values using the RK formulas to estimate the solution at each step, checking the error tolerance and adapting the step size accordingly, until it reaches the endpoint or minimum step size is exceeded. For example, it was used to approximate the solution to y'=(y-t^2+1), 0≤t≤2, y(0)=0.5, comparing to the exact solution, calculating the first step with h=0.25max.

Uploaded by

baba
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/ 2

Runge-Kutta-Fehlberg

To approximate the solution of the initial-value problem

y' = f(t,y), a :St :Sb, y(a) = a,


with local truncation error within a given tolerance:

INPUT endpoints a, b; initial condition a; tolerance TOL; maximum step size hma.x;
minimum step size hmin.

OUTPUT t, w, h where w approximates y(t) and the step size h was used, or a message
that the minimum step size was exceeded.

Step 1 Set t = a;
w=a;
h = hma.x;
FLAG= 1;
OUTPUT (t, w).
Step 2 While (FLAG= 1) do Steps 3-11.
Step 3 Set K 1 = hf (t, w);

= hf (t + ¼h, w + ¼K1);
K2
K3 = hf (t + }h, w + -b_K1 + iK2);
K4 = hf (t + Hh, W + ~i~~K1 - ;i~K2 + ;i~~K3);
K5 = hf (t + h, w + i~:K1 - 8K2 + 356183°K3 - ]~K4);
K6 = hf (t + ½h, w - iK1 + 2K2 - ~;~K3 + !~~K4 - !diKs).
Step 4 Set R = iil I 360 2197 K4 + soI Ks + ss
1 K1 - 128 K3 - 75240 2 K6 I·
4275

(Note: R = ¼lti\+1 - w;+d-)


Step 5 If R :S TOL then do Steps 6 and 7.
Step 6 Sett = t + h; (Approximation accepted.)
5
w = w + f16K1 + + !:~K4 - ½Ks.
Step 7 oUTPUT (t, w,~~4
Step 8 Set 8 == 0.84(TOL/R) .
Step 9 If 8 0.1 then set h == 0th.th et h == 4h
else ifS :=:: 4 en s
else set h == 8h, (Calculate new h.)

Step 10 If h > hmax then set h_== hmax.


Step 11 If t > b then set FLAG == O t
- else if t + h > b then set h == b .-
else if h < hmm then
set FI.AG == 0;
OUTPUT ('minimum h exceeded').
(Procedure completed unsuccessfully.)

Step 12 (The procedure is complete.)


STOP. I

5
Example 1 Use the Runge-Kutta-Fehlberg method with a tolerance TOL == 1~- , a maximu~ step size
hmax = 0.25, and a minimum step size hmin == 0.01 to approximate the solution to the
initial-value problem

y' =y - t 2 + 1, 0 t 2, y(O) == 0.5,


and compare the results with the exact solution y(t) = (t + 1) 2 - 0.5e1•
Solution We will work through the first step of the calculations and then apply Algorithm
5.3 to determine the remaining results. The initial condition gives to = 0 and wo = 0.5. To
determine w1 using h = 0.25, the maximum allowable stepsize, we compute

k1 = hf (to, wo) = 0.25 (0.5 - 02 + 1) = 0.375;


k, = hf ( l-0 + ih, Wo + ik,) = 0.25 Go.25, 0.5 + ~0.375) = 0.3974609;
k3 = hf (to+ ~8 h, wo + 2_k 1 + :!__k2)
32 32

=0.25 ( 0.09375. 0.5 + :2 0.375 + :2 0.3974609) = 0.4095383;


k4 = hf (to+ 12 h, Wo + 1932 k1 - 7200 k + 7296 )
13 2197 2197 2 2197k3

= o.25 (o.2307692' o·5 + 2197°·


1932
375 - 7200 7296
- 0.3974609 + -0.4095383
)
2197 2197
= 0.4584971;
439
ks = hf (to+ h, w 0 + ki _ 8k2 + ~ k 845 )
216 513 3 - 4104k4

=0.25 ( 0.25, 0.5 + 0.375 - 8(0.3974609) + 3680 . ~0.4584971)


5 13 0.4095383 - 4104
=0.4658452·'

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