An Analysis of Numerical Methods on Traffic Flow Models

Size: px
Start display at page:

Download "An Analysis of Numerical Methods on Traffic Flow Models"

Transcription

1 Bridgewater State University Virtual Commons - Bridgewater State University Honors Program Theses and Projects Undergraduate Honors Program An Analysis of Numerical Methods on Traffic Flow Models Terry Mullen Follow this and additional works at: Part of the Mathematics Commons Recommed Citation Mullen, Terry. (2015). An Analysis of Numerical Methods on Traffic Flow Models. In BSU Honors Program Theses and Projects. Item 105. Available at: Copyright 2015 Terry Mullen This item is available as part of Virtual Commons, the open-access institutional repository of Bridgewater State University, Bridgewater, Massachusetts.

2 An Analysis of Numerical Methods on Traffic Flow Models Terry Mullen Submitted in Partial Completion of the Requirements for Commonwealth Honors in Mathematics Bridgewater State University May 12, 2015 Dr. Laura K. Gross, Thesis Director Date Dr. Thomas Kling, Committee Member Date Dr. Uma Shama, Committee Member Date

3 An Analysis of Numerical Methods on Traffic Flow Models By Terry Mullen Bridgewater State University Bridgewater, MA May 12, 2015

4 Acknowledgments I would like to thank my mentor Dr. Laura Gross, for not only guiding me through this the process of research but also being so caring. Without her support, and knowledge this project would have never have been completed. I would also like to thank my family for fully supporting me during my college career and listening to me drone on about traffic models for months. iii

5 An Analysis of Numerical Methods on Traffic Flow Models Terry Mullen Bridgewater State University Bridgewater, MA May 12, 2015 ABSTRACT In this thesis, we implement Euler s method and the Runge-Kutta method to solve initial value problems. A goal of the project is to compare the two methods on preliminary problems illustrating limitations and advantages. We also apply the Runge-Kutta method to a mathematical model of traffic flow. This thesis sheds light on how the fourth-order Runge-Kutta method is implemented to solve the Optimal Velocity Model (Kurata & Nagatani, 2003). We identify initial conditions and base cases to run simulations of the model. We consider one-car and two-car systems to validate the application of the fourth-order Runge-Kutta method and the Optimal Velocity Model. Our simulations accurately capture practical traffic scenarios. iv

6 Table of Contents 1 Introduction Numerical Methods for Ordinary Differential Equations Euler s Method Error Analysis in Euler s Method Runge-Kutta Error Analysis in the Runge-Kutta Method Numerical Method for Systems and Higher-Order Methods Runge-Kutta on First-Order Systems Runge-Kutta on Higher-Order Systems Numerical Solution of a Traffic Model The Model Implementation of Runge-Kutta on the Model Simulation with a Stopped Object and One Car Simulation with a Clear Road in Front of the Car Simulation with an Object Traveling with a Slow Constant Speed Simulation with a Stopped Object and Two Cars Simulation with a Clear Road in Front of Two Cars Simulation with an Object Traveling with a Slow Constant Speed and Two Cars Conclusions Future Work References v

7 A Code Implementation A.1 Textbook Problem Codes A.1.1 Euler s Method A.1.2 Runge-Kutta Method A.1.3 Runge-Kutta for Systems A.2 Traffic Model Code A.2.1 Traffic Model Equation Code A.2.2 Runge-Kutta for Stopped Object and One Car A.2.3 Runge-Kutta for a Clear Road in Front of the Car A.2.4 Runge-Kutta for a Car Following an Object Traveling with a Slow Constant Speed A.2.5 Runge-Kutta for Stopped Object and Two Cars A.2.6 Runge-Kutta for a Clear Road in Front of Two Cars A.2.7 Runge-Kutta for Two Cars Following an Object Traveling with a Slow Constant Speed vi

8 List of Figures 4.1 Position (left graph) and velocity (right graph) versus time for a car (solid line) approaching a stopped object (dashed line) Position (left graph) and velocity (right graph) versus time for a car that starts out slow and accelerates because it has a clear path Position (left graph) and velocity (right graph) versus time for a car (solid line) with a slow moving constant speed object (dashed line) in front of it Position (left graph) and velocity (right graph) versus time for two cars (solid line and dashed line) approaching a stopped object Position (left graph) and velocity (right graph) versus time for two cars (solid line and dashed line) accelerating Position (left graph) and velocity (right graph) versus time for two car (solid line and dashed line) slowing down for a slow moving object (circle line) vii

9 List of Tables 2.1 Table for the Initial Value Problem 2.3 with values found by Euler s Method Table for the Initial Value Problem 2.3 with values found by Euler s method and values found using the exact solution Table for the Initial Value Problem 2.3 with values found by the Midpoint method and values found using the exact solution Table for the Initial Value Problem 2.3 with values found by the fourthorder Runge-Kutta method and values found using the exact solution Table to compare values of the Initial Value Problem 2.3 solved with Euler s method with h = 0.025, the Midpoint method with h = 0.05, and fourth-order Runge-Kutta with h = Table for the Initial Value Problem 3.1 with values found by the fourthorder Runge-Kutta for systems and values found using the exact solution. 13 viii

10 Chapter 1 Introduction Numerical analysis is an important aspect of applied mathematics. Some equations can be solved using exact techniques, but other more complicated ones need to be solved using numerical estimation techniques. Many traffic modeling papers use numerical analysis to solve the models (Kurata & Nagatani, 2003; Chen, Peng, & Fang, 2014) but do not argue why they chose a specific method. They also do not fully explain the initial conditions or necessary base case conditions. There are a few ways the models could be solved. For example, some researchers use Euler s method (Chen et al., 2014). Others use Runge-Kutta (Kurata & Nagatani, 2003). For either method it is important that the reader understands the initial conditions and how the system is functioning. Both methods are used to solve a differential equation with initial values by approximating points on the solution graph in a specific interval. A limitation of these numerical analysis techniques is the farther away from the initial value point the farther the approximation is from the actual value. Euler s method has a greater error than Runge-Kutta, but computations for Runge-Kutta are fairly complex. Euler s method has a greater error than the Runge Kutta method, but is useful as a stepping stone into more complex techniques. For more details on both methods and more comparisons of the methods see Chapter 2 and to see the MATLAB implementation see Appix A. 1

11 Chapter 2 Numerical Methods for Ordinary Differential Equations As previously stated, numerical methods like Euler s and Runge-Kutta approximate solutions to initial value problems on a specific interval: dy dt = f(t, y), y(a) = α, a t b. (2.1) Both methods estimate the solution at N discrete points. The t values are evenly distributed through out the interval [a, b]. We use a step size h = b a N. (2.2) Originating from the Taylor Series expansion, both methods rely on f(t, y) to approximate the solution. (See Section ) The methods use a difference equation that uses the approximate solution w i at current time step t i to estimate the solution w i+1 at the next time step t i+1. The difference equations produce N values w 0, w 1,..., w i,..., w N that approximate y 0, y 1,..., y i,..., y N at time t 0, t 1,..., t i,..., t N, respectively. It is a difference equation because it relies on the difference quotient w i+1 w i (h = t i+1 t i ) as h an approximation of f(t, y). To show how these methods work we will use the following example problem (Burden & Faires, 2003): y = 1 + y/t, 1 t 2, y(1) = 2, with h = (2.3) 2

12 Let us look now at two specific methods. 2.1 Euler s Method We will define w i to be the approximate solution of Initial Value Problem 2.1 at mesh point i, while t i will be the t value at the ith mesh point. Euler s method generates the approximate solution point (t i, w i ) using the following method: t 0 = a, w 0 = α, w i+1 = w i + hf(t i, w i ), i = 0, 1,..., N 1, (2.4) t i+1 = t i + h, where α is the initial value of the exact solution y as given in Equation 2.1. Equation 2.4 is the difference equation of Euler s method (Burden & Faires, 2003). The method yields N points (t i, w i ). Now let s look at the Example Problem 2.3. From the problem we can see, f(t, w) = 1 + w/t. Following the algorithm, t 0 = 1, w 0 = 2. Then we must compute the difference equations w 1 = w 0 + hf(t 0, w 0 ) = (1 + 2/1) = , t 1 = t 0 + h = 1.25, w 2 = w 1 + hf(t 1, w 1 ) = ( /1.25) = , t 2 = t 0 + 2h = 1.5, w 3 = w 2 + hf(t 2, w 2 ) = ( /1.5) = , t 3 = t 0 + 3h = 1.75, 3

13 w 4 = w 3 +hf(t 3, w 3 ) = ( /1.75) = , t 4 = t 0 +4h = 2. Therefore, Euler s method on Initial Value Problem 2.3 gives the approximation shown in Table 2.1. Table 2.1: Table for the Initial Value Problem 2.3 with values found by Euler s Method. i t i w i Being a problem from a textbook, Initial Value Problem 2.3 is a simple problem. In fact it has an exact solution. Using the linear equation method of differential equations you can find the exact solution to be y(t) = t(ln t + 2). Now we can assess how well Euler s method approximates the points on the solution curve. By adding a column with the exact values at the t steps to Table 2.1, we can also present the error y(t i ) w i. See Table 2.2. Table 2.2: Table for the Initial Value Problem 2.3 with values found by Euler s method and values found using the exact solution. i t i w i y(t i ) error As you can see the error increases as we step farther away from the initial time. Error analysis is an important part of evaluating an numerical method like Euler s Method. Burden and Faires (2003) describe how the error in Euler s method behaves. 4

14 2.1.1 Error Analysis in Euler s Method Because numerical methods like Euler s Method do not find exact solutions error becomes a large part of how we choose the method to use. Many of the methods are based on the Taylor series expansion of y(t) about the point t = t 0. We know in Euler s method t i = t 0 + ih. The nth degree Taylor polynomial has the form P n (t i ) = y(t 0 ) + y (t 0 )ih + y (t 0 ) 2! i 2 h y(n) (t 0 ) i n h n. (2.5) n! The formula is using the same step size h as Euler s method. In the Taylor series n goes to infinity. The nth Taylor polynomial truncates the series to at the (n + 1)st term. When the series is truncated there is some error between the Taylor polynomial and y(t). The error is called the remainder term or truncation error: R n (t i ) = y(n+1) (ξ(t)) i n+1 h n+1. (2.6) (n + 1)! It is this term that helps us determine the error of a numerical method. Notice for Euler s method, since it uses the Taylor polynomial of order 1, the remainder term is R n (t i ) = y (ξ(t))ih (2.7) Notice as the step size h decreases the remainder term and thus the error decreases as well so long as y (t) is bounded by M on [a, b]. This is one method to decrease error. The smaller the step size the more computations a computer will have to do. Because the remainder term is on the order of h we say that Euler s method is of order h denoted O(h). 5

