Download presentation
Presentation is loading. Please wait.
Published byGladys Simon Modified over 9 years ago
1
Modeling and simulation of systems Numerical methods for solving of differential equations Slovak University of Technology Faculty of Material Science and Technology in Trnava
2
Euler´s method we solve simple differential equation of first order y ’ = f(x,y),y(x 0 ) = y 0 when we know the value y n = y(x n ) solutions at the point x n and f(x n,y n ) = y ’ (x n ) is the directive of tangent to graph of solution at the point (x n,y n ) we can substitute the graph of solution by the line segment with directive f(x n,y n ) it means y n+1 = y(x n+1 ) = y n + h f(x n,y n ) for small? h on the interval x n,x n +h
3
Euler´s method y = e x 0 1 234 Lack of Euler´s method – little precision.
4
Method of Runge-Kutta The enlargement of the precision of Euler´s method in the method of Runge-Kutta lies in searching of increasing of at several points on the interval x n,x n+1 A = (x n,y n ) slope at A k 1 = h f(x n,y n ) B = (x n + h/2, y n + k 1 /2) slope at B k 2 = h f (x n + h/2, y n + k 1 /2) C = (x n + h/2, y n + k 2 /2) slope at C k 3 = h f (x n + h/2, y n + k 2 /2) D = (x n + h, y n + k 3 ) slope at D k 4 = h f (x n + h, y n + k 3 )
5
k1k1 k2k2 k3k3 k4k4 xnxn x n + h/2 x n+1 x n+1 + h/2 x n+2 A B C D Method of Runge-Kutta
6
Method of Runge-Kutta makes the increase – the value y n+1 as a linear combination k 1,k 2, k 3,k 4 Slope of function n = y n+1 - y n n = 1/6 (k 1 +2k 2 +2 k 3 +k 4 ) Accumulated error is not bigger than constant multiple h 5
7
Predictor-corrector method For the precise/exact value is in force: It is also necessary to know values of solution in several previous point, this follows from the formula. Let´s substitute integral for closed trapezoid formula : 1
8
Predictor-corrector method Let´s subsitute integral for opened trapezoid formula: 2 The first formula is more precise but is in implicit state. First of all we calculate the predictive value y n+1, 0 by help of the second formula. Then we set y ’ n+1,0 and finally we calculate reconstructive value y n+1, 1 according to relation 1. This method repeats until the difference of two calculated values is smaller than determined accuracy.
9
Prediction of value y n+1,0 Calculation y ‘ n+1,0 = f(x n+1, y n+1,0 ) 0j0j Calculation y ‘ n+1,j+1 = f(x n+1, y n+1,j ) Calculation of corrected value y n+1,j+1 y ‘ n+1,j+1 - y ‘ n+1,j y n+1 = y n+1,j+1 y ‘ n+1 = y ‘ n+1,j+1 j+1 j A N Predictor-corrector method
10
Comparison of methods of numerical integration The method R-K does not call for additional primary values. There is the possibility to change the step of integration randomly. The methods P-C call for others primary values. It is generally needed to calculate the primary conditions for the new step at the change of the step of integration. The accuracy of both methods is approximately the same, often R-K are more precise than P-C of the same rule R-K needs at each step so much calculation of value f(x,y) as the rule of method. The methods P-C of the fourth rule usually demand two calculation – prediction and correction. That is why we can say that they are about faster twice as R-K of the same order.
11
The usage of methods of numerical integration How big is the local defect (error of method, rounding error...) How influence has the local error upon the results in the next step. Then it is necessary to notify the stability of the method. The necessity to know the primary conditions The speed of method
12
Example Calculate the value(1.5) of solution of differential equation y ’ =y x, if y(1)=2 and select step 0,1. y 0 =y(1) a y 1 =y(1.1) k 1 = h f(x 0,y 0 )= 0.1*2 1 =0.2
13
Example k 4 =h*f(x 0 +h,y 0 +k 3 )=0.1*(2+0.2189) 1+0.1 =0.2403 y 1 =y 0 +1/6*(k 1 +2k 2 +2k 3 +k 4 )=...=2.219
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.