Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computational Biology, Part 17 Biochemical Kinetics III Robert F. Murphy Copyright  1996, 1999, 2000, 2001. All rights reserved.

Similar presentations


Presentation on theme: "Computational Biology, Part 17 Biochemical Kinetics III Robert F. Murphy Copyright  1996, 1999, 2000, 2001. All rights reserved."— Presentation transcript:

1 Computational Biology, Part 17 Biochemical Kinetics III Robert F. Murphy Copyright  1996, 1999, 2000, 2001. All rights reserved.

2 General form of ordinary differential equations For a set of n unknown functions y i (for i=1 to n) we are given a set of n functions f i that specify the derivatives of each y i with respect to some independent variable x For a set of n unknown functions y i (for i=1 to n) we are given a set of n functions f i that specify the derivatives of each y i with respect to some independent variable x

3 Euler’s method The simplest numerical integration method is Euler’s method. It simply converts each differential to a difference The simplest numerical integration method is Euler’s method. It simply converts each differential to a difference and then calculates the value of  y i by multiplying the right hand side of each differential equation by the step size  x and then calculates the value of  y i by multiplying the right hand side of each differential equation by the step size  x

4 Euler’s method We can rewrite this as a recursion formula that allows us to calculate values of the functions y i at a series of x values. We introduce a second subscript j to indicate which x value we refer to (note that y i,j now refers to a value not a function). We can rewrite this as a recursion formula that allows us to calculate values of the functions y i at a series of x values. We introduce a second subscript j to indicate which x value we refer to (note that y i,j now refers to a value not a function).

5 Euler’s method Note the asymmetry of this method: the derivative (f i ) that is used to span the  x is calculated only for the x value at the beginning of the interval. In regions where f i is increasing with x, this leads to underestimation of  y, and, in regions where f i is decreasing with x, to overestimation of  y. Note the asymmetry of this method: the derivative (f i ) that is used to span the  x is calculated only for the x value at the beginning of the interval. In regions where f i is increasing with x, this leads to underestimation of  y, and, in regions where f i is decreasing with x, to overestimation of  y.

6 Euler’s method Consider dy/dx=6x+2. The analytical solution is y=3x 2 +2x. Consider dy/dx=6x+2. The analytical solution is y=3x 2 +2x. The graph shows the Euler’s method approximation for y and the analytical solution for y (along with dy/dx). The graph shows the Euler’s method approximation for y and the analytical solution for y (along with dy/dx). Note how the approximation always underestimates y since dy/dx is increasing

7 Midpoint method A better estimate would come from evaluating the f i at the midpoint of the  x interval. The problem: we know x at the midpoint but we don’t know the y i at the midpoint (yet). The solution is to use Euler’s method to estimate  y and then re- estimate  y using the derivatives evaluated halfway along the line segment encompassing the original  y. A better estimate would come from evaluating the f i at the midpoint of the  x interval. The problem: we know x at the midpoint but we don’t know the y i at the midpoint (yet). The solution is to use Euler’s method to estimate  y and then re- estimate  y using the derivatives evaluated halfway along the line segment encompassing the original  y.

8 Midpoint method (2nd order Runge-Kutte) This is called the midpoint method or the second-order Runge-Kutte method. This is called the midpoint method or the second-order Runge-Kutte method.

9 Midpoint method (2nd order Runge-Kutte) Again consider dy/dx=6x+2. Again consider dy/dx=6x+2. The graph shows the midpoint approximation for y and the analytical solution for y ( along with dy/dx at x and x+0.5 ). The graph shows the midpoint approximation for y and the analytical solution for y ( along with dy/dx at x and x+0.5 ). Note that the approximation and the analytical solution are identical in this case.

10 Midpoint method (2nd order Runge-Kutte) Now consider dy/dx=3y. The analytical solution is y=e 3x. Now consider dy/dx=3y. The analytical solution is y=e 3x. The graph shows the Euler, Midpoint and analytical solutions (along with derivatives). The graph shows the Euler, Midpoint and analytical solutions (along with derivatives). Note that the midpoint method is better than Euler’s method but it does not give results identical to the analytical solution since dy/dx now depends on y.

11 Fourth-order Runge-Kutta The midpoint method can be extended by considering other intermediate estimates. The most frequently used variation is the fourth-order Runge-Kutta method which considers one estimate at the initial point, two estimates at the midpoint, and one estimate at a trial endpoint. The midpoint method can be extended by considering other intermediate estimates. The most frequently used variation is the fourth-order Runge-Kutta method which considers one estimate at the initial point, two estimates at the midpoint, and one estimate at a trial endpoint.

12 Fourth-order Runge-Kutta Here are the formulas. Here are the formulas.


Download ppt "Computational Biology, Part 17 Biochemical Kinetics III Robert F. Murphy Copyright  1996, 1999, 2000, 2001. All rights reserved."

Similar presentations


Ads by Google