15 2.2 Runge-Kutta Runge-Kutta does a better job of estimation than Euler s method. Runge-Kutta has many different forms with the simplest being the second-order Midpoint method. We let the second-order Taylor Polynomial be estimated by the function a 1 f(t + α 1, y + β 1 ). (2.8) When solved using expanded Taylor Polynomials we get a 1 = 1, α 1 = h 2, β 1 = h 2. The Midpoint method is w 0 = α, (2.9) w i+1 = w i + hf(t i + h 2, w i + h 2 f(t i, w i )), for i = 0, 1,..., N 1. (2.10) Equation 2.10 is the difference equation. The Midpoint method uses the step size given in Equation 2.2. Just like Euler s method we iterate through the method finding w i until we reach the of the interval. Let s look at an example. We will use the same example from Burden and Faires (2003) that we used to demonstrate Euler s Method, Equation 2.3. This time we will use the Midpoint method. From Equation 2.3 we see that w 0 = 2 and we can calculate h = Using Equation 2.10 we find that the Midpoint method difference equation for this problem is w i+1 = (4i2 + 38i + 90)w i + i 2 + 9i i i

16 Now we can find the the values at each mesh point: w 1 = (4(0)2 + 38i + 90)2 + (0) 2 + 9(0) (0) (0) + 72 = , w 2 = (4(1)2 + 38i + 90) (1) 2 + 9(1) (1) (1) + 72 = The process is continued for all N points as seen in Table 2.3. The exact solution for this problem is y(t) = t(ln t + 2). Using it we can see how the error changes as the we get closer to the of the interval and farther away from the initial point. Table 2.3: Table for the Initial Value Problem 2.3 with values found by the Midpoint method and values found using the exact solution. i t i w i y(t i ) error The Runge-Kutta method that is most popularly used is the fourth-order Runge-Kutta method. It is more accurate than the Midpoint method but is more complex. Again, Runge-Kutta uses the same step size as Equation 2.2, and α is the initial value of y. The method is t 0 = a w 0 = α, k 1 = hf(t i, w i ), k 2 = hf(t i + h 2, w i k 1), k 3 = hf(t i + h 2, w i k 2), k 4 = hf(t i + h, w i + k 3 ), 7

17 w i+1 = w i (k 1 + 2k 2 + 2k 3 + k 4 ) i = 1, 2,..., N 1. (2.11) t i = a + ih We can use fourth-order Runge-Kutta method on our Example Problem 2.3 on page 2. The first iteration is as follows: w 0 = 2, k 1 = 0.25f(1, 2) = 0.25(1 + 2/1) = 3/4 = , k 2 = 0.25f( , 2+0.5(0.75)) = 0.25f(1.125, 2.375) = 0.25( /1.125) = , k 3 = 0.25f(1.125, 2+0.5( )) = 0.25f(1.125, ) = 0.25( /1.125) = , k 4 = 0.25f(1.25, ) = 0.25( /1.25) = , w 1 = 2 + 1/6( ) = This whole process is repeated until t i is at the of the interval. As we have done be for the following table will compare this methods solutions with the exact solutions. Table 2.4: Table for the Initial Value Problem 2.3 with values found by the fourth-order Runge-Kutta method and values found using the exact solution. i t i w i y(t i ) error As you can see from the three tables that compare the method values to the exact values the higher the order of the method the smaller the error. This phenomenon can be explained by the how the methods are derived. 8

18 2.2.1 Error Analysis in the Runge-Kutta Method As in Euler s method, Runge-Kutta methods are based off of Taylor series polynomial. Second-order Runge-Kutta methods like the Midpoint method use the second-order Taylor series polynomial so the remainder term would be R n (t i ) = y(2) (ξ(t)) i 2 h 2. (2.12) 2! Thus the Midpoint method has error of O(h 2 ) so long as the derivative y (2) is bounded by M on [a, b]. Because h 2 < h for step sizes less than 1, then the error of the Midpoint method is less than the error of Euler s method. The fourth-order Runge-Kutta uses the fourth-order Taylor polynomial so the method s remainder term is R n (t i ) = y(4) (ξ(t)) i 4 h 4. (2.13) 4! The error is O(h 4 ), clearly better than all other methods presented so far so long as the derivative y (4) is bounded by M on [a, b]. The fourth-order Runge-Kutta method has a better error than using Euler s method or the Midpoint method with a much larger step size. To illustrate this we will compare Problem 2.3 solved with Euler s method with a h = 0.025, the Midpoint method with a h = 0.05, and fourth-order Runge-Kutta with a h = 0.1. Notice how even though the fourth-order Runge-Kutta method has the largest step size it has the smallest error. This is because even though the step size is larger.1 5 < So since the error of Euler s method is O(h 2 ) and the fourth-order Runge-Kutta is O(h 5 ) then the Runge-Kutta error should be less as shown by the table. It should also be said that fourth-order Runge-Kutta will have less computations than the other methods to attain similar error. Since the step size can be larger the computer will be able to go through the method few times to get accurate estimations. 9

19 Table 2.5: Table to compare values of the Initial Value Problem 2.3 solved with Euler s method with h = 0.025, the Midpoint method with h = 0.05, and fourth-order Runge- Kutta with h = 0.1. Time fourth-order Runge Kutta Midpoint Eulers Exact

20 Chapter 3 Numerical Method for Systems and Higher-Order Methods 3.1 Runge-Kutta on First-Order Systems Runge-Kutta can also be exted for systems of initial value problems. A system of initial value problems with m equations has the form du 1 dt = f 1(t, u 1, u 2,..., u m ), du 2 dt = f 2(t, u 1, u 2,..., u m ),. du m dt = f m (t, u 1, u 2,..., u m ), (3.1) for t [a, b], with the initial conditions u 1 (a) = α 1, u 2 (a) = α 2,..., u m (a) = α m. The way the Runge-Kutta for system works is you choose an N for the number of mesh points you want to solve. Now just like Euler s and Runge-Kutta before, the step size is defined by Equation 2.2 and t j = a + jh for each j = 0, 1,..., N. We will denote w ij to be the approximate solution of u i in the system of Equations 3.1 at the jth mesh point 11

21 t j (Burden & Faires, 2003). So the initial conditions give us w 1,0 = α 1, w 2,0 = α 2,..., w m,0 = α m. Now like with the fourth-order Runge-Kutta method in order to find w j+1 using known w j values we need to compute k 1, k 2, k 3, k 4 values. For systems we need to calculate each k value for each equation in the system before moving on to the next k value. So for each i = 1, 2,..., m calculate k 1,i = hf i (t j, w 1,j, w 2,j,..., w m,j ), then for each i = 1, 2,..., m calculate k 2,i = hf i (t j + h 2, w 1,j k 1,1, w 2,j k 1,2,..., w m,j k 1,m), then for each i = 1, 2,..., m calculate k 3,i = hf i (t j + h 2, w 1,j k 2,1, w 2,j k 2,2,..., w m,j k 2,m), then for each i = 1, 2,..., m calculate k 4,i = hf i (t j + h 2, w 1,j + k 3,1, w 2,j + k 3,2,..., w m,j + k 3,m ), and then for each i = 1, 2,..., m w i,j+1 = w i,j (k 1,i + 2k 2,i + 2k 3,i + k 4,i ). Again, like any of the other methods it can help to see a simple example. However, 12

22 to show the calculations for one step in a system of three equations you would need to calculate twelve k values and three difference equations. The best way to show this method is to implement it on a computer and analyze the results. We implement the systems code in MATLAB for the specific problem u 1 = u 2 u 3 + t, u 1 (0) = 1; u 2 = 3t 2, u 2 (0) = 1; u 3 = u 2 + e t, u 3 (0) = 1 (3.2) for t [0, 1]. We used a step size of h = 0.1 and were given the exact solutions of u 1 (t) = 0.05t t 4 + t + 2 e t, u 2 (t) = t 3 + 1, and u 3 (t) = 0.25t 4 + t e t. The fourth -rder Runge-Kutta for system of equations produced the values for w ij as seen in Table 3.1. To see the MATLAB implementation see Appix A.1.3. Table 3.1: Table for the Initial Value Problem 3.1 with values found by the fourth-order Runge-Kutta for systems and values found using the exact solution. j t i w 1j u 1j w 2j u 2j w 3j u 3j Runge-Kutta on Higher-Order Systems All of the methods described thus far are to solve ordinary differential equations. Unfortunately, as we will see in Chapter 4, the Optimal Velocity Model that we are working towards is a system of second-order differential equations. We have to do is convert each 13

23 second-order differential equation to two first-order differential equations. Say we have the second-order differential equation: ( d 2 y dt = f t, y, dy ), y(a) = α 2 1, dt dy dt (a) = α 2. (3.3) Then we make the system of equations as follows: dv dt dy dt = v, = f (t, y, v). Now this is just a simple system of two coupled first-order differential equations. Now we can use the fourth-order Runge-Kutta method for systems. 14

24 Chapter 4 Numerical Solution of a Traffic Model In this chapter, we consider the Optimal Velocity Model or OVM for traffic flow (Kurata & Nagatani, 2003). The initial-value problem cannot be solved analytically. We will approximate the solution using the Runge-Kutta method. Kurata and Nagatani (2003) name this approach to the problem. We implement the method and discuss how and why the Runge-Kutta method described in Section 3.1 can be exted to apply to the model of traffic flow. 4.1 The Model We describe the movement of car i using the following equation (Kurata & Nagatani, 2003): d 2 x i (t) dt 2 ( = a V ( x i (t)) dx ) i(t). (4.1) dt The position of car i at time t is x i (t). We define x i (t) to be the distance between car i and the car in front of it at time t. So, x i (t) = x i+1 (t) x i (t). (4.2) This is often referred to as the the headway of car i at time t. The constant a is the sensitivity parameter. It describe how sensitive the average driver is to the motion of 15

