Bulirsch–Stoer Method

7.6 Bulirsch–Stoer Method

Midpoint Method

The midpoint formula of numerical integration of y ′ = F(x, y) is

(7.25) It is a second-order formula, like the modified Euler’s formula. We discuss it here

y(x + h) = y(x − h) + 2hF

because it is the basis of the powerful Bulirsch–Stoer method, which is the technique of choice in problems where high accuracy is required.

y'(x)

Figure 7.3. Graphical repesentation of the midpoint

f (x,y)

Figure 7.3 illustrates the midpoint formula for a single differential equation y ′ =

f (x, y). The change in y over the two panels shown is

, x+h

y(x + h) − y(x − h) =

y ′ (x)dx

x−h

which equals the area under the y ′ (x) curve. The midpoint method approximates this area by the area 2hf (x, y) of the cross-hatched rectangle.

Figure 7.4. Mesh used in the midpoint method.

xxx

0 1 2 3 n-1

Consider now advancing the solution of y ′ (x) = F(x, y) from x = x 0 to x 0 + H with the midpoint formula. We divide the interval of integration into n steps of length

h = H/n each, as shown in Fig. 7.4, and carry out the computations

y 1 =y 0 + hF 0 y 2 =y 0 + 2hF 1

y 3 =y 1 + 2hF 2 (7.26)

.. . y n =y n−2 + 2hF n−1

Here we used the notation y i = y(x i ) and F i = F(x i , y i ). The first of Eqs. (7.26) uses the Euler formula to “seed” the midpoint method; the other equations are midpoint Here we used the notation y i = y(x i ) and F i = F(x i , y i ). The first of Eqs. (7.26) uses the Euler formula to “seed” the midpoint method; the other equations are midpoint

Richardson Extrapolation

It can be shown that the error in Eq. (7.27) is

E=c 1 h 2 +c 2 h 4 +c 3 h 6 +···

Herein lies the great utility of the midpoint method: we can eliminate as many of the leading error terms as we wish by Richardson’s extrapolation. For example, we could

compute y(x 0 + H) with a certain value of h and then repeat the process with h/2. Denoting the corresponding results by g(h) and g(h/2), Richardson’s extrapolation— see Eq. (5.9)—then yields the improved result

4g(h/2) − g(h)

better (x 0 + H) =

which is fourth-order accurate. Another round of integration with h/4 followed by Richardson’s extrapolation get us sixth-order accuracy, etc.

The y’s in Eqs. (7.26) should be viewed as a intermediate variables, because unlike y(x 0 + H ), they cannot be refined by Richardson’s extrapolation.

The function midpoint in this module combines the midpoint method with Richard- son extrapolation. The first application of the midpoint method uses two integration steps. The number of steps is doubled in successive integrations, each integration being followed by Richardson extrapolation. The procedure is stopped when two suc- cessive solutions differ (in the root-mean-square sense) by less than a prescribed tolerance.

function y = midpoint(dEqs,x,y,xStop,tol) % Modified midpoint method for intergration of y’ = F(x,y). % USAGE: y = midpoint(dEqs,xStart,yStart,xStop,tol) % INPUT: % dEqs

= handle of function that returns the first-order %

differential equations F(x,y) = [dy1/dx,dy2/dx,...]. % x, y

= initial values; y must be a row vector. % xStop = terminal value of x. % tol

= per-step error tolerance (default = 1.0e-6).

% OUTPUT: % y = y(xStop).

if size(y,1) > 1 ; y = y’; end % y must be row vector if nargin <5; tol = 1.0e-6; end kMax = 51; n = length(y); r = zeros(kMax,n);

% Storage for Richardson extrapolation. % Start with two integration steps. nSteps = 2; r(1,1:n) = mid(dEqs,x,y,xStop,nSteps); rOld = r(1,1:n); for k = 2:kMax

% Double the number of steps & refine results by % Richardson extrapolation. nSteps = 2*k; r(k,1:n) = mid(dEqs,x,y,xStop,nSteps); r = richardson(r,k,n); % Check for convergence. dr = r(1,1:n) - rOld;

