July 2013
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
This chapter is devoted to solving ordinary differential equations of the form 𝑑𝑦 𝑑𝑥
= 𝑓(𝑥, 𝑦)
We can use a numerical method to solve such an equation for the velocity of the falling parachutist. The method is of the general form
New value = old value + slope × step size or, in mathematical terms, 𝑦 𝑖+1
= 𝑦 𝑖
+ ∅ℎ
According to this equation, the slope estimate of ∅ is used to extrapolate from an old value 𝑦 𝑖
to a new value 𝑦 𝑖+1
over a distance h (next figure).
All one-step methods can be expressed in this general form, with the only difference being the manner in which the slope is estimated. As in the falling parachutist problem, the simplest approach is to use the differential equation to estimate the slope in the form of the first derivative at x i
.
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
25.1 Euler’s Method
The first derivative provides a direct estimate of the slope at 𝑥 𝑖
(next figure)
∅ = 𝑓(𝑥 𝑖
, 𝑦 𝑖
) where 𝑓(𝑥 𝑖
, 𝑦 𝑖
) is the differential equation evaluated at 𝑥 𝑖
and 𝑦 𝑖
.
This estimate can be substituted into 𝑦 𝑖+1
= 𝑦 𝑖
+ 𝑓(𝑥 𝑖
, 𝑦 𝑖
)ℎ (25.2)
This formula is referred to as Euler’s Method. A new value of y is predicted using the slope (equal to the first derivative at the original value of x) to extrapolate linearly over the step size h. (previous figure)
لودج ىف هقيقد نوعبر أ و هسمخ زجح ا
. قيمعلا ءاخرتس لال عوبس أ لك كلامع أ
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
EXAMPLE 25.1 Euler’s Method
Problem Statement:
Use Euler’s method to numerically integrate 𝑑𝑦 𝑑𝑥
= −2𝑥 3 + 12𝑥 2 − 20𝑥 + 8.5
from x = 0 to x = 4 with a step size of 0.5. The initial condition at x = 0 is y = 1. Recall that the exact solution is given by 𝑦 = −0.5𝑥 4 + 4𝑥 3 + 10𝑥 2 − 8.5𝑥 + 1
Solution:
Equation (25.2) can be used to implement Euler’s Method: 𝑦(0.5) = 𝑦(0) + 𝑓(0, 1) 0.5
where y(0) = 1 and the slope estimate at x = 0 is 𝑓(0, 1) = −2(0) 3 + 12(0) 2 − 20(0) + 8.5 = 8.5
𝑦(0.5) = 1.0 + 8.5(0.5) = 5.25
The true solution at x = 0.5 is 𝑦 = −0.5(0.5) 4 + 4(0.5) 3 − 10(0.5) 2 − 8.5(0.5) + 1 = 3.21875
𝐸 𝑡
= 𝑡𝑟𝑢𝑒 − 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑒 = 3.21875 − 5.25 = −2.03125
Or, expressed as percent relative error, ε t
= -63.1%. For the second step, 𝑦(1) = 𝑦(0.5) + 𝑓(0.5, 5.25)
= 5.25 + [−2(0.5) 3 + 12(0.5) 2 − 20(0.5) + 8.5]0.5
= 5.875
The true solution at x = 1.0 is 3.0, and therefore, the percent relative error is -95.8%. The computation is repeated, and the results are compiled in the next table and the next figure. Note that the error can be reduced by using a smaller step size
رفواااات ةاااا يدحلا نوااااسيرولفلا فيباااااصم
ةيديلقتلا فيباصملا هكلهتست امم % 80
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
25.2 Improvements of Euler’s Method
A fundamental source of error in Euler’s method is that the derivative at the beginning of the interval is assumed to apply across the entire interval. Two simple modifications are available to help overcome this shortcoming. Both modifications actually belong to a larger class of solution techniques called Runge-Kutta methods. ةظفاحملا نابر لا مه ناك اذإ
هتنيفسف ، ةنيفسلا هملاس ىلع
.ءانيملا حربت نل
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
However, because they have a very straightforward graphical interpretation, we will present them prior to their formal derivation as
Runge-Kutta methods.
25.2.1 Heun’s Method
One method to improve the estimate of the slope involves the determination of two derivatives for the interval – one at the initial point and another at the end point. The two derivatives are then averaged to obtain an improved estimate of the slope for the entire interval.
This approach, called Heun’s method, is shown graphically in the next figure.
هاااهركت نااامم وااالو قاااحلا لااابقا
قيدص نم ولو لطابلا ضغباو
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
Recall that in Euler’s methods, the slope at the beginning of an interval 𝑦 𝑖
′
= 𝑓(𝑥 𝑖
, 𝑦 𝑖
) is used to extrapolate linearly to 𝑦 𝑖+1
: 𝑦
0 𝑖+1
= 𝑦 𝑖
+ 𝑓(𝑥 𝑖
, 𝑦 𝑖
)ℎ
For the standard Euler method we would stop at this point.
However, in Heun’s method the 𝑦
0 𝑖+1
calculated in the previous equation is not the final answer, but an intermediate prediction.
This is why we have distinguished it with a superscript 0.
The previous equation is called a predictor equation. It provided an estimate of y i+1
that allows the calculation of an estimated slope at the end of the interval: 𝑦 ′ 𝑖+1
= 𝑓(𝑥 𝑖+1
, 𝑦 0 𝑖+1
)
Thus, the two slopes can be combined to obtain an average slope for the interval: 𝑦̅ ′ = 𝑦 𝑖
′
+ 𝑦
′ 𝑖+1
2
= 𝑓(𝑥 𝑖
, 𝑦 𝑖
)+ 𝑓(𝑥 𝑖+1
, 𝑦
0 𝑖+1
)
2
This average slope is then used to extrapolate linearly from 𝑦 𝑖
to 𝑦 𝑖+1 using
Euler’s method: 𝑦 𝑖+1
= 𝑦 𝑖
+ 𝑓(𝑥 𝑖
, 𝑦 𝑖
)+ 𝑓(𝑥 𝑖+1
, 𝑦
0 𝑖+1
)
ℎ
2 which is called a corrector equation.
،اديج كسفن فرعت نأ تدرأ نإ
تنك ام ركذت كظاقيتسا درجمب
تنأ وه اذهف هب ملحت
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
The Heun method is a predictor-corrector approach.
The Heun method is the only one-step predictor-corrector method described in this book. As derived above, it can be expressed concisely as
Predictor (previous figure a): 𝑦 0 𝑖+1
= 𝑦 𝑖
+ 𝑓(𝑥 𝑖
, 𝑦 𝑖
)ℎ
Corrector (figure b): 𝑦 𝑖+1
= 𝑦 𝑖
+ 𝑓(𝑥 𝑖
,𝑦 𝑖
)+ 𝑓(𝑥 𝑖+1
,𝑦
0 𝑖+1
)
2
ℎ (25.16)
Note that because the previous equation has 𝑦 𝑖+1
on both sides of the equal sign, it can be applied in an iterative fashion.
That is, an old estimate can be used repeatedly to provide an improved estimate of 𝑦 𝑖+1
. The process is shown in the next figure.
ةحار تارتف كسفنل لعجا
،كتسارد تقو للاخ ةريصق
ةريصق ةملك ىسنت لا
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
It should be understood that this iterative process does not necessarily converge on the true answer but will converge on an estimate with a finite truncation error, as will be demonstrated in the following example.
As with the similar iterative methods, a termination criterion for convergence of the corrector is provided by
|𝜀 𝑎
| = | 𝑦 𝑗 𝑖+1
− 𝑦 𝑗−1 𝑖+1 𝑦 𝑗 𝑖+1
| where 𝑦 𝑗−1 𝑖+1
and 𝑦 𝑗 𝑖+1
are the result from the prior and the present iteration of the corrector, respectively.
امك امامت ،ريخلا ىلع كريغ لد
هيلع نورخلآا كلدي نأ بحت
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
EXAMPLE 25.5 Heun’s Method
Problem Statement:
Use Heun’s method to integrate y’ = 4e 0.8x
– 0.5y from x = 0 to x = 4 with a step size of 1. The initial condition at x = 0 is y = 2.
Solution:
Before solving the problem numerically, we can use calculus to determine the following analytical solution: 𝑦 =
4
13
(𝑒 0.8𝑥 − 𝑒 −0.5𝑥 ) + 2𝑒 −0.5𝑥
This formula can be sued to generate the true solution values in the next table
First, the slope at at ( 𝑥
0
, 𝑦
0
) is calculated as 𝑦 ′
0
= 4𝑒 0 − 0.5(2) = 3
This result is quite different from the actual average slope for the interval from 0 to 1.0, which is equal to 4.1946, as calculated from the differential equation.
نم ر كأ كيلع يتلا تابجاولا نوكت ابلاغ
تابجاولاب أدبأ ،اهقحتست يتلا قوقحلا
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
Continue:
The numerical solution is obtained by using the predictor to obtain an estimate of y at 1.0: 𝑦 0
1
= 2 + 3(1) = 5
Note that this is the result that would be obtained by the standard Euler method. The true value in the previous table shows that it corresponds to a percent relative error of 19.3 percent.
Now, to improve the estimate for 𝑦 𝑖+1
, we use the value 𝑦 0
1
to predict the slope at the end of the interval 𝑦 ′
1
= 𝑓(𝑥
1
, 𝑦 0
1
) = 4𝑒 0.8(1) − 0.5(5) = 6.402164
Which can be combined with the initial slope to yield an average slope over the interval from x = 0 to 1 𝑦 ′ =
3+ 6.402164
2
= 4.701082
which is closer to the true average slope of 4.1946.
This result can then be substituted into the corrector to give the prediction at x = 1 𝑦
1
= 2 + 4.701082(1) = 6.701082
which represents a percent relative error of -8.18 percent.
Thus, the Heun method without iteration of the corrector reduces the absolute value of the error by a factor of 2.4 as compared with Euler’s method.
اذام ،انجاوز خيرات قفاوي مويلا :ةجوزلا
.دادح ةقيقد فقنل :جوزلا ،لعفنس
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
Continue:
Now this estimate can be used to refine or correct the prediction of 𝑦
1
by substituting the new result back into the right-hand side of equation
(25.16): 𝑦
1
= 2 +
[ 3+ 4𝑒
0.8(1)
− 0.5(6.701082)]
2
1 = 6.275811
which represents an absolute percent relative error of 1.31 percent.
This result, in turn, can be substituted back into equation (25.16) to further correct: 𝑦
1
= 2 +
[ 3+ 4𝑒
0.8(1)
− 0.5(6.275811)]
1 = 6.382129
2 which represents an |𝜀 𝑡
| of 3.03%.
Notice how the errors sometimes grow as the iterations proceed.
Such increases can occur, especially for large step sizes, and they prevent us from drawing the general conclusion that an additional iteration will always improve the result.
However, for a sufficiently small step size, the iterations should eventually converge on a single value. For our case, 6.360865, which represents a relative error of 2.68 percent, is attained after 15 iterations.
The previous table shows results for the remainder of the computation using the method with 1 and 15 iterations per step.
ساسلأا يف وه فجانلا صخشلا
ليختي نأ عيطتسي صخش
عقاو ىلإ هلايخ لوحيو
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
In the previous example, the derivative is a function of both the dependent variable y and the independent variable x.
For cases such as polynomials, where the ODE is solely a function of the independent variable, the predictor step is not required and the corrector is applied only once for each iteration. For such cases, the technique is expressed concisely as 𝑦 𝑖+1
= 𝑦 𝑖
+ 𝑓(𝑥 𝑖
)+ 𝑓(𝑥 𝑖+1
)
2
ℎ (25.18)
Notice the similarity between the right-hand side of the previous equation and the trapezoidal rule. The connection between the two methods can be formally demonstrated by starting with the ordinary differential equation 𝑑𝑥 𝑑𝑦
= 𝑓(𝑥)
This equation can be solved for y by integration:
∫ 𝑦 𝑖+1 𝑦 𝑖 𝑑𝑦 = ∫ 𝑥 𝑖+1 𝑥 𝑖
𝑓(𝑥)𝑑𝑥 which yields 𝑦 𝑖+1
− 𝑦 𝑖
= ∫ 𝑥 𝑖+1 𝑥 𝑖
𝑓(𝑥)𝑑𝑥 or 𝑦 𝑖+1
= 𝑦 𝑖
+ ∫ 𝑥 𝑖+1 𝑥 𝑖
𝑓(𝑥)𝑑𝑥 (25.21)
لك روتكدلا عم ةرضاحم اوبتكيب هبلط
ةقرولا اوعطقي ةروبسلا فسمي ام
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
Now, recall that the trapezoidal rule is defined as
∫ 𝑥 𝑖+1 𝑥 𝑖
𝑓(𝑥)𝑑𝑥 ≅ 𝑓(𝑥 𝑖
)+ 𝑓(𝑥 𝑖+1
)
2
ℎ where h = 𝑥 𝑖+1
− 𝑥 𝑖
. Substituting equations yields 𝑦 𝑖+1
= 𝑦 𝑖
+ 𝑓(𝑥 𝑖
)+ 𝑓(𝑥 𝑖+1
)
2
ℎ which is equivalent to equation 25.18
Because the previous equation is a direct expression of the trapezoidal rule, the local truncation error is given by
𝐸 𝑡
= − 𝑓
′′
(𝜉)
ℎ 3
12 where 𝜉 is between 𝑥 𝑖
and 𝑥 𝑖+1
.
Thus, the method is second order because the second derivative of the ODE is zero when the true solution is quadratic.
In addition, the local and global errors are 𝑂(ℎ 3 ) and 𝑂(ℎ 2 ) , respectively.
Therefore, decreasing the step size decreases the error at a faster rate than for Euler’s method.
The next figure, which shows the result of using Heun’s method to solve the polynomial from example 25.1 demonstrates this behavior.
،هاااملكت اااام ناااكل ،هااابحت صخاااش
؟نونجم كيلع اولوقي هتملك اذإو
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
25.2.2 The Midpoint (or Improved Polygon) Method
The next figure illustrates another simple modification of Euler’s method. Called the mid-point method, this technique uses Euler’s method to predict a value of y at the midpoint of the interval (figure a): 𝑦 𝑖+1/2
= 𝑦 𝑖
+ 𝑓(𝑥 𝑖
, 𝑦 𝑖
) ℎ
2
Then, this predicted value is used to calculate a slope at the midpoint: 𝑦 ′ 𝑖+1/2
= 𝑓(𝑥 𝑖+1/2
, 𝑦 𝑖+1/2
) which is assumed to represent a valid approximation of the average slope for the entire interval. This slope is then used to extrapolate linearly from 𝑥 𝑖
to 𝑥 𝑖+1
(figure b): 𝑦 𝑖+1
= 𝑦 𝑖
+ 𝑓(𝑥 𝑖+1/2
, 𝑦 𝑖+1/2
) ℎ (25.27)
ريغ فرح 24 نم ةنوكم ةلمج
ايموي اه رركن نأ دبلا طوقنم
؟تارم رشع نم ر كأ
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
Observe that because 𝑦 𝑖+1
is not on both sides, the corrector cannot be applied iteratively to improve the solution. This approach can also be linked to Newton-Cotes integration formulas.
Recall that the simplest Newton-Cotes open integration formula, which is called the midpoint method, can be represented as 𝑏
∫ 𝑓(𝑥)𝑑𝑥 = ≅ (𝑏 − 𝑎)𝑓(𝑥
1
) where 𝑥
1
is the midpoint of the interval (a, b). Using the nomenclature for the present case, it can be expressed as
∫ 𝑥 𝑥 𝑖 𝑖+1 𝑓(𝑥)𝑑𝑥 ≅ ℎ 𝑓(𝑥 𝑖+1/2
)
،دعر لولأا :ءانبأ اهدنع دمح أ مأ
اذامف ،رطم :ثلا لا ،قرب :ينا لا
؟عبارلا مسا نوكي نأ عقوتت
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
Substitution of this formula into equation (25.21) yields the equation
(25.27). Thus, just as the Heun method can be called the trapezoidal rule, the midpoint method gets its name from the underlying integration formula upon which it is based.
The midpoint method is superior to Euler’s method because it utilizes a slope estimate at the midpoint of the prediction interval.
25.3 Runge-Kutta Methods
Runge-Kutta (RK) methods achieve the accuracy of a Taylor series approach without requiring the calculation of higher derivatives.
Many variations exist but all can be cast in the generalized form of 𝑦 𝑖+𝜆
= 𝑦 𝑖
+ 𝜙(𝑥 𝑖
, 𝑦 𝑖
, ℎ)ℎ where 𝜙(𝑥 𝑖
, 𝑦 𝑖
, ℎ) is called an increment function, which can be interpreted as a representative slope over the interval.
The increment function can be written in general form as 𝜙 = 𝑎
1 𝑘
1
+ 𝑎
2 𝑘
2
+ … + 𝑎 𝑛 𝑘 𝑛
همدختسي كلذ عمو هلكمت تنأ ءيش
؟كونذئتسي نأ نود نورخلآا
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013 where the a’s are constants and the k’s are 𝑘
1
= 𝑓(𝑥 𝑖
, 𝑦 𝑖
) 𝑘
2
= 𝑓(𝑥 𝑖
+ 𝑝
1 ℎ, 𝑦 𝑖
+ 𝑞
11 𝑘
1 ℎ) 𝑘
3
= 𝑓(𝑥 𝑖
+ 𝑝
2 ℎ, 𝑦 𝑖
+ 𝑞
21 𝑘
1 ℎ +𝑞
22 𝑘
2 ℎ)
.
.
. 𝑘 𝑛
= 𝑓(𝑥 𝑖
+ 𝑝 𝑛−1 ℎ, 𝑦 𝑖
+ 𝑞 𝑛−1,1 𝑘
1 ℎ +𝑞 𝑛−1,2 𝑘
2 ℎ + ⋯ +𝑞 𝑛−1,𝑛−1 𝑘 𝑛−1 ℎ ) where the p’s and q’s are constants.
Notice that the k’s are recurrence relationships. That is, k
1
appears in the equation for k
2
, which appears in the equation for k
3
, and so forth.
Because each k is a functional evaluation, this recurrence makes RK methods efficient for computer calculations.
Various types of Runge-Kutta methods can be devised by employing different numbers of terms in the increment function as specified by n.
Note that the first-order RK method with n = 1 is, in fact, Euler’s method.
Once n is chosen, values for the a’s, p’s and q’s are evaluated by setting equation (25.28) equal to terms in a Taylor series expansion.
Thus, at least for the lower-order versions, the number of terms, n, usually represents the order of the approach. امئاد كانهف ،ادبأ يهتني لا رملأا
يلاتلا فدهلاو ، ةيلاتلا ةياغلا
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
For example, second-order RK methods use an increment function with two terms (n=2). These second-order methods will be exact if the solution to the differential equation is quadratic, the local truncation error is O(h 3 ) and the global error is O(h 2 ). The third- and forth- order RK methods
( n=3 and 4, respectively) are developed. For these cases, the global truncation errors are O(h 3 ) and O(h 4 ) respectively.
25.3.1 Second-Order Runge-Kutta Methods
The second-order version of equation (25.28) is 𝑦 𝑖+1
= 𝑦 𝑖
+ 𝑓(𝑎
1 𝑘
1
+ 𝑎
2 𝑘
2
)ℎ where 𝑘
1
= 𝑓(𝑥 𝑖
, 𝑦 𝑖
) 𝑘
2
= 𝑓(𝑥 𝑖
+ 𝑝
1 ℎ, 𝑦 𝑖
+ 𝑞
11 𝑘
1 ℎ)
Values for a
1
, a
2
, p
1
, and q
11
are evaluated by setting the previous equation equal to a Taylor series expansion to the second-order term.
By doing this, we derive three equations to evaluate the four unknown constants. The three equations are 𝑎
1
+ 𝑎
2
= 1 𝑎
2 𝑝
1
=
1
2 𝑎
2 𝑞
11
=
1
2
،احيحص هلعفتس ام نكي مل اذإ
ام نكي مل اذإو ،هلعفت لاف
هلقت لاف ، اقداص هلوقتس
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
Because we have three equations with four unknowns, we must assume a value of one of the unknowns to determine the other three.
Suppose that we specify a value for a
2
. Then the previous three equations can be solved simultaneously for 𝑎
1
= 1 − 𝑎
2 𝑝
1
= 𝑞
11
=
1
2𝑎
2
Because we can choose an infinite number of values for 𝑎
2
, there are an infinite number of second-order RK methods. Every version would yield exactly the same results if the solution to the ODE were quadratic, linear or a constant. However, they yield different results when
(as is typically the case) the solution is more complicated. We present three of the most commonly used and preferred versions:
Heun Method with a Single Corrector (a
2
= ½)
Thus, a
1
= ½ and p
1
= q
11
= 1. These parameters when substituted, yield 𝑦 𝑖+1
= 𝑦 𝑖
+ (
1
2 𝑘
1
+
1
2 𝑘
2
) ℎ where 𝑘
1
= 𝑓(𝑥 𝑖
, 𝑦 𝑖
) 𝑘
2
= 𝑓(𝑥 𝑖
+ ℎ, 𝑦 𝑖
+ 𝑘
1 ℎ)
، ةلئسلأا ىلع ةباجلإا عيطتسي لقعل ا
لاوأ اههيجوت لايخلا ىلع بجي نكلو
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
Note that 𝑘
1
is the slope at the beginning of the interval and 𝑘
2
is the slope at the end of the interval. Consequently, this second-order
Runge-Kutta is actually Heun’s technique without iteration.
The Midpoint Method (a
2
= 1).
Thus, a
1
= 0, p
1
= q
11
= ½, and that gives 𝑦 𝑖+1
= 𝑦 𝑖
+ 𝑘
2 ℎ
Where 𝑘
1
= 𝑓(𝑥 𝑖
, 𝑦 𝑖
) 𝑘
2
= 𝑓 (𝑥 𝑖
+
1
2 ℎ, 𝑦 𝑖
+
1
2 𝑘
1 ℎ)
This is the midpoint method.
Ralston’s Method (a
2
= 2/3)
Choosing such value provides a minimal bound on the truncation error for the second-order RK algorithms. For this version, a
1
= 1/3, and p
1
= 3/2 and yields 𝑦 𝑖+1
= 𝑦 𝑖
+ (
1
3 𝑘
1
+
2
3 𝑘
2
)ℎ
Where 𝑘
1
= 𝑓(𝑥 𝑖
, 𝑦 𝑖
) 𝑘
2
= 𝑓 (𝑥 𝑖
+
3
4 ℎ, 𝑦 𝑖
+
3
4 𝑘
1 ℎ)
لمع لكش يف صرفلا ىفختت ام ة داع
سانلا مظعم اهيلع فرعتي لا كلذل ، قاش
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
EXAMPLE 25.6 Comparison of Various Second-Order RK Schemes
Problem Statement:
Use the midpoint method and Ralston’s method to numerically integrate 𝑓(𝑥, 𝑦) = −2𝑥 3 + 12𝑥 2 − 20𝑥 + 8.5
from x = 0 to x = 4 using a step size of 0.5. The initial condition at x = 0 is y = 1. Compare the results with the values obtained using another second-order RK algorithm, that is, the Heun method without corrector iteration (next table).
Solution:
The first step in the midpoint method is to compute 𝑘
1
= −2(0) 3 + 12(0) 2 − 20(0) + 8.5 = 8.5
However, because the ODE is a function of x only, this result has no bearing on the second step, and compute 𝑘
2
= −2(0.25) 3 + 12(0.25) 2 − 20(0.25) + 8.5 = 4.21875
امداانع ىااتح ، اداابأ ملااستسأ لا يااننإ
ادبأ فجنأ نل يننإ سانلا يل لوقي
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
Notice that this estimate of the slope is much closer to the average value for the interval (4.4375) than the slope at the beginning of the interval
(8.5) that would have been used for Euler’s method.
The slope at the midpoint can then be substituted to predict 𝑦(0.5) = 1 + 4.21875(0.5) = 3.109375 𝜀 𝑡
= 3.4%
The computation is repeated, and the results are summarized in the next figure and the previous table
For Ralston’s method, k
1
for the first interval also equals 8.5 and 𝑘
2
= −2(0.375) 3 + 12(0.375) 2 − 20(0.375) + 8.5 = 2.58203125
The average slope is computed by 𝜙 =
1
3
(8.5) +
2
3
(2.58203125) 𝑦(0.5) = 1 + 4.5546875(0.5) = 3.27734375 𝜀 𝑡
= −1.82%
The computation is repeated, and the results are summarized in the previous figure and table.
لشفلا كنكمي ةدحاو ةقيرط كان ه
ملاستسلاا يه كلتو ، اهب
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
Notice how all the second-order RK methods are superior to Euler’s method.
25.3.2 Third-Order Runge-Kutta Methods
For n = 3, a derivation similar to the one for the second-order method can be performed. The result of this derivation is six equations with eight unknowns. Therefore, values for two of the unknowns must be specified a priori in order to determine the remaining parameters.
One common version that results is 𝑦 𝑖+1
= 𝑦 𝑖
+
1
6
(𝑘
1
+ 4𝑘
2
+ 𝑘
3
)ℎ where 𝑘
1
= 𝑓(𝑥 𝑖
, 𝑦 𝑖
) 𝑘
2
= 𝑓 (𝑥 𝑖
+
1
2 ℎ, 𝑦 𝑖
+
1
2 𝑘
1 ℎ) 𝑘
3
= 𝑓(𝑥 𝑖
+ ℎ, 𝑦 𝑖
− 𝑘
1 ℎ + 2𝑘
2 ℎ)
Note that if the derivative is a function of x only, this third-order method reduces to Simpson’s 1/3 rule. The third-order RK methods have local and global errors of O(h 4 ) and O(h 3 ), respectively, and yield exact results when the solution is cubic. When dealing with polynomials, the previous equations will be exact when the differential equation is cubic and the solution is quadratic. This is because Simpson’s 1/3 rule provides exact integral estimates for cubics. اهفيضت ةنبل يه كراكفأ نم ة ركف لك نإ
كعيراشم ربق ىلإ وأ كملاحأ رصق ىلإ
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
25.3.3 Fourth-Order Runge-Kutta Methods.
The most popular RK methods are fourth order.
As with the second-order approaches, there are an infinite number of versions. The following is the most commonly used form, and we therefore call it the classical fourth-order RK method: 𝑦 𝑖+1
= 𝑦 𝑖
+
1
6
(𝑘
1
+ 2𝑘
2
+ 2𝑘
3
+ 𝑘
4
)ℎ where 𝑘
1
= 𝑓(𝑥 𝑖
, 𝑦 𝑖
) 𝑘
2
= 𝑓 (𝑥 𝑖
+
1
2 ℎ, 𝑦 𝑖
+
1
2 𝑘
1 ℎ) 𝑘
3
= 𝑓 (𝑥 𝑖
+
1
2 ℎ, 𝑦 𝑖
+
1
2 𝑘
2 ℎ) 𝑘
3
= 𝑓(𝑥 𝑖
+ ℎ, 𝑦 𝑖
+ 𝑘
3 ℎ)
Notice that for ODEs that are a function of x alone, the classical fourth-order RK method is similar to Simpson’s 1/3 rule.
In addition, the fourth-order RK method is similar to the Heun approach in that multiple estimates of the slope are developed in order to come up with an improved average slope for the interval.
As shown in the next figure, each of the k’s represents a slope.
نمث نكلو ,حداف ةيرحلاو ةماركلا نمث
. حدفأ دابعتسلاا و لذلا نع توكسلا
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
EXAMPLE 25.7 Classical Fourth-Order RK Method
Problem Statement:
(a) Use the classical fourth-order RK method to integrate 𝑓(𝑥, 𝑦) = −2𝑥 3 + 12𝑥 2 − 20𝑥 + 8.5
using a step size of = 0.5 and an initial condition of y = 1 at x = 0.
(b) Similarly, integrate 𝑓(𝑥, 𝑦) = 4𝑒 0.8𝑥 − 0.5𝑦 using h = 0.5 with y(0) = 2 from x = 0 to 0.5
Solution:
(a) Compute 𝑘
1
= 8.5
, 𝑘
2
= 4.21875
, 𝑘
3
= 4.21875
and 𝑘
4
= 1.25
𝑦(0.5) = 1 + {
1
6
[8.5 + 2(4.21875) + 2(4.21875) + 1.25] } 0.5
= 3.21875
which is exact. Thus, because the true solution is a quartic, the fourth-order method gives an exact result.
ناااكلو كاااتايح لااايطت نأ عيطتاااست لا
اقمعو اضرع ر كأ اهلعجت نأ نكمي
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
(b) The slope at the beginning of the interval is computed as 𝑘
1
= 𝑓(0, 2) = 4𝑒 0.8(0) − 0.5(2) = 3
This value is used to compute a value of u and a slope at the midpoint, 𝑦(0.25) = 2 + 3(0.25) = 2.75
𝑘
2
= 𝑓(0.25, 2.75) = 4𝑒 0.8(0.25) − 0.5(2.75) = 3.510611
This slope in turn is used to compute another value of y and another slope at the mid-point, 𝑦(0.25) = 2 + 3.510611 (0.25) = 2.877653
𝑘
3
= 𝑓(0.25,2.877653) = 4𝑒 0.8(0.25) − 0.5(2.877653) = 3.44678
Next, this slope is used to compute a value of y and a slope at the end of the interval, 𝑦(0.5) = 2 + 3.071785(0.5) = 3.723392
𝑘
4
= 𝑓(0.5, 3.723392) = 4𝑒 0.8(0.5) − 0.5(3.723392) = 4.105603
Finally, the four slope estimates are combined to yield an average slope. This average slope is then used to make the final prediction at the end of the interval. 𝜙 =
1
6
[2 + 2(3.510611) + 2(3.446785) + 4.106603] = 3.503399
𝑦(0.5) = 2 + 3.503399(0.5) = 3.751699
which compares favorably with the true solution of 3.751521.
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
Problem 25.7
Use the (a) Euler and (b) Heun (without iteration) methods to solve 𝑑
2 𝑦 𝑑𝑡 2
= 0.5 𝑡 + 𝑦 = 0 where y(0) = 2 and y’(0) = 0. Solve from x = 0 to 4 using h = 0.1.
Solution
The second-order ODE is transformed into a pair of first-order ODEs as in 𝑑𝑦 𝑑𝑡
= 𝑧 𝑦(0) = 2 𝑑𝑧 𝑑𝑡
= 0.5 𝑥 − 𝑦 𝑧(0) = 0
(a) The first few steps of Euler’s method are
0 x
0.1
2
2 y
0
-0.2 z
0
dy/dx
-0.2
-2
dz/dx
-1.95
0.2 1.98 -0.395
0.3 1.9405 -0.583
-0.395
-0.583
-1.88
-1.7905
0.4 1.8822 -0.76205 -0.76205 -1.6822
0.5 1.805995 -0.93027 -0.93027 -1.556
(b) For Heun (without iterating the corrector) the first few steps are x
0 2
0.1 1.99 y
0 z
0
dy/dx
-2
dz/dx
2 y end z end
-0.2
dy/dx
-0.2
dz/dx ave slope
-1.95 -0.1
-0.1975 -0.1975 -1.94 1.97025 -0.3915 -0.3915 -1.87025 -0.2945
0.2 1.96055 -0.38801 -0.38801 -1.86055 1.921749 -0.57407 -0.57407 -1.77175 -0.48104
0.3 1.912446 -0.56963 -0.56963 -1.76245 1.855483 -0.74587 -0.74587 -1.65548 -0.65775
0.4 1.846671 -0.74052 -0.74052 -1.64667 1.772619 -0.90519 -0.90519 -1.52262 -0.82286
0.5 1.764385 -0.89899 -0.89899 -1.51439 1.674486 -1.05043 -1.05043 -1.37449 -0.97471
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
Problem 25.9
Solve from t = 0 to 3 with h = 0.1 using
(a) Heun (without corrector) and
(b) Ralston’s 2 nd -order RK method: 𝑑𝑦
= 𝑦 sin 3 (𝑡) 𝑦(0) = 1 𝑑𝑡
Solution
(a) The Heun method without iteration can be implemented as in the following table: t y k
1 y end k
2
0 1 0 1 0.000995 0.000498
0.1 1.00005 0.000995 1.000149 0.007843 0.004419
0.2 1.000492 0.007845 1.001276 0.025841 0.016843
0.3 1.002176 0.025865 1.004762 0.059335 0.0426
0.4 1.006436 0.059434 1.012379 0.11156 0.085497
0.5 1.014986 0.111847 1.02617 0.184731 0.148289
2.9 3.784421 0.051826 3.789604 0.01065 0.031238
3 3.787545 0.010644 3.78861 0.000272 0.005458
ىلختل بئارض ملاكلا ىلع ناك ول
مهملاك عابرأ ةثلاث نع نوراثر لا
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
July 2013
Continue
(b) The Ralston 2 nd order RK method can be implemented as in the following table t y k
1 yint k
2
0 1 0 1 0.000421 0.00028
0.1 1.000028 0.000995 1.000103 0.005278 0.003851
0.2 1.000413 0.007845 1.001001 0.020043 0.015977
0.3 1.002011 0.02586 1.00395 0.049332 0.041508
0.4 1.006162 0.059418 1.010618 0.096672 0.084254
0.5 1.014587 0.111803 1.022972 0.164537 0.146959
2.9 3.785066 0.051835 3.788954 0.017276 0.028796
3 3.787946 0.010646 3.788744 0.001116 0.004293
يداننو ةحيحصلا روملأا فرعن
اهب مزتلن نأ بعصلا نكل ،اهب
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م
Problem 25.10
Solve the following problem numerically from t = 0 to 3: 𝑑𝑦
= −𝑦 + 𝑡 2 𝑦(0) = 1 𝑑𝑡
Use the third-order RK method with a step size of 0.5
Solution
The solution results are as in the following table: t
0 1 y
-1 k
1 k
2 k
3
-0.6875 -0.5625 -0.71875
0.5 0.640625 -0.39063 0.019531 0.144531 -0.02799
1 0.626628 0.373372 0.842529 0.967529 0.78517
1.5 1.019213 1.230787 1.735591 1.860591 1.67229
2 1.855358 2.144642 2.670982 2.795982 2.604092
2.5 3.157404 3.092596 3.631947 3.756947 3.562889
3 4.938848 4.061152 4.608364 4.733364 4.537995
July 2013
ءلاذأ ديبعلا :ءلاذأ سانلا مظعم
مهئاوهلأ ءلاذأ ةداسلا و ، مهتداسل
ينورتكللإا ديربلاب وأ 9 4444 260 ةيصن ةلاسرب ةيرورض اهارت تاظحلام وأ أطخ يأ نع غلابلإاب ةمهاسملا ىجريف ماعلا عفنلل ةيناجم تاتونلا
Physics I/II, English 123, Statics, Dynamics, Strength, Structure I/II, C++, Java, Data, Algorithms, Numerical, Economy
, eng hs.
net eng hs.
com نيعقوملاب اناجم ةلولحم لئاسمو حرش info@ eng hs.com
9 4444 260 نابعش ةدامح .م