25 the car in front of him. The sensitivity parameter is actually the inverse of the time lag between a front car changing speeds and the car behind it reacting and then adjusting to the front car. The velocity of the car i is given by dx i(t). The function V ( x i (t)) is dt the optimal velocity of the car. The optimal velocity is given by V ( x i (t)) = v max 2 [tanh ( x i(t) x c ) + tanh(x c )]. (4.3) If x c = 4, then as the headway x i (t) approaches infinity, the optimal velocity V ( x i (t)) approaches a value within.0004% of v max. Thus, cars will go approximately the maximal velocity when the headway is sufficiently larger than the safety distance. If the safety distance becomes infinitely large the value of V ( x i (t)) will approach zero. The Optimal Velocity Model 4.1 has the acceleration of car i, d2 x i (t), on the left-hand dt 2 side. When the optimal velocity in Equation 4.3 is greater than the current velocity dx i (t) of the car, the acceleration is positive. The velocity of the car will increase in this dt case. When the optimal velocity is equal to the current velocity then the acceleration is zero. Thus the car s speed stays constant. When the current velocity is greater than the optimal velocity the acceleration is negative and the car will slow down. The acceleration has a proportionality parameter a. Since the sensitivity parameter is the inverse of the time lag it takes for a driver to react to a car in front of it, a high sensitivity parameter is a quick response time. A high sensitivity parameter in turn leads to a higher acceleration. When we implemented the fourth-order Runge-Kutta method on the model we let the parameters be the following: a = 1, v max = 4, 16

26 x c = 4. We ran each Runge-Kutta method with a step size of.001 over the t interval [0, 6]. 4.2 Implementation of Runge-Kutta on the Model The Optimal Velocity Model 4.1 is a system of second-order differential equations. The system of Equations 3.1 in Section 3.1 is a system of first-order equations. We need to change each second-order differential equation into two first-order differential equations as described in Subsection 3.2, where dx i (t) dt = y i (t) and dy i(t) dt = a(v (x i+1 (t) x i (t)) y i (t)). (4.4) Each car i has two differential equations associated with it. Thus when there are M cars there are 2M equations in our system. Now in order to implement a fourth-order Runge-Kutta method we need to start with some initial condition for each equation. In this model, we require a starting position and velocity of each car in the system. Kurata and Nagatani (2003) do not explicitly define initial conditions. Without initial conditions there is no way to replicate their exact simulation. We define our own initial conditions. The other issue is that the Optimal Velocity Equation 4.3 involves a car in front of the ith car. The last equation in the system is dy M (t) dt = a(v (x M+1 (t) x M (t)) y i (t)). This relies on an (M + 1)st car which does not exist. Thus how do we deal with motion of the Mth car which is a part of the system? This issue is not addressed by Kurata 17

27 and Nagatani (2003). The whole system relies on how to prescribe the behavior of the front car, which in turn affects the behavior of the following cars. We prescribe our own x M+1 values. We decided to simplify the model down to just one car and then two cars to validate the application of the method and the model. 4.3 Simulation with a Stopped Object and One Car This simulation illustrates the response of a car to a stopped object. We place the object close enough that the car has to slow down. For this simulation we have the first-order system in Equation 4.4 for the position x 1 (t) and velocity y 1 (t) of a single car. In Section 4.1, we discuss x 2 (t) as the position of the second car in the system, but here we think of it as an object stopped at position 20. Throughout the simulation we use x 2 (t) = 20. Thus, the system is dx 1 (t) dt = y 1 (t), dy 1 (t) dt = a(v (20 x 1 (t)) y 1 (t)). The car begins at position x 1 (0) = 0. The velocity of the car is initially set to be the optimal velocity as follows: dx 1 dt = V ( x 1 (0)), t=0 18

28 Fig. 4.1: Position (left graph) and velocity (right graph) versus time for a car (solid line) approaching a stopped object (dashed line). where x 1 (0) = x 2 (0) x 1 (0) = 20 0 = 20 is the headway at time zero. Now we can use the fourth-order Runge-Kutta method to solve for the position x 1 (t) and the velocity y 1 (t) of the car. The code appears in Appix A.2.2. Figure 4.1 shows the results of the simulation. The left figure shows the position of the car and the stopped object as functions of time. The right figure shows the velocities. Both graphs in Figure 4.1 show the car slowing down as it approaches the object. 4.4 Simulation with a Clear Road in Front of the Car This simulation illustrates the response of a car to a clear road ahead of it. We place the object so far away that it has no affect on the car. For this simulation we have the first-order system in Equation 4.4 for the position x 1 (t) 19

29 and velocity y 1 (t) of a single car. Just as in the stopped car simulation we think of x 2 (t) as an object stopped at the far away position of 100. Throughout the simulation we use x 2 (t) = 100. Thus, the system is dx 1 (t) dt = y 1 (t), dy 1 (t) dt = a(v (100 x 1 (t)) y 1 (t)). The car begins at position x 1 (0) = 0. The velocity of the car is initially set to be the slow velocity of 1, recall in Section 4.1 the v m ax is four. Thus, dx 1 dt = 1. t=0 Starting the car so slow will allow it to speed up throughout the simulation. Now we can use the fourth-order Runge-Kutta method to solve for the position x 1 (t) and the velocity y 1 (t) of the car. The code appears in Appix A.2.3. Figure 4.2 shows the results of the simulation. The left figure shows the position of the car as a function of time. The right figure shows the velocity. The right graph in Figure 4.2 show the car speeding up to reach the maximum velocity of four. The concavity of the right graph shows that the car is accelerating because it is concave up. 4.5 Simulation with an Object Traveling with a Slow Constant Speed This simulation illustrates the response of a car to a slow moving vehicle in front of it. We start the cars close enough together that the back car will need to adjust its speed. 20

30 Fig. 4.2: Position (left graph) and velocity (right graph) versus time for a car that starts out slow and accelerates because it has a clear path. For this simulation we have the first-order system in Equation 4.4 for the position x 1 (t) and velocity y 1 (t) of a single car. In this simulation, x 2 (t) does describe a car s movement. We give it a prescribed velocity of two throughout the simulation and a starting position of ten. Thus, x 2 (t) = t. Thus, the system is dx 1 (t) dt = y 1 (t), dy 1 (t) dt = a(v ((10 + 2t) x 1 (t)) y 1 (t)). Car 1 begins at position x 1 (0) = 5. The velocity of the car is initially set to be the optimal velocity as follows: dx 1 dt = V ( x 1 (0)), t=0 21

31 Fig. 4.3: Position (left graph) and velocity (right graph) versus time for a car (solid line) with a slow moving constant speed object (dashed line) in front of it. where x 1 (0) = x 2 (0) x 1 (0) = 10 5 = 5 is the headway at time zero. Now we can use the fourth-order Runge-Kutta method to solve for the position x 1 (t) and the velocity y 1 (t) of the car. The code appears in Appix A.2.4. Figure 4.3 shows the results of the simulation. The left figure shows the position of the car and the constant moving car as functions of time. The right figure shows the velocities. Both graphs in Figure 4.3 show the car slowing down to match the speed of the slower moving car. 4.6 Simulation with a Stopped Object and Two Cars This simulation illustrates the response of two cars to a stopped object. This is similar to the simulation in Section 4.3, but we add another car to see how the dynamics change. For this simulation we have the first-order system in Equation 4.4 for the positions x i (t) 22

32 and velocities y i (t) of when i is one and then two. Analogous to x 2 (t) in Section 4.3, here x 3 (t) is the position of a stopped object at 20. Throughout the simulation we use x 3 (t) = 20. Thus, the system is dx i (t) dt = y i (t), dy i (t) dt = a(v (x i+1 (t) x i (t)) y i (t)), where i = 1, 2. The headways of the cars are x 1 (t) = x 2 (t) x 1 (t) and x 2 (t) = 20 x 2 (t). The cars begin at positions x 1 (0) = 0 and x 2 (0) = 5. The velocity of the cars is initially set to be the optimal velocity as follows: dx i dt = V ( x i (0)), where i = 1, 2. t=0 Now we can use the fourth-order Runge-Kutta method to solve for the positions x i (t) and the velocities y i (t) where i = 1, 2. The code appears in Appix A.2.5. Figure 4.4 shows the results of the simulation. The left figure shows the position of the cars. The right figure shows the velocities. Both graphs in Figure 4.4 show car 2 (dashed line) slowing down as it approaches the stopped object. Car 1 (solid line) starts slightly slower than the car 2, approaches maximum velocity, and then slows down. 23

33 Fig. 4.4: Position (left graph) and velocity (right graph) versus time for two cars (solid line and dashed line) approaching a stopped object. 4.7 Simulation with a Clear Road in Front of Two Cars This simulation illustrates the response of two cars to an open road. This is similar to the simulation in Section 4.4, but we add another car to see how the dynamics change. For this simulation we have the first-order system in Equation 4.4 for the positions x i (t) and velocities y i (t) of when i is one and then two. In analogy with Section 4.4 we consider x 3 (t) to be the position of a far away object at 100. Throughout the simulation we use x 3 (t) = 100. Thus, the system is dx i (t) dt = y i (t), dy i (t) dt = a(v (x i+1 (t) x i (t)) y i (t)), where i = 1, 2. 24

34 The headways of the cars are x 1 (t) = x 2 (t) x 1 (t) and x 2 (t) = 100 x 2 (t). The cars begin at positions x 1 (0) = 0 and x 2 (0) = 5. The velocity of the car 1 is initially set to be the optimal velocity as follows: dx 1 dt = V ( x 1 (0)), t=0 where x 1 (0) = 5. The velocity of car 2 is given the slow initial velocity of 1. Thus, dx 2 dt = 1. t=0 Now we can use the fourth-order Runge-Kutta method to solve for the positions x i (t) and the velocities y i (t) where i = 1, 2. The code appears in Appix A.2.6. Figure 4.5 shows the results of the simulation. The left figure shows the position of the cars as functions of time. The right figure shows the velocities. Both graphs in Figure 4.5 show car 2 (dashed line) speeding up toward the maximum velocity and car 1 (solid line) following suit. Car 1 needs to slow down at first because the two cars are so close, but then it speeds up as car 2 gains speed. 25

35 Fig. 4.5: Position (left graph) and velocity (right graph) versus time for two cars (solid line and dashed line) accelerating. 4.8 Simulation with an Object Traveling with a Slow Constant Speed and Two Cars This simulation illustrates the response of two cars to a slow constant moving object. This is similar to the simulation in Section 4.5, but we add another car to see how the dynamics change. For this simulation we have the first-order system in Equation 4.4 for the positions x i (t) and velocities y i (t) of when i is one and then two. As in Section 4.5 we consider x 3 (t) to be the position of a car moving with a constant velocity of three and starting at position ten. Thus, x 3 (t) = t throughout the simulation. Thus, the system is dx i (t) dt = y i (t), dy i (t) dt = a(v (x i+1 (t) x 1 (t)) y i (t)), where i = 1, 2, 26