e = sqrt(dot(dr,dr)/n); if e < tol; y = r(1,1:n); return; end rOld = r(1,1:n);

end error(’Midpoint method did not converge’)

function r = richardson(r,k,n) % Richardson extrapolation. for j = k-1:-1:1

c =(k/(k-1))ˆ(2*(k-j)); r(j,1:n) =(c*r(j+1,1:n) - r(j,1:n))/(c - 1.0);

end return

function y = mid(dEqs,x,y,xStop,nSteps) % Midpoint formulas.

h = (xStop - x)/nSteps; y0 = y; y1 = y0 + h*feval(dEqs,x,y0); for i = 1:nSteps-1 h = (xStop - x)/nSteps; y0 = y; y1 = y0 + h*feval(dEqs,x,y0); for i = 1:nSteps-1

end y = 0.5*(y1 + y0 + h*feval(dEqs,x,y2));

Bulirsch–Stoer Algorithm

When used on its own, the module midpoint has a major shortcoming: the solution at points between the initial and final values of x cannot be refined by Richardson extrapolation, so that y is usable only at the last point. This deficiency is rectified in the Bulirsch–Stoer method. The fundamental idea behind the method is simple: apply the midpoint method in a piecewise fashion. That is, advance the solution in stages of length H, using the midpoint method with Richardson extrapolation to perform the integration in each stage. The value of H can be quite large, since the precision of the result is determined mainly by the step length h in the midpoint method, not by H.

The original Bulirsch and Stoer technique 19 is a complex procedure that incorpo- rates many refinements missing in our algorithm. However, the function bulStoer given below retains the essential ideas of Bulirsch and Stoer.

What are the relative merits of adaptive Runge–Kutta and Bulirsch–Stoer meth- ods? The Runge–Kutta method is more robust, having higher tolerance for nonsmooth functions and stiff problems. In most applications where high precision is not required, it also tends to be more efficient. However, this is not the case in the computation of high-accuracy solutions involving smooth functions, where the Bulirsch–Stoer algo- rithm shines.

This function contains a simplified algorithm for the Bulirsch–Stoer method.

function [xSol,ySol] = bulStoer(dEqs,x,y,xStop,H,tol) % Simplified Bulirsch-Stoer method for integration of y’ = F(x,y). % USAGE: [xSol,ySol] = bulStoer(dEqs,x,y,xStop,H,tol) % INPUT: % dEqs

= handle of function that returns the first-order %

differential equations F(x,y) = [dy1/dx,dy2/dx,...].

19 Stoer, J., and Bulirsch, R., Introduction to Numerical Analysis, Springer, 1980.

% x, y = initial values; y must be a row vector. % xStop = terminal value of x. %H

= increment of x at which solution is stored.

% tol

= per-step error tolerance (default = 1.0e-6). % OUTPUT: % xSol, ySol = solution at increments H.

if size(y,1) > 1 ; y = y’; end % y must be row vector if nargin < 6; tol = 1.0e-6; end n = length(y); xSol = zeros(2,1); ySol = zeros(2,n); xSol(1) = x; ySol(1,:) = y; k = 1; while x < xStop

k = k + 1; H = min(H,xStop - x); y = midpoint(dEqs,x,y,x + H,tol); x = x + H; xSol(k) = x; ySol(k,:) = y;

end

EXAMPLE 7.10 Compute the solution of the initial value problem

y ′ = sin y

y(0) = 1

at x = 0.5 with the midpoint formulas using n = 2 and n = 4, followed by Richardson extrapolation (this problem was solved with the second-order Runge–Kutta method in Example 7.3).

Solution With n = 2 the step length is h = 0.25. The midpoint formulas, Eqs. (7.26) and (7.27), yield

y 1 =y 0 + hf 0 = 1 + 0.25 sin 1.0 = 1.210 368 y 2 =y 0 + 2hf 1 = 1 + 2(0.25) sin 1.210 368 = 1.467 87 3

1 y h (0.5) = (y

2 1 +y 0 + hf 2 )

