1 / 13

Modeling and simulation of systems

Slovak University of Technology Faculty of Material Science and Technology in Trnava. Modeling and simulation of systems. Numerical methods for solving of differential equations. Euler´s method. we solve simple differential equation of first order y ’ = f(x,y), y(x 0 ) = y 0

sun
Download Presentation

Modeling and simulation of systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Slovak University of Technology Faculty of Material Science and Technology in Trnava Modeling and simulation of systems Numerical methods for solving of differential equations

  2. Euler´s method • we solve simple differential equation of first order • y’ = f(x,y), y(x0) = y0 • when we know the value yn= y(xn) solutions at the point xn • and f(xn,yn) = y’(xn) is the directive of tangent to graph of solution at the point (xn,yn) • we can substitute the graph of solution by the line segment with directive f(xn,yn) it means yn+1= y(xn+1) = yn + h f(xn,yn) for small? h on the interval xn,xn +h

  3. Euler´s method y = ex 1 2 3 4 0 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 xn,xn+1 • A = (xn,yn) slope at A k1 = h f(xn,yn) • B = (xn+ h/2, yn+ k1/2) slope at B k2 = h f (xn+ h/2, yn+ k1/2) • C = (xn+ h/2, yn+ k2/2) slope at C k3 = h f (xn+ h/2, yn+ k2/2) • D = (xn+ h, yn+ k3) slope at D k4 = h f (xn+ h, yn+ k3)

  5. Method of Runge-Kutta k3 k2 k1 B D k4 C A xn+1 xn xn+2 xn+1+ h/2 xn+ h/2

  6. Method of Runge-Kutta • Method of Runge-Kutta makes the increase – the value yn+1 as a linear combination k1,k2, k3,k4 • Slope of function n = yn+1 - yn n = 1/6 (k1+2k2+2 k3+k4) • Accumulated error is not bigger than constant multiple h5

  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 yn+1,0 by help of the second formula. Then we set y’n+1,0 and finally we calculate reconstructive value yn+1,1 according to relation 1. This method repeats until the difference of two calculated values is smaller than determined accuracy.

  9. Predictor-corrector method Prediction of valueyn+1,0 Calculationy‘n+1,0= f(xn+1, yn+1,0) 0j Calculation of corrected valueyn+1,j+1 Calculation y‘n+1,j+1= f(xn+1, yn+1,j) j+1  j y‘n+1,j+1- y‘n+1,j N A yn+1= yn+1,j+1y‘n+1 = y‘n+1,j+1

  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 equationy’=yx, if y(1)=2 and select step 0,1. y0=y(1) a y1=y(1.1) k1= h f(x0,y0)= 0.1*21=0.2

  13. Example k4=h*f(x0+h,y0+k3)=0.1*(2+0.2189)1+0.1=0.2403 y1=y0+1/6*(k1+2k2+2k3+k4)=...=2.219

More Related