36 Fig. 4.6: Position (left graph) and velocity (right graph) versus time for two car (solid line and dashed line) slowing down for a slow moving object (circle line). where x 1 (t) = x 2 (t) x 1 (t) and x 2 (t) = (10 + 3t) x 1 (t). The cars begin at positions x 1 (0) = 0, x 2 (0) = 5, and x 3 (0) = 10. The velocity of the cars is initially set to be the optimal velocity as follows: dx i dt = V ( x i (0)). t=0 Now we can use the fourth-order Runge-Kutta method to solve for the positions x i (t) and the velocities y i (t) where i = 1, 2. The code appears in Appix A.2.7. Figure 4.6 shows the results of the simulation. The left figure shows the position of the cars as functions of time. The right figure shows the velocities. Both graphs in Figure 4.6 show car 2 (dashed line) slowing down to adjust to the slower speed of the object ahead (circle line) and car 1 (solid line) following suit. 27

37 Chapter 5 Conclusions In this work we shed light on how to implement the fourth-order Runge-Kutta method on the Optimal Velocity Model (Kurata & Nagatani, 2003). We defined and discussed initial conditions and base cases of the lead car. We also expanded the dynamics explored by Kurata and Nagatani (2003) by imposing a variety of behaviors for the leading car as well as a variety of initial conditions. By considering a small number of cars in one lane we have validated the Optimal Velocity Model by accurately simulating traffic scenarios. Since the traffic simulations replicated real life well, the performance of the fourth-order Runge-Kutta method produced good results for the Optimal Velocity Model. 28

38 Chapter 6 Future Work In future work, we would like to replicate the updating system of Kurata and Nagatani (2003) based on distance in between the last car and the start of the system. Kurata and Nagatani (2003) added a car when the last car reached a certain distance. We would like to explore a time updating system. So instead of adding a car once the last car reached a certain distance, add a car each time the system advanced a specified amount of time. Another interesting simulation would be to set the lead car to have a velocity that slows downs and speeds up. An equation like v(t) = 2 + α sin ωt, where α and ω are constants would achieve this scenario. Another area of interest would be analyzing the lane changing conditions presented by Kurata and Nagatani (2003) and how they interact with the implementation of the Runge-Kutta. In the literature, it is not explicitly described how to deal with such a system. Chen et al. (2014) uses Euler s method on the Full Velocity Difference model. An interesting project would be to repeat the process done here to explicitly state the initial conditions and base cases for the lead car. 29

39 References Burden, R. L., & Faires, J. D. (2003). Numerical analysis. Boston, MA: Brooks/Cole. Chen, J., Peng, Z., & Fang, Y. (2014). Effects of car accidents on three-lane traffic flow. Mathematical Problems in Engineering, 2014 (413852). Kurata, S., & Nagatani, T. (2003). Spatio-temporal dynamics of jams in two-lane traffic flow with a blockage. Physica A: Statistical Mechanics and Its Applications, 318, MATLAB. (2014). Version 8.3 (r2014a). Natick, Massachusetts: The MathWorks Inc. 30

40 Appix A Code Implementation This appix contains the MATLAB (2014) code writen for the thesis. A.1 Textbook Problem Codes A.1.1 Euler s Method Equations The function y1 is the right-hand side of the differential equation 2.1. function [ c ] = y1( t,y ) c=1+y/t; The function y1exact is the exact solution to the initial value problem 2.3. function [ c ] = y1exact( t ) c=t*(log(abs(t))+2); 31

41 Method The function Eulers performs Euler s Method with N mesh points on the initial value problem 2.1. The input a is the starting t value, b is the ing t value, N is the number of mesh points, alpha is the initial condition, f is the right-hand side of the differential equation 2.1, and the function fe is the exact solution. function [ c ] = Eulers(a,b,N,alpha,f,fe ) h=(b-a)/n; t=a; w=alpha; c=[t w fe(t)]; for i=1:n w=w+h*f(t,w); t=a+i*h; c(1+i,:)=[t w fe(t)]; x=1:.01:2; for i=1:101 y(i)=y1exact(x(i)); figure plot(x,y,c(:,1),c(:,2),'o-') title('euler''s Method') ylabel('y') xlabel('x') 32

42 A.1.2 Runge-Kutta Method Equations The function y1 is the right-hand side of the differential equation 2.1. function [ c ] = y1( t,y ) c=1+y/t; The function y1exact is the exact solution to the initial value problem function [ c ] = y1exact( t ) c=t*(log(abs(t))+2); Method The function Runge4th performs Fourth Order Runge-Kutta Method with N mesh points on an initial value problem 2.1. The input a is the starting t value, b is the ing t value, N is the number of mesh points, alpha is the initial condition, f is the right-hand side of the differential equation 2.1, and the function fe is the exact solution. function [ c] = Runge4th(a,b,N,alpha,f,fe ) h=(b-a)/n; t=a; w=alpha; 33

43 c=[t w]; for i=1:n k1=h*f(t,w); k2=h*f(t+h/2,w+k1/2); k3=h*f(t+h/2,w+k2/2); k4=h*f(t+h,w+k3); w=w+(k1+2*k2+2*k3+k4)/6; t=a+i*h; c(1+i,:)=[t w]; x=1:.01:2; for i=1:101 y(i)=fe(x(i)); figure plot(x,y,c(:,1),c(:,2),'o-'); title('fourth Order Runge-Kutta Method') ylabel('y') xlabel('x') A.1.3 Runge-Kutta for Systems Equations The functions f1, f2, and f3 are the right-hand sides of the equations 3.1. function z=f1(t,u1,u2,u3) z=u2-u3+t; 34

44 function z= f2(t, u1, u2, u3) z=3*t^2; function z=f3(t, u1, u2, u3) z=u2+exp(-t); Method The function FourthOrderSystem will perform the Fourth Order Runge-Kutta Method on the above system of equations. The input a is the starting t value, b is the ing t value, m is the number of equations, N is the number of mesh points, the vector alpha is the initial condition, f is the a vector whose components are the functions f1, f2, f3 above. function [c] = FourthOrderSystem( a,b,m,n,alpha,f) h=(b-a)/n; t= a:h:b; solutions=zeros((n+1),(6+1)); w=alpha; k=zeros(4,m); solutions(:,1)=t; for j= 1:m solutions(1,(j+1))= alpha(j); for i=1:n 35

45 for j=1:m k(1,j)=h*f{j}(t(i),w(1),w(2),w(3)); for j=1:m k(2,j)=h*f{j}(t(i)+h/2,w(1)+1/2*k(1,1),w(2)+1/2*k(1,2),w(3)+1/2*k(1,3)); for j=1:m k(3,j)=h*f{j}(t(i)+h/2,w(1)+1/2*k(2,1),w(2)+1/2*k(2,2),w(3)+1/2*k(2,3)); for j=1:m k(4,j)=h*f{j}(t(i)+h,w(1)+k(3,1),w(2)+k(3,2),w(3)+k(3,3)); for j=1:m w(j)=w(j)+(k(1,j)+2*k(2,j)+2*k(3,j)+k(4,j))/6; solutions(i+1,j+1)=w(j); solutions(i+1,5:7)=[exactf1(t(i+1)) exactf2(t(i+1)) exactf3(t(i+1))]; c=solutions; A.2 Traffic Model Code A.2.1 Traffic Model Equation Code These three MATLAB functions make up the Optimal Velocity Model of traffic flow. They can be called by a numerical method such as the Fourth Order Runge-Kutta method to run simulations. The function vdot is the factor multiplying the sensitivity parameter a in the Optimal 36

46 Velocity Model, equation 4.1. function x = vdot( u1,u2, y) x=v(u1, u2)-y; The function V is the Optimal Velocity Equation, equation 4.3. function c= V(u1,u2) c=4/2*(tanh((u2-u1)-4)+tanh(4)); The function xdot returns the value of the velocity of the car. function u = xdot( y ) u=y; A.2.2 Runge-Kutta for Stopped Object and One Car The function RungeKuttaStopped performs a Fourth Order Runge-Kutta on the Optimal Velocity Model. This program creates a graph of a car starting at zero approaching an object stopped at 20. function c = RungeKuttaStopped( ) lane1=[0 20]; 37

47 %lane1 is the initial positions of cars v1=v(lane1(1),lane1(2)); %v are the initial velocity of the cars h=.001; disp(v1); count=1; fileid=fopen('rungekuttastopped.dat','w'); for t=1:6000 kx2(1)=h*xdot(v1); kv2(1)=h*vdot(lane1(1),lane1(2), v1); kx2(2)=h*xdot(v1+1/2*kv2(1)); kv2(2)=h*vdot(lane1(1)+1/2*kx2(1),lane1(2),v1+1/2*kv2(1)); kx2(3)=h*xdot(v1+1/2*kv2(2)); kv2(3)=h*vdot(lane1(1)+1/2*kx2(2),lane1(2),v1+1/2*kv2(2)); kx2(4)=h*xdot(v1+kv2(3)); kv2(4)=h*vdot(lane1(1)+kx2(3),lane1(2),v1+kv2(3)); lane1(1)=lane1(1)+(kx2(1)+2*kx2(2)+2*kx2(3)+kx2(4))/6; v1=v1+(kv2(1)+2*kv2(2)+2*kv2(3)+kv2(4))/6; if (mod(t,100)==0) rkplot(count,:)=[t*h lane1(1) lane1(2) v1 0]; count=1+count; 38

48 if (mod(t,100)==0) fprintf(fileid, '%4.7f %4.7f \r\n', lane1); fclose(fileid); figure plot(rkplot(:,1),rkplot(:,2),'-',... rkplot(:,1),rkplot(:,3),'--','linewidth',2); title('position','fontsize',14) xlabel('t','fontsize',12) ylabel('x_i(t)','fontsize',12) axis([ ]) figure plot(rkplot(:,1),rkplot(:,4),'-',... rkplot(:,1),rkplot(:,5),'--','linewidth',2); title('velocity','fontsize',14) xlabel('t','fontsize',12) ylabel('dx_i/dt(t)','fontsize',12) axis([ ]) c=[lane1(1) lane1(2)]; 39

49 A.2.3 Runge-Kutta for a Clear Road in Front of the Car The function RungeKuttaClearPath performs a Fourth Order Runge-Kutta on the Optimal Velocity Model. This program creates a graph of a car starting at zero approaching a far away object at 100. function c = RungeKuttaClearPath( ) lane1=[0 100]; %lane1 is the initial positions of cars v1=1; %v are the initial velocity of the cars h=.001; disp(v1); count=1; fileid=fopen('rungekuttastopped.dat','w'); for t=1:6000 kx2(1)=h*xdot(v1); kv2(1)=h*vdot(lane1(1),lane1(2), v1); kx2(2)=h*xdot(v1+1/2*kv2(1)); kv2(2)=h*vdot(lane1(1)+1/2*kx2(1),lane1(2),v1+1/2*kv2(1)); kx2(3)=h*xdot(v1+1/2*kv2(2)); kv2(3)=h*vdot(lane1(1)+1/2*kx2(2),lane1(2),v1+1/2*kv2(2)); kx2(4)=h*xdot(v1+kv2(3)); kv2(4)=h*vdot(lane1(1)+kx2(3),lane1(2),v1+kv2(3)); 40