= 2 (1.210 368 + 1.467 87 3 + 0.25 sin 1.467 87 3) = 1.463 459

Using n = 4 we have h = 0.125 and the midpoint formulas become

y 1 =y 0 + hf 0 = 1 + 0.125 sin 1.0 = 1.105 184

y 2 =y 0 + 2hf 1 = 1 + 2(0.125) sin 1.105 184 = 1.223 387 y 3 =y 1 + 2hf 2 = 1.105 184 + 2(0.125) sin 1.223 387 = 1.340 248 y 4 =y 2 + 2hf 3 = 1.223 387 + 2(0.125) sin 1.340 248 = 1.466 772

1 y h/2 (0.5) = (y

2 4 +y 3 + hf 4 )

= 2 (1.466 772 + 1.340 248 + 0.125 sin 1.466 772) = 1.465 672

Richardson extrapolation results in

3 = 1.466 410 which compares favorably with the “true” solution y(0.5) = 1.466 404. EXAMPLE 7.11

y(0.5) =

E (t )

The differential equations governing the loop current i and the charge q on the ca- pacitor of the electric circuit shown are

di

dq

dt + Ri + C = E(t)

dt =i

If the applied voltage E is suddenly increased from zero to 9 V, plot the resulting loop

Solution Letting

y= y

and substituting the given data, the differential equations become

˙y =

y ˙ 2 (−Ry 2 −y 1 /

C + E) /L

The initial conditions are

& ' 0 y(0) = 0

We solved the problem with the function bulStoer using the increment H =

0.5 s. The following program utilizes the plotting facilities of MATLAB: % Example 7.11 (Bulirsch-Stoer integration)

[xSol,ySol] = bulStoer(@fex7 _ 11,0,[0 0],10,0.5); plot(xSol,ySol(:,2),’k:o’) grid on xlabel(’Time (s)’) ylabel(’Current (A)’)

Recall that in each interval H (the spacing of open circles) the integration was per- formed by the modified midpoint method and refined by Richardson’s extrapolation.

PROBLEM SET 7.2

1. Derive the analytical solution of the problem

y ′′ +y ′ − 380y = 0

y(0) = 1

y ′ (0) = −20

Would you expect difficulties in solving this problem numerically?

2. Consider the problem

y ′ = x − 10y

y(0) = 10

(a) Verify that the analytical solution is y(x) = 0.1x − 0.01 + 10.01e −10x . (b) Deter- mine the step size h that you would use in numerical solution with the (nonadap-

tive) Runge–Kutta method.

3. Integrate the initial value problem in Prob. 2 from x = 0 to 5 with the Runge– Kutta method using (a) h = 0.1; (b) h = 0.25; and (c) h = 0.5. Comment on the

results.

4. Integrate the initial value problem in Prob. 2 from x = 0 to 10 with the adaptive Runge–Kutta method.

mc

The differential equation describing the motion of the mass–spring–dashpot sys- tem is

y+ ¨

˙ m y+ m y=0

where m = 2 kg, c = 460 N·s/m and k = 450 N/m. The initial conditions are y(0) =

0.01 m and ˙ y(0) = 0. (a) Show that this is a stiff problem and determine a value of

h that you would use in numerical integration with the nonadaptive Runge–Kutta method. (b) Carry out the integration from t = 0 to 0.2 s with the chosen h and plot ˙ y vs. t.

6. Integrate the initial value problem specified in Prob. 5 with the adaptive Runge– Kutta method from t = 0 to 0.2 s, and plot ˙y vs. t.

7. Compute the numerical solution of the differential equation

y ′′ = 16.81y

from x = 0 to 2 with the adaptive Runge–Kutta method. Use the initial conditions (a) y(0) = 1.0, y ′ (0) = −4.1; and (b) y(0) = 1.0, y ′ (0) = −4.11. Explain the large difference in the two solutions. Hint: derive the analytical solutions.

8. Integrate

y ′ (0) = 0 from x = 0 to 3.5. Investigate whether the sudden increase in y near the upper

y ′′ +y ′ −y 2 =0

y(0) = 1

