Upcoming SlideShare
×

# Computational techniques

622 views

Published on

Published in: Education
1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
622
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
11
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Computational techniques

1. 1. ComputationalTechniques Presentation By Rafi Dar student of University of Kashmir
2. 2. Computational Techniques Runge Kutta 2nd order Methods Runge Kutta 4th order Methods Eular Method Modified Eular Method
3. 3. Runge Kutta Method Runge Kutta is the Family of Methods. for the approximation of solutions of ordinary differential equations. 2nd order and 4th order methods are widely applied.Steps:1. First slope at some of the intermediate points is computed.2. Weighted average of the slope is used to extrapolate the next solution point.
4. 4. Runge Kutta 2nd order method: the interval [x1 , xf] is divided into subintervals and a weighted average of derivatives (slopes) at these intervals is used to determine the value of next dependent variable.Advantage: of using Runge kutta method is that it is one step method.
5. 5.  Consider following differential equation dy/dx = f(x,y). With an initial condition; y =y1, x= x1. At starting point compute slope of the curve as f(x1, y1) call it s1. Now compute slope of curve at point (x2, y1+S1h) as f(x2, y1+ s1h) Call it s2. Find the average of these slopes and then compute value of dependent variable y from the following equation. y2 = y1 + Sh ; where S = (s1 + s2 ) / 2. S1 = f(x1, y2) and s2 = f(x2, y1+ s1h).
6. 6.  Hence starting from first point we can find second and then third and so on. In general the value of y for (i+1)th point on the solution curve is obtained from the ith solution point using formula: yi+1 = yi + hS Where S = (si + si+1 ) /2 and Si = f(xi,yi) si+1 = f(xi+h, yi+hsi) This formula for Runge Kutta 2nd Order is called as Heun’s method.
7. 7. Runge Kutta 4th Order Method Error in 2nd order method is O(h³) per step. If more precision is required we use 4th order R.K method. In which error is O(h5) per step. In R.K 4th Order method, the slope at 4 points including the starting point is computed, and the average weight of these slopes is computed as : S =1/6(s1 + 2s2+ 2s3 +s4) where s1 = f(x1 ,y1) s2 = f(x1+h/2, y1 +h/2 s1) s3 = f(x1+h/2, y1+h/2 s2) s4 = f(x1+h ,y1+h s3)
8. 8.  the value of dependent variable y is computed as : y2 = y1 + hS In the similar manner, starting from second solution point we can compute the third point. The process is repeated till we find the solution in the desired interval. In general, the (i+1)th point of the solution curve is obtained from the ith point using the following equation: yi+1 =yi+ hs Where S = (s1 + 2s2 + 2s3 + s4) /6 and s1 = f(xi,yi) s2 = f(xi+ h/2, yi+ h/2 s1) s3 = f(xi+ h/2, yi+h/2 s2) s4 = f(xi+ h, yi+ hs3)
9. 9. Euler Method The Euler method can be described as piecewise linear approximation technique to arrive at the solution. In Euler method we are given two starting values (x1,y2) and slope of the curve. Consider an ordinary different equation dy/dx = f(x,y). Replacing x, y by initial value x1,y1. dy/dx = f(x1,y1) or y1(x1) = f(x1,y1) Recall the mean value theorem: If a function is continuous and differentiable between two points (x1,y1) and (x2,y2). Then the slope of the line joining the points is derivative at least at one point call it (c, d) of the function. y1(c) = y(x2) –y(x1) / (x2 –x1)
10. 10. Replacing x2 –x1 by h and c by x1.We get : y1(x1) = y(x2) –y(x1) / (x2 –x1) or f(x1,y1) = y(x2) –y(x1) / h y(x2) = h f(x1,y1) + y(x1) y2 = y1+h f(x1,y1) Using this equation we can compute the second point on the solution curve as (x2,y2). Similarly taking (x2,y2) as starting point we can determine : y3 = y2 + h f(x2,y2) In general the (i+1)th point of the solution curve is obtained from ith point using following formula: yi+1 = yi + h f(xi, yi)
11. 11. Modified Eular Method The modified Eular method is a multi step method, which utilizes information from more than one previous step to extrapolate solution curve. the method works correctly only in case of linear function. Alternatively we can calculate the average slope within the interval. Suppose we use interval bound by x =xi and x = xi+1 Average slope =(y1(xi) + y1(xi+1) )/2. Then according to the basic Eular formula: Yi+1 = yi + h/2[y1(xi) + y(xi+1)] Yi+1 = yi + h/2[f(xi,yi) +f(xi+1,yi+1)] This is an improved estimate fo yi+1 at xi+1. but we can’t use it directly since yi+1 is unknown.
12. 12. The value of yi+1 is predicted using basic Eular equation as: ypi+1 = yi + h f(xi, yi) This is called as predictor formula. Using this predicted value, a more accurate value is computed by equation called as corrector formula as follows: yci+1 = yi + h/2[f(xi,yi ) + f (xi+1,ypi+1)]. In general we may conclude Eular method is a two step method:1. Predict yi+1solution point by using predictor formula.2. Correct the yi+1solution point using corrector formula.
13. 13. Thank you.reach out to me :rafi.rey@gmail.comorhttps://www.facebook.com/rafi.dar.98