50 lane1(1)=lane1(1)+(kx2(1)+2*kx2(2)+2*kx2(3)+kx2(4))/6; v1=v1+(kv2(1)+2*kv2(2)+2*kv2(3)+kv2(4))/6; if (mod(t,100)==0) rkplot(count,:)=[t*h lane1(1) lane1(2) v1 0]; count=1+count; if (mod(t,100)==0) fprintf(fileid, '%4.7f %4.7f \r\n', lane1); fclose(fileid); figure plot(rkplot(:,1),rkplot(:,2),'-',... 'LineWidth',2); title('position','fontsize',14) xlabel('t','fontsize',12) ylabel('x_i(t)','fontsize',12) axis([ ]) figure plot(rkplot(:,1),rkplot(:,4),'-',... 'LineWidth',2); title('velocity','fontsize',14) xlabel('t','fontsize',12) ylabel('dx_i/dt(t)','fontsize',12) 41

51 axis([ ]) c=[lane1(1) lane1(2)]; A.2.4 Runge-Kutta for a Car Following an Object Traveling with a Slow Constant Speed The function RungeKuttaConstant performs a Fourth Order Runge-Kutta on the Optimal Velocity Model. This program creates a graph of a car starting at five approaching an object starting at ten moving at a speed of two. function c = RungeKuttaConstant( ) lane1=[5 10]; %lane1 is the initial positions of cars v1=v(lane1(1),lane1(2)); v2=2; %v are the initial velocity of the cars h=.001; disp(v1); count=1; fileid=fopen('rungekuttaconstant.dat','w'); for t=1:6000 kx1(1)=h*xdot(v1); kv1(1)=h*vdot(lane1(1),lane1(2), v1); 42

52 kx1(2)=h*xdot(v1+1/2*kv1(1)); kv1(2)=h*vdot(lane1(1)+1/2*kx1(1),lane1(2),v1+1/2*kv1(1)); kx1(3)=h*xdot(v1+1/2*kv1(2)); kv1(3)=h*vdot(lane1(1)+1/2*kx1(2),lane1(2),v1+1/2*kv1(2)); kx1(4)=h*xdot(v1+kv1(3)); kv1(4)=h*vdot(lane1(1)+kx1(3),lane1(2),v1+kv1(3)); lane1(1)=lane1(1)+(kx1(1)+2*kx1(2)+2*kx1(3)+kx1(4))/6; lane1(2)=10+v2*t*h; v1=v1+(kv1(1)+2*kv1(2)+2*kv1(3)+kv1(4))/6; if (mod(t,100)==0) rkplot(count,:)=[t*h lane1(1) lane1(2) v1 v2]; count=1+count; disp(v2); disp(t*h); disp(lane1(2)); if (mod(t,100)==0) fprintf(fileid, '%4.7f %4.7f \r\n', lane1); 43

53 fclose(fileid); figure plot(rkplot(:,1),rkplot(:,2),'-',... rkplot(:,1),rkplot(:,3),'--','linewidth',2); title('position', 'FontSize', 14) xlabel('t','fontsize',12) ylabel('x_i(t)','fontsize', 12) axis([ ]) figure plot(rkplot(:,1),rkplot(:,4),'-',... rkplot(:,1),rkplot(:,5),'--','linewidth',2); title('velocity', 'FontSize', 14) xlabel('t','fontsize',12) ylabel('dx_i/dt(t)','fontsize',12) axis([ ]) c=[lane1(1) lane1(2)]; A.2.5 Runge-Kutta for Stopped Object and Two Cars The function RungeKuttaStopped2 performs a Fourth Order Runge-Kutta on the Optimal Velocity Model. This program creates a graph of a cars starting at zero and five approaching an object stopped at 20. function c = RungeKuttaStopped2( ) lane1=[0 5 20]; 44

54 %lane1 is the initial positions of cars v1=v(lane1(1),lane1(2)); v2=v(5,20); %v are the initial velocity of the cars h=.001; disp(v1); count=1; fileid=fopen('rungekuttadecel.dat','w'); for t=1:6000 kx1(1)=h*xdot(v1); kv1(1)=h*vdot(lane1(1),lane1(2), v1); kx2(1)=h*xdot(v2); kv2(1)=h*vdot(lane1(2),lane1(3), v2); kx1(2)=h*xdot(v1+1/2*kv1(1)); kv1(2)=h*vdot(lane1(1)+1/2*kx1(1),lane1(2)+1/2*kx2(1),v1+1/2*kv1(1)); kx2(2)=h*xdot(v2+1/2*kv2(1)); kv2(2)=h*vdot(lane1(2)+1/2*kx2(1),lane1(3),v2+1/2*kv2(1)); kx1(3)=h*xdot(v1+1/2*kv1(2)); kv1(3)=h*vdot(lane1(1)+1/2*kx1(2),lane1(2)+1/2*kx2(2),v1+1/2*kv1(2)); kx2(3)=h*xdot(v2+1/2*kv2(2)); kv2(3)=h*vdot(lane1(2)+1/2*kx2(2),lane1(3),v2+1/2*kv2(2)); kx1(4)=h*xdot(v1+kv1(3)); kv1(4)=h*vdot(lane1(1)+kx1(3),lane1(2)+1/2*kx2(3),v1+kv1(3)); kx2(4)=h*xdot(v2+kv2(3)); kv2(4)=h*vdot(lane1(2)+kx2(3),lane1(3),v2+kv2(3)); lane1(1)=lane1(1)+(kx1(1)+2*kx1(2)+2*kx1(3)+kx1(4))/6; 45

55 lane1(2)=lane1(2)+(kx2(1)+2*kx2(2)+2*kx2(3)+kx2(4))/6; v1=v1+(kv1(1)+2*kv1(2)+2*kv1(3)+kv1(4))/6; v2=v2+(kv2(1)+2*kv2(2)+2*kv2(3)+kv2(4))/6; if (mod(t,100)==0) rkplot(count,:)=[t*h lane1(1) lane1(2) v1 v2]; count=1+count; if (mod(t,100)==0) fprintf(fileid, '%4.7f %4.7f \r\n', lane1); fclose(fileid); figure plot(rkplot(:,1),rkplot(:,2),'-',... rkplot(:,1),rkplot(:,3),'--',rkplot(:,1),20,'ro-','linewidth',2); title('position','fontsize',14) xlabel('t','fontsize',12) ylabel('x_i(t)','fontsize',12) axis([ ]) figure plot(rkplot(:,1),rkplot(:,4),'-',... rkplot(:,1),rkplot(:,5),'--',rkplot(:,1),0,'ro-','linewidth',2); title('velocity','fontsize',14) xlabel('t','fontsize',12) ylabel('dx_i/dt(t)','fontsize',12) axis([ ]) 46

56 c=[lane1(1) lane1(2)]; A.2.6 Runge-Kutta for a Clear Road in Front of Two Cars The function RungeKuttaClearPathTwoCar performs a Fourth Order Runge-Kutta on the Optimal Velocity Model. This program creates a graph of a cars starting at zero and five approaching a far away object at 100. function c = RungeKuttaClearPathTwoCar( ) lane1=[0 5 10]; %lane1 is the initial positions of cars v1=v(lane1(1),lane1(2)); v2=v(lane1(2), lane1(3)); %v are the initial velocity of the cars h=.001; disp(v1); count=1; fileid=fopen('rungekuttadecel.dat','w'); for t=1:6000 kx1(1)=h*xdot(v1); kv1(1)=h*vdot(lane1(1),lane1(2), v1); kx2(1)=h*xdot(v2); kv2(1)=h*vdot(lane1(2),lane1(3), v2); kx1(2)=h*xdot(v1+1/2*kv1(1)); 47

57 kv1(2)=h*vdot(lane1(1)+1/2*kx1(1),lane1(2)+1/2*kx2(1),v1+1/2*kv1(1)); kx2(2)=h*xdot(v2+1/2*kv2(1)); kv2(2)=h*vdot(lane1(2)+1/2*kx2(1),lane1(3),v2+1/2*kv2(1)); kx1(3)=h*xdot(v1+1/2*kv1(2)); kv1(3)=h*vdot(lane1(1)+1/2*kx1(2),lane1(2)+1/2*kx2(2),v1+1/2*kv1(2)); kx2(3)=h*xdot(v2+1/2*kv2(2)); kv2(3)=h*vdot(lane1(2)+1/2*kx2(2),lane1(3),v2+1/2*kv2(2)); kx1(4)=h*xdot(v1+kv1(3)); kv1(4)=h*vdot(lane1(1)+kx1(3),lane1(2)+1/2*kx2(3),v1+kv1(3)); kx2(4)=h*xdot(v2+kv2(3)); kv2(4)=h*vdot(lane1(2)+kx2(3),lane1(3),v2+kv2(3)); lane1(1)=lane1(1)+(kx1(1)+2*kx1(2)+2*kx1(3)+kx1(4))/6; lane1(2)=lane1(2)+(kx2(1)+2*kx2(2)+2*kx2(3)+kx2(4))/6; lane1(3)=10+3*t*h; v1=v1+(kv1(1)+2*kv1(2)+2*kv1(3)+kv1(4))/6; v2=v2+(kv2(1)+2*kv2(2)+2*kv2(3)+kv2(4))/6; if (mod(t,100)==0) disp(lane1(3)); rkplot(count,:)=[t*h lane1(1) lane1(2) v1 v2 lane1(3) 3]; count=1+count; if (mod(t,100)==0) fprintf(fileid, '%4.7f %4.7f \r\n', lane1); 48

Higher Order Taylor Methods

Higher Order Taylor Methods Higher Order Taylor Methods Marcelo Julio Alvisio & Lisa Marie Danz May 6, 2007 Introduction Differential equations are one of the building blocks in science or engineering. Scientists aim to obtain numerical

More information

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Part 6 Chapter 20 Initial-Value Problems PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction

More information

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Part 6 Chapter 20 Initial-Value Problems PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction

More information

Initial value problems for ordinary differential equations

Initial value problems for ordinary differential equations Initial value problems for ordinary differential equations Xiaojing Ye, Math & Stat, Georgia State University Spring 2019 Numerical Analysis II Xiaojing Ye, Math & Stat, Georgia State University 1 IVP

More information

Math 128A Spring 2003 Week 12 Solutions