limit is real or an artifact caused by instability. Hint: experiment with different values of h.

9. Solve the stiff problem—see Eq. (7.16)

y ′ (0) = 0 from x = 0 to 0.2 with the adaptive Runge–Kutta method and plot y ′ vs. x.

y ′′ + 1001y ′ + 1000y = 0

y(0) = 1

10. Solve √

y ′ (0) = 2 with the adaptive Runge–Kutta method from x = 0 to 5 (the analytical solution is √

y ′′ + 2y ′ + 3y = 0

y(0) = 0

y=e −x sin 2x).

11. Use the adaptive Runge–Kutta method to solve the differential equation

y ′′ = 2yy ′

from x = 0 to 10 with the initial conditions y(0) = 1, y ′ (0) = −1. Plot y vs. x.

12. Repeat Prob. 11 with the initial conditions y(0) = 0, y ′ (0) = 1 and the integration range x = 0 to 1.5.

13. Use the adaptive Runge–Kutta method to integrate

from x = 0 to 5 and plot y vs. x.

14. Solve Prob. 13 with the Bulirsch–Stoer method using H = 0.5.

15. Integrate

y ′ (1) = −2 from x = 1 to 20, and plot y and y ′ vs. x. Use the Bulirsch–Stoer method.

x 2 y ′′ + xy ′ +y=0

The magnetized iron block of mass m is attached to a spring of stiffness k and free length L. The block is at rest at x = L when the electromagnet is turned on,

exerting the repulsive force F = c/x 2 on the block. The differential equation of the resulting motion is

m¨ x=

x 2 − k(x − L)

Determine the amplitude and the period of the motion by numerical integration with the adaptive Runge–Kutta method. Use c = 5 N·m 2 , k = 120 N/m, L = 0.2 m and m = 1.0 kg.

The bar ABC is attached to the vertical rod with a horizontal pin. The assembly is free to rotate about the axis of the rod. In the absence of friction, the equations of motion of the system are

φ = −2˙θ ˙φ cot θ ¨ If the system is set into motion with the initial conditions θ (0) = π/12 rad, ˙θ(0) =

¨θ = ˙φ 2 sin θ cos θ

0, φ(0) = 0 and ˙φ(0) = 20 rad/s, obtain a numerical solution with the adaptive Runge–Kutta method from t = 0 to 1.5 s and plot ˙φ vs. t.

18. Solve the circuit problem in Example 7.11 if R = 0 and

0 when t < 0

E (t) =

9 sin π t when t ≥ 0

19. Solve Prob. 21 in Problem Set 1 if E = 240 V (constant).

E (t )

Kirchoff’s equations for the circuit in the figure are

di L 1

dt +R 1 i 1 +R 2 (i 1 −i 2 ) = E(t)

Using the data R 1 2

20 V if 0 < t < 0.005 s

E (t) =

0 otherwise

plot the transient loop currents i 1 and i 2 from t = 0 to 0.05 s.

21. Consider a closed biological system populated by M number of prey and N number of predators. Volterra postulated that the two populations are related by the differential equations

M = aM − bMN ˙ N = −cN + dMN ˙

where a, b, c and d are constants. The steady-state solution is M 0 = c/d, N 0 = a/b; if numbers other than these are introduced into the system, the populations undergo periodic fluctuations. Introducing the notation

y 1 = M/M 0 y 2 = N/N 0

allows us to write the differential equations as

y ˙ 1 = a(y 1 −y 1 y 2 ) y ˙ 2 = b(−y 2 +y 1 y 2 )

Using a = 1.0/year, b = 0.2/year, y 1 (0) = 0.1 and y 2 (0) = 1.0, plot the two popu- lations from t = 0 to 50 years.

22. The equations

u = −au + av ˙ v = cu − v − uw ˙

w = −bw + uv ˙

known as the Lorenz equations, are encountered in theory of fluid dynamics. Letting a = 5.0, b = 0.9 and c = 8.2, solve these equations from t = 0 to 10 with

the initial conditions u(0) = 0, v(0) = 1.0, w(0) = 2.0 and plot u(t). Repeat the solution with c = 8.3. What conclusions can you draw from the results?