Math 128A Spring 2003 Week 12 Solutions Math 128A Spring 2003 Week 12 Solutions Burden & Faires 5.9: 1b, 2b, 3, 5, 6, 7 Burden & Faires 5.10: 4, 5, 8 Burden & Faires 5.11: 1c, 2, 5, 6, 8 Burden & Faires 5.9. Higher-Order Equations and Systems

More information

Euler s Method, cont d

Euler s Method, cont d Jim Lambers MAT 461/561 Spring Semester 009-10 Lecture 3 Notes These notes correspond to Sections 5. and 5.4 in the text. Euler s Method, cont d We conclude our discussion of Euler s method with an example

More information

Consistency and Convergence

Consistency and Convergence Jim Lambers MAT 77 Fall Semester 010-11 Lecture 0 Notes These notes correspond to Sections 1.3, 1.4 and 1.5 in the text. Consistency and Convergence We have learned that the numerical solution obtained

More information

Chap. 20: Initial-Value Problems

Chap. 20: Initial-Value Problems Chap. 20: Initial-Value Problems Ordinary Differential Equations Goal: to solve differential equations of the form: dy dt f t, y The methods in this chapter are all one-step methods and have the general

More information

Fourth Order RK-Method

Fourth Order RK-Method Fourth Order RK-Method The most commonly used method is Runge-Kutta fourth order method. The fourth order RK-method is y i+1 = y i + 1 6 (k 1 + 2k 2 + 2k 3 + k 4 ), Ordinary Differential Equations (ODE)

More information

Ordinary Differential Equations

Ordinary Differential Equations Chapter 7 Ordinary Differential Equations Differential equations are an extremely important tool in various science and engineering disciplines. Laws of nature are most often expressed as different equations.

More information

Ordinary Differential Equations

Ordinary Differential Equations CHAPTER 8 Ordinary Differential Equations 8.1. Introduction My section 8.1 will cover the material in sections 8.1 and 8.2 in the book. Read the book sections on your own. I don t like the order of things

More information

Numerical Differential Equations: IVP

Numerical Differential Equations: IVP Chapter 11 Numerical Differential Equations: IVP **** 4/16/13 EC (Incomplete) 11.1 Initial Value Problem for Ordinary Differential Equations We consider the problem of numerically solving a differential

More information

Physics 584 Computational Methods

Physics 584 Computational Methods Physics 584 Computational Methods Introduction to Matlab and Numerical Solutions to Ordinary Differential Equations Ryan Ogliore April 18 th, 2016 Lecture Outline Introduction to Matlab Numerical Solutions

More information

Variable Step Size Differential Equation Solvers

Variable Step Size Differential Equation Solvers Math55: Differential Equations 1/30 Variable Step Size Differential Equation Solvers Jason Brewer and George Little Introduction The purpose of developing numerical methods is to approximate the solution

More information

Numerical Methods - Initial Value Problems for ODEs

Numerical Methods - Initial Value Problems for ODEs Numerical Methods - Initial Value Problems for ODEs Y. K. Goh Universiti Tunku Abdul Rahman 2013 Y. K. Goh (UTAR) Numerical Methods - Initial Value Problems for ODEs 2013 1 / 43 Outline 1 Initial Value

More information

Do not turn over until you are told to do so by the Invigilator.

Do not turn over until you are told to do so by the Invigilator. UNIVERSITY OF EAST ANGLIA School of Mathematics Main Series UG Examination 216 17 INTRODUCTION TO NUMERICAL ANALYSIS MTHE612B Time allowed: 3 Hours Attempt QUESTIONS 1 and 2, and THREE other questions.

More information

Initial value problems for ordinary differential equations

Initial value problems for ordinary differential equations AMSC/CMSC 660 Scientific Computing I Fall 2008 UNIT 5: Numerical Solution of Ordinary Differential Equations Part 1 Dianne P. O Leary c 2008 The Plan Initial value problems (ivps) for ordinary differential

More information

CELLULAR AUTOMATA SIMULATION OF TRAFFIC LIGHT STRATEGIES IN OPTIMIZING THE TRAFFIC FLOW

CELLULAR AUTOMATA SIMULATION OF TRAFFIC LIGHT STRATEGIES IN OPTIMIZING THE TRAFFIC FLOW CELLULAR AUTOMATA SIMULATION OF TRAFFIC LIGHT STRATEGIES IN OPTIMIZING THE TRAFFIC FLOW ENDAR H. NUGRAHANI, RISWAN RAMDHANI Department of Mathematics, Faculty of Mathematics and Natural Sciences, Bogor

More information

2tdt 1 y = t2 + C y = which implies C = 1 and the solution is y = 1

2tdt 1 y = t2 + C y = which implies C = 1 and the solution is y = 1 Lectures - Week 11 General First Order ODEs & Numerical Methods for IVPs In general, nonlinear problems are much more difficult to solve than linear ones. Unfortunately many phenomena exhibit nonlinear

More information

10 Numerical Solutions of PDEs

10 Numerical Solutions of PDEs 10 Numerical Solutions of PDEs There s no sense in being precise when you don t even know what you re talking about.- John von Neumann (1903-1957) Most of the book has dealt with finding exact solutions

More information

Answers to Problem Set Number 02 for MIT (Spring 2008)

Answers to Problem Set Number 02 for MIT (Spring 2008) Answers to Problem Set Number 02 for 18.311 MIT (Spring 2008) Rodolfo R. Rosales (MIT, Math. Dept., room 2-337, Cambridge, MA 02139). March 10, 2008. Course TA: Timothy Nguyen, MIT, Dept. of Mathematics,

More information

Lecture Notes on Numerical Differential Equations: IVP

Lecture Notes on Numerical Differential Equations: IVP Lecture Notes on Numerical Differential Equations: IVP Professor Biswa Nath Datta Department of Mathematical Sciences Northern Illinois University DeKalb, IL. 60115 USA E mail: dattab@math.niu.edu URL:

More information

multistep methods Last modified: November 28, 2017 Recall that we are interested in the numerical solution of the initial value problem (IVP):

multistep methods Last modified: November 28, 2017 Recall that we are interested in the numerical solution of the initial value problem (IVP): MATH 351 Fall 217 multistep methods http://www.phys.uconn.edu/ rozman/courses/m351_17f/ Last modified: November 28, 217 Recall that we are interested in the numerical solution of the initial value problem

More information

FORTRAN 77 Lesson 7. Reese Haywood Ayan Paul

FORTRAN 77 Lesson 7. Reese Haywood Ayan Paul FORTRAN 77 Lesson 7 Reese Haywood Ayan Paul 1 Numerical Integration A general all purpose Numerical Integration technique is the Trapezoidal Method. For most functions, this method is fast and accurate.

More information

Scientific Computing with Case Studies SIAM Press, Lecture Notes for Unit V Solution of

Scientific Computing with Case Studies SIAM Press, Lecture Notes for Unit V Solution of Scientific Computing with Case Studies SIAM Press, 2009 http://www.cs.umd.edu/users/oleary/sccswebpage Lecture Notes for Unit V Solution of Differential Equations Part 1 Dianne P. O Leary c 2008 1 The

More information

( ) for t 0. Rectilinear motion CW. ( ) = t sin t ( Calculator)

( ) for t 0. Rectilinear motion CW. ( ) = t sin t ( Calculator) Rectilinear motion CW 1997 ( Calculator) 1) A particle moves along the x-axis so that its velocity at any time t is given by v(t) = 3t 2 2t 1. The position x(t) is 5 for t = 2. a) Write a polynomial expression

More information

Lecture 4: Numerical solution of ordinary differential equations

Lecture 4: Numerical solution of ordinary differential equations Lecture 4: Numerical solution of ordinary differential equations Department of Mathematics, ETH Zürich General explicit one-step method: Consistency; Stability; Convergence. High-order methods: Taylor

More information

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Part 5 Chapter 21 Numerical Differentiation PowerPoints organized by Dr. Michael R. Gustafson II, Duke University 1 All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction

More information

Traffic Modelling for Moving-Block Train Control System

Traffic Modelling for Moving-Block Train Control System Commun. Theor. Phys. (Beijing, China) 47 (2007) pp. 601 606 c International Academic Publishers Vol. 47, No. 4, April 15, 2007 Traffic Modelling for Moving-Block Train Control System TANG Tao and LI Ke-Ping

More information

Introduction to the Numerical Solution of IVP for ODE

Introduction to the Numerical Solution of IVP for ODE Introduction to the Numerical Solution of IVP for ODE 45 Introduction to the Numerical Solution of IVP for ODE Consider the IVP: DE x = f(t, x), IC x(a) = x a. For simplicity, we will assume here that

More information

Numerical Methods for Differential Equations

Numerical Methods for Differential Equations Numerical Methods for Differential Equations Chapter 2: Runge Kutta and Linear Multistep methods Gustaf Söderlind and Carmen Arévalo Numerical Analysis, Lund University Textbooks: A First Course in the

More information

Differential Equations

Differential Equations Differential Equations Definitions Finite Differences Taylor Series based Methods: Euler Method Runge-Kutta Methods Improved Euler, Midpoint methods Runge Kutta (2nd, 4th order) methods Predictor-Corrector

More information

INTRODUCTION TO COMPUTER METHODS FOR O.D.E.

INTRODUCTION TO COMPUTER METHODS FOR O.D.E. INTRODUCTION TO COMPUTER METHODS FOR O.D.E. 0. Introduction. The goal of this handout is to introduce some of the ideas behind the basic computer algorithms to approximate solutions to differential equations.

More information

Initial-Value Problems for ODEs. Introduction to Linear Multistep Methods

Initial-Value Problems for ODEs. Introduction to Linear Multistep Methods Initial-Value Problems for ODEs Introduction to Linear Multistep Methods Numerical Analysis (9th Edition) R L Burden & J D Faires Beamer Presentation Slides prepared by John Carroll Dublin City University

More information

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by 1. QUESTION (a) Given a nth degree Taylor polynomial P n (x) of a function f(x), expanded about x = x 0, write down the Lagrange formula for the truncation error, carefully defining all its elements. How

More information

Distance And Velocity

Distance And Velocity Unit #8 - The Integral Some problems and solutions selected or adapted from Hughes-Hallett Calculus. Distance And Velocity. The graph below shows the velocity, v, of an object (in meters/sec). Estimate

More information

Department of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004

Department of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004 Department of Applied Mathematics and Theoretical Physics AMA 204 Numerical analysis Exam Winter 2004 The best six answers will be credited All questions carry equal marks Answer all parts of each question

More information

Ordinary Differential Equations

Ordinary Differential Equations Chapter 13 Ordinary Differential Equations We motivated the problem of interpolation in Chapter 11 by transitioning from analzying to finding functions. That is, in problems like interpolation and regression,

More information

Worksheet 1: One-Dimensional Kinematics

Worksheet 1: One-Dimensional Kinematics Worksheet 1: One-Dimensional Kinematics Objectives Relate,, and in examples of motion along one dimension. Visualize motion using graphs of,, and vs.. Solve numeric problems involving constant and constant.

More information

Computers, Lies and the Fishing Season

Computers, Lies and the Fishing Season 1/47 Computers, Lies and the Fishing Season Liz Arnold May 21, 23 Introduction Computers, lies and the fishing season takes a look at computer software programs. As mathematicians, we depend on computers

More information

5) A stone is thrown straight up. What is its acceleration on the way up? 6) A stone is thrown straight up. What is its acceleration on the way down?

5) A stone is thrown straight up. What is its acceleration on the way up? 6) A stone is thrown straight up. What is its acceleration on the way down? 5) A stone is thrown straight up. What is its acceleration on the way up? Answer: 9.8 m/s 2 downward 6) A stone is thrown straight up. What is its acceleration on the way down? Answer: 9.8 m/ s 2 downward

More information

Do not turn over until you are told to do so by the Invigilator.

Do not turn over until you are told to do so by the Invigilator. UNIVERSITY OF EAST ANGLIA School of Mathematics Main Series UG Examination 216 17 INTRODUCTION TO NUMERICAL ANALYSIS MTHE712B Time allowed: 3 Hours Attempt QUESTIONS 1 and 2, and THREE other questions.

More information

Numerical methods for solving ODEs

Numerical methods for solving ODEs Chapter 2 Numerical methods for solving ODEs We will study two methods for finding approximate solutions of ODEs. Such methods may be used for (at least) two reasons the ODE does not have an exact solution

More information

Math 216 Final Exam 14 December, 2012

Math 216 Final Exam 14 December, 2012 Math 216 Final Exam 14 December, 2012 This sample exam is provided to serve as one component of your studying for this exam in this course. Please note that it is not guaranteed to cover the material that

More information

5.1 Area and Estimating with Finite Sums

5.1 Area and Estimating with Finite Sums 5.1 Area and Estimating with Finite Sums Ideas for this section The ideas for this section are Left-Hand Sums Ideas for this section The ideas for this section are Left-Hand Sums Right-Hand Sums Ideas

More information

ANOTHER FIVE QUESTIONS:

ANOTHER FIVE QUESTIONS: No peaking!!!!! See if you can do the following: f 5 tan 6 sin 7 cos 8 sin 9 cos 5 e e ln ln @ @ Epress sin Power Series Epansion: d as a Power Series: Estimate sin Estimate MACLAURIN SERIES ANOTHER FIVE

More information

Runge-Kutta methods. With orders of Taylor methods yet without derivatives of f (t, y(t))

Runge-Kutta methods. With orders of Taylor methods yet without derivatives of f (t, y(t)) Runge-Kutta metods Wit orders of Taylor metods yet witout derivatives of f (t, y(t)) First order Taylor expansion in two variables Teorem: Suppose tat f (t, y) and all its partial derivatives are continuous

More information

Comparison of Numerical Ordinary Differential Equation Solvers

Comparison of Numerical Ordinary Differential Equation Solvers Adrienne Criss Due: October, 008 Comparison of Numerical Ordinary Differential Equation Solvers Many interesting physical systems can be modeled by ordinary differential equations (ODEs). Since it is always

More information

Unit 2 - Linear Motion and Graphical Analysis

Unit 2 - Linear Motion and Graphical Analysis Unit 2 - Linear Motion and Graphical Analysis Motion in one dimension is particularly easy to deal with because all the information about it can be encapsulated in two variables: x, the position of the

More information

Motion Along a Straight Line

Motion Along a Straight Line Chapter 2 Motion Along a Straight Line PowerPoint Lectures for University Physics, Twelfth Edition Hugh D. Young and Roger A. Freedman Lectures by James Pazun Copyright 2008 Pearson Education Inc., publishing

More information

Computational project: Modelling a simple quadrupole mass spectrometer

Computational project: Modelling a simple quadrupole mass spectrometer Computational project: Modelling a simple quadrupole mass spectrometer Martin Duy Tat a, Anders Hagen Jarmund a a Norges Teknisk-Naturvitenskapelige Universitet, Trondheim, Norway. Abstract In this project

More information

Solution. Your sketch should show both x and y axes marked from 5 to 5 and circles of radius 1, 3, and 5 centered at the origin.

Solution. Your sketch should show both x and y axes marked from 5 to 5 and circles of radius 1, 3, and 5 centered at the origin. Solutions of the Sample Problems for the First In-Class Exam Math 246, Fall 208, Professor David Levermore () (a) Sketch the graph that would be produced by the following Matlab command. fplot(@(t) 2/t,

More information

DIFFERENTIAL EQUATIONS

DIFFERENTIAL EQUATIONS DIFFERENTIAL EQUATIONS Basic Concepts Paul Dawkins Table of Contents Preface... Basic Concepts... 1 Introduction... 1 Definitions... Direction Fields... 8 Final Thoughts...19 007 Paul Dawkins i http://tutorial.math.lamar.edu/terms.aspx

More information

Assignment 4:Rail Analysis and Stopping/Passing Distances

Assignment 4:Rail Analysis and Stopping/Passing Distances CEE 3604: Introduction to Transportation Engineering Fall 2012 Date Due: September 28, 2012 Assignment 4:Rail Analysis and Stopping/Passing Distances Instructor: Trani Problem 1 You are ased to evaluate

More information

AM 205 Final Project The N-Body Problem

AM 205 Final Project The N-Body Problem AM 205 Final Project The N-Body Problem Leah Birch Elizabeth Finn Karen Yu December 14, 2012 Abstract The N-Body Problem can be solved using a variety of numeric integrators. Newton s Law of Universal

More information

Solutions of the Sample Problems for the First In-Class Exam Math 246, Fall 2017, Professor David Levermore

Solutions of the Sample Problems for the First In-Class Exam Math 246, Fall 2017, Professor David Levermore Solutions of the Sample Problems for the First In-Class Exam Math 246, Fall 207, Professor David Levermore () (a) Give the integral being evaluated by the following Matlab command. int( x/(+xˆ4), x,0,inf)

More information

9.6 Predictor-Corrector Methods

9.6 Predictor-Corrector Methods SEC. 9.6 PREDICTOR-CORRECTOR METHODS 505 Adams-Bashforth-Moulton Method 9.6 Predictor-Corrector Methods The methods of Euler, Heun, Taylor, and Runge-Kutta are called single-step methods because they use

More information

Section 7.4 Runge-Kutta Methods

Section 7.4 Runge-Kutta Methods Section 7.4 Runge-Kutta Methods Key terms: Taylor methods Taylor series Runge-Kutta; methods linear combinations of function values at intermediate points Alternatives to second order Taylor methods Fourth

More information

A Brief Introduction to Numerical Methods for Differential Equations

A Brief Introduction to Numerical Methods for Differential Equations A Brief Introduction to Numerical Methods for Differential Equations January 10, 2011 This tutorial introduces some basic numerical computation techniques that are useful for the simulation and analysis

More information

Chapter 8. Numerical Solution of Ordinary Differential Equations. Module No. 1. Runge-Kutta Methods

Chapter 8. Numerical Solution of Ordinary Differential Equations. Module No. 1. Runge-Kutta Methods Numerical Analysis by Dr. Anita Pal Assistant Professor Department of Mathematics National Institute of Technology Durgapur Durgapur-71309 email: anita.buie@gmail.com 1 . Chapter 8 Numerical Solution of

More information

Harman Outline 1A Calculus CENG 5131 PDF

Harman Outline 1A Calculus CENG 5131 PDF Harman Outline 1A Calculus CENG 5131 PDF September 5, 2013 III. Review of Differentiation A.Basic Definitions Harman Ch6,P297 Approximations for the Derivative The expression for the derivative of a function

More information

Created by T. Madas KINEMATIC GRAPHS. Created by T. Madas

Created by T. Madas KINEMATIC GRAPHS. Created by T. Madas KINEMATIC GRAPHS SPEED TIME GRAPHS Question (**) A runner is running along a straight horizontal road. He starts from rest at point A, accelerating uniformly for 6 s, reaching a top speed of 7 ms. This

More information

September Math Course: First Order Derivative

September Math Course: First Order Derivative September Math Course: First Order Derivative Arina Nikandrova Functions Function y = f (x), where x is either be a scalar or a vector of several variables (x,..., x n ), can be thought of as a rule which

More information

Solution: (a) Before opening the parachute, the differential equation is given by: dv dt. = v. v(0) = 0

Solution: (a) Before opening the parachute, the differential equation is given by: dv dt. = v. v(0) = 0 Math 2250 Lab 4 Name/Unid: 1. (35 points) Leslie Leroy Irvin bails out of an airplane at the altitude of 16,000 ft, falls freely for 20 s, then opens his parachute. Assuming linear air resistance ρv ft/s

More information

Mathematics for chemical engineers. Numerical solution of ordinary differential equations

Mathematics for chemical engineers. Numerical solution of ordinary differential equations Mathematics for chemical engineers Drahoslava Janovská Numerical solution of ordinary differential equations Initial value problem Winter Semester 2015-2016 Outline 1 Introduction 2 One step methods Euler

More information

Computational Techniques Prof. Dr. Niket Kaisare Department of Chemical Engineering Indian Institute of Technology, Madras

Computational Techniques Prof. Dr. Niket Kaisare Department of Chemical Engineering Indian Institute of Technology, Madras Computational Techniques Prof. Dr. Niket Kaisare Department of Chemical Engineering Indian Institute of Technology, Madras Module No. # 07 Lecture No. # 04 Ordinary Differential Equations (Initial Value

More information

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations ECE257 Numerical Methods and Scientific Computing Ordinary Differential Equations Today s s class: Stiffness Multistep Methods Stiff Equations Stiffness occurs in a problem where two or more independent

More information

AIMS Exercise Set # 1

AIMS Exercise Set # 1 AIMS Exercise Set #. Determine the form of the single precision floating point arithmetic used in the computers at AIMS. What is the largest number that can be accurately represented? What is the smallest

More information

AM205: Assignment 3 (due 5 PM, October 20)

AM205: Assignment 3 (due 5 PM, October 20) AM25: Assignment 3 (due 5 PM, October 2) For this assignment, first complete problems 1, 2, 3, and 4, and then complete either problem 5 (on theory) or problem 6 (on an application). If you submit answers

More information

Introduction to standard and non-standard Numerical Methods

Introduction to standard and non-standard Numerical Methods Introduction to standard and non-standard Numerical Methods Dr. Mountaga LAM AMS : African Mathematic School 2018 May 23, 2018 One-step methods Runge-Kutta Methods Nonstandard Finite Difference Scheme

More information

Integration of Ordinary Differential Equations

Integration of Ordinary Differential Equations Integration of Ordinary Differential Equations Com S 477/577 Nov 7, 00 1 Introduction The solution of differential equations is an important problem that arises in a host of areas. Many differential equations

More information

Ph 22.1 Return of the ODEs: higher-order methods

Ph 22.1 Return of the ODEs: higher-order methods Ph 22.1 Return of the ODEs: higher-order methods -v20130111- Introduction This week we are going to build on the experience that you gathered in the Ph20, and program more advanced (and accurate!) solvers

More information

Ordinary differential equations - Initial value problems

Ordinary differential equations - Initial value problems Education has produced a vast population able to read but unable to distinguish what is worth reading. G.M. TREVELYAN Chapter 6 Ordinary differential equations - Initial value problems In this chapter

More information

Section 11.3 Rates of Change:

Section 11.3 Rates of Change: Section 11.3 Rates of Change: 1. Consider the following table, which describes a driver making a 168-mile trip from Cleveland to Columbus, Ohio in 3 hours. t Time (in hours) 0 0.5 1 1.5 2 2.5 3 f(t) Distance

More information

Section 11.1 Distance and Displacement (pages )

Section 11.1 Distance and Displacement (pages ) Name Class Date Section 11.1 Distance and Displacement (pages 328 331) This section defines distance and displacement. Methods of describing motion are presented. Vector addition and subtraction are introduced.

More information

ACCELERATION OF RUNGE-KUTTA INTEGRATION SCHEMES

ACCELERATION OF RUNGE-KUTTA INTEGRATION SCHEMES ACCELERATION OF RUNGE-KUTTA INTEGRATION SCHEMES PHAILAUNG PHOHOMSIRI AND FIRDAUS E. UDWADIA Received 24 November 2003 A simple accelerated third-order Runge-Kutta-type, fixed time step, integration scheme

More information

Ordinary Differential Equations (ODEs)

Ordinary Differential Equations (ODEs) Ordinary Differential Equations (ODEs) 1 Computer Simulations Why is computation becoming so important in physics? One reason is that most of our analytical tools such as differential calculus are best

More information

(t) ), ( ) where t is time, T is the reaction time, u n is the position of the nth car, and the "sensitivity coefficient" λ may depend on un 1(

(t) ), ( ) where t is time, T is the reaction time, u n is the position of the nth car, and the sensitivity coefficient λ may depend on un 1( Page 1 A Model of Traffic Flow Everyone has had the experience of sitting in a traffic jam, or of seeing cars bunch up on a road for no apparent good reason MATLAB and SIMULINK are good tools for studying

More information

III. The position-time graph shows the motion of a delivery truck on a long, straight street.

III. The position-time graph shows the motion of a delivery truck on a long, straight street. Physics I preap Name per MOTION GRAPHS For this assignment, you will need to use the Moving Man simulation from the phet website. As you work through these problems focus on making sense of the motion

More information

Solution: (a) Before opening the parachute, the differential equation is given by: dv dt. = v. v(0) = 0

Solution: (a) Before opening the parachute, the differential equation is given by: dv dt. = v. v(0) = 0 Math 2250 Lab 4 Name/Unid: 1. (25 points) A man bails out of an airplane at the altitute of 12,000 ft, falls freely for 20 s, then opens his parachute. Assuming linear air resistance ρv ft/s 2, taking

More information

5-6 The Remainder and Factor Theorems

5-6 The Remainder and Factor Theorems Use synthetic substitution to find f (4) and f ( 2) for each function. 1. f (x) = 2x 3 5x 2 x + 14 58; 20 2. f (x) = x 4 + 8x 3 + x 2 4x 10 758; 46 3. NATURE The approximate number of bald eagle nesting

More information

An Interruption in the Highway: New Approach to Modeling Car Traffic

An Interruption in the Highway: New Approach to Modeling Car Traffic An Interruption in the Highway: New Approach to Modeling Car Traffic Amin Rezaeezadeh * Physics Department Sharif University of Technology Tehran, Iran Received: February 17, 2010 Accepted: February 9,

More information

Observability in Traffic Modeling: Eulerian and Lagrangian Coordinates

Observability in Traffic Modeling: Eulerian and Lagrangian Coordinates UNLV Theses, Dissertations, Professional Papers, and Capstones 5-1-2014 Observability in Traffic Modeling: Eulerian and Lagrangian Coordinates Sergio Contreras University of Nevada, Las Vegas, contre47@unlv.nevada.edu

More information

Formative Assessment: Uniform Acceleration

Formative Assessment: Uniform Acceleration Formative Assessment: Uniform Acceleration Name 1) A truck on a straight road starts from rest and accelerates at 3.0 m/s 2 until it reaches a speed of 24 m/s. Then the truck travels for 20 s at constant