MATLAB Functions

[xSol,ySol] = ode23(dEqs,[xStart,xStop],yStart) low-order (probably third order) adaptive Runge–Kutta method. The function dEqs must return the differential equations as a column vector (recall that runKut4 and runKut5 require row vectors). The range of integration is from xStart to xStop with the initial conditions yStart (also a column vector).

[xSol,ySol] = ode45(dEqs,[xStart xStop],yStart) is similar to ode23 , but

uses a higher-order Runge–Kutta method (probably fifth order).

These two methods, as well as all the methods described in in this book, belong to a group known as single-step methods. The name stems from the fact that the information at a single point on the solution curve is sufficient to compute the next point. There are also multistep methods that utilize several points on the curve to extrapolate the solution at the next step. These methods were popular once, but have lost some of their luster in the last few years. Multistep methods have two shortcomings that complicate their implementation:

r The methods are not self-starting, but must be provided with the solution at the first few points by a single-step method.

r The integration formulas assume equally spaced steps, which makes it makes it difficult to change the step size.

Both of these hurdles can be overcome, but the price is complexity of the algorithm that increases with sophistication of the method. The benefits of multistep methods are minimal—the best of them can outperform their single-step counterparts in cer- tain problems, but these occasions are rare. MATLAB provides one general-purpose multistep method:

[xSol,ySol] = ode113(dEqs,[xStart xStop],yStart) uses the variable- order Adams–Bashforth–Moulton method.

MATLAB has also several functions for solving stiff problems. These are ode15s (this is the first method to try when a stiff problem is encountered), ode23s , ode23t and ode23tb .

Dokumen yang terkait

WARTA ARDHIA Jurnal Perhubungan Udara Harapan dan Kepentingan Pengguna Jasa Angkutan Udara Terhadap Pelayanan di Bandar Udara H.AS Hanandjoeddin–Tanjung Pandan Belitung Air Transport Passenger Expectations and Interest of Airport Services in H.A.S Hanandj

0 0 12

The Evaluation of Air Transportation Infrastructure Performance in Indonesian Capital Province

0 0 10

Demand Forecasting of Modal Share of Bandara Internasional Jawa Barat (BJIB) in Kertajati Majalengka

0 1 12

WARTA ARDHIA Jurnal Perhubungan Udara Analisis Flutter Pada Uji Model Separuh Sayap Pesawat N219 di Terowongan Angin Kecepatan Rendah The Analysis of Half Wing Flutter Test N219 Aircraft Model in The Low Speed Wind Tunnel

0 0 8

WARTA ARDHIA Jurnal Perhubungan Udara Penerapan Skema Badan Layanan Umum Dalam Pengelolaan Keuangan Bandar Udara Internasional Jawa Barat The Application of Badan Layanan Umum Scheme in The Financial Management of Jawa Barat International Airport

0 0 16

Speech Recognition Conceptual Design in Aircraft Communications to Reduce Flight Communication Mistake

0 0 10

WARTA ARDHIA Jurnal Perhubungan Udara Perencanaan Integrasi Transportasi Antarmoda Dalam Pembangunan Bandar Udara (Studi Kasus: Pembangunan Bandar Udara di Kertajati) Intermodal Transportation Integration Planning in Airport Development (Case Study: Airpo

0 0 8

WARTA ARDHIA Jurnal Perhubungan Udara Gaya Hambat Saat Hidro Planing dan Gaya Angkat Aerodinamika Saat Cruise di Efek Permukaan pada Pesawat Wing in Surface Effect The Hump Drags During Hydro Planing and Aerodynamic Lift During Cruise in Surface Effect Al

0 0 8

WARTA ARDHIA Jurnal Perhubungan Udara Peran Jasa Ground Handling Terhadap Pelayanan Perusahaan Air Freight di Bali dalam Menghadapi Kompetisi Global The Role of Ground Handling Services to The Air Freight Services in Bali in The Face of Global Competition

0 1 14

Advance Engineering Mathematic chaper 1

0 0 63