More information

Math Numerical Analysis Homework #4 Due End of term. y = 2y t 3y2 t 3, 1 t 2, y(1) = 1. n=(b-a)/h+1; % the number of steps we need to take

Math Numerical Analysis Homework #4 Due End of term. y = 2y t 3y2 t 3, 1 t 2, y(1) = 1. n=(b-a)/h+1; % the number of steps we need to take Math 32 - Numerical Analysis Homework #4 Due End of term Note: In the following y i is approximation of y(t i ) and f i is f(t i,y i ).. Consider the initial value problem, y = 2y t 3y2 t 3, t 2, y() =.

More information

4.9 APPROXIMATING DEFINITE INTEGRALS

4.9 APPROXIMATING DEFINITE INTEGRALS 4.9 Approximating Definite Integrals Contemporary Calculus 4.9 APPROXIMATING DEFINITE INTEGRALS The Fundamental Theorem of Calculus tells how to calculate the exact value of a definite integral IF the

More information

Ordinary Differential equations

Ordinary Differential equations Chapter 1 Ordinary Differential equations 1.1 Introduction to Ordinary Differential equation In mathematics, an ordinary differential equation (ODE) is an equation which contains functions of only one

More information

Chapter 9b: Numerical Methods for Calculus and Differential Equations. Initial-Value Problems Euler Method Time-Step Independence MATLAB ODE Solvers

Chapter 9b: Numerical Methods for Calculus and Differential Equations. Initial-Value Problems Euler Method Time-Step Independence MATLAB ODE Solvers Chapter 9b: Numerical Methods for Calculus and Differential Equations Initial-Value Problems Euler Method Time-Step Independence MATLAB ODE Solvers Acceleration Initial-Value Problems Consider a skydiver

More information

BC Exam 1 - Part I 28 questions No Calculator Allowed - Solutions C = 2. Which of the following must be true?

BC Exam 1 - Part I 28 questions No Calculator Allowed - Solutions C = 2. Which of the following must be true? BC Exam 1 - Part I 8 questions No Calculator Allowed - Solutions 6x 5 8x 3 1. Find lim x 0 9x 3 6x 5 A. 3 B. 8 9 C. 4 3 D. 8 3 E. nonexistent ( ) f ( 4) f x. Let f be a function such that lim x 4 x 4 I.

More information

Section 7.2 Euler s Method

Section 7.2 Euler s Method Section 7.2 Euler s Method Key terms Scalar first order IVP (one step method) Euler s Method Derivation Error analysis Computational procedure Difference equation Slope field or Direction field Error Euler's

More information

March 4, 2019 LECTURE 11: DIFFERENTIALS AND TAYLOR SERIES.

March 4, 2019 LECTURE 11: DIFFERENTIALS AND TAYLOR SERIES. March 4, 2019 LECTURE 11: DIFFERENTIALS AND TAYLOR SERIES 110211 HONORS MULTIVARIABLE CALCULUS PROFESSOR RICHARD BROWN Synopsis Herein, we give a brief interpretation of the differential of a function

More information

Numerical Methods for Initial Value Problems; Harmonic Oscillators

Numerical Methods for Initial Value Problems; Harmonic Oscillators Lab 1 Numerical Methods for Initial Value Problems; Harmonic Oscillators Lab Objective: Implement several basic numerical methods for initial value problems (IVPs), and use them to study harmonic oscillators.

More information

Mathematics 132 Calculus for Physical and Life Sciences 2 Exam 3 Review Sheet April 15, 2008

Mathematics 132 Calculus for Physical and Life Sciences 2 Exam 3 Review Sheet April 15, 2008 Mathematics 32 Calculus for Physical and Life Sciences 2 Eam 3 Review Sheet April 5, 2008 Sample Eam Questions - Solutions This list is much longer than the actual eam will be (to give you some idea of

More information

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Part 1 Chapter 4 Roundoff and Truncation Errors PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction

More information

DYNAMICAL MODEL AND NUMERICAL SIMULATION OF TRAFFIC CONGESTION

DYNAMICAL MODEL AND NUMERICAL SIMULATION OF TRAFFIC CONGESTION DYNAMICAL MODEL AND NUMERICAL SIMULATION OF TRAFFIC CONGESTION A Thesis Presented to the Faculty of California State Polytechnic University, Pomona In Partial Fulfillment Of the Requirements for the Degree

More information

5.2 - Euler s Method

5.2 - Euler s Method 5. - Euler s Method Consider solving the initial-value problem for ordinary differential equation: (*) y t f t, y, a t b, y a. Let y t be the unique solution of the initial-value problem. In the previous

More information

Numerical solution of ODEs

Numerical solution of ODEs Numerical solution of ODEs Arne Morten Kvarving Department of Mathematical Sciences Norwegian University of Science and Technology November 5 2007 Problem and solution strategy We want to find an approximation

More information

Problem Set Number 01, MIT (Winter-Spring 2018)

Problem Set Number 01, MIT (Winter-Spring 2018) Problem Set Number 01, 18.306 MIT (Winter-Spring 2018) Rodolfo R. Rosales (MIT, Math. Dept., room 2-337, Cambridge, MA 02139) February 28, 2018 Due Monday March 12, 2018. Turn it in (by 3PM) at the Math.

More information

Numerical Analysis Exam with Solutions

Numerical Analysis Exam with Solutions Numerical Analysis Exam with Solutions Richard T. Bumby Fall 000 June 13, 001 You are expected to have books, notes and calculators available, but computers of telephones are not to be used during the

More information

Introductory Numerical Analysis

Introductory Numerical Analysis Introductory Numerical Analysis Lecture Notes December 16, 017 Contents 1 Introduction to 1 11 Floating Point Numbers 1 1 Computational Errors 13 Algorithm 3 14 Calculus Review 3 Root Finding 5 1 Bisection

More information