Lecture notes for Numerical Analysis 4 Systems of ODEs Topics: 1 Problem statement 2 Two motivating examples 3 Connection between systems and higher order equations 4 Numerical solutions 5 Phase plane analysis 6 Notes and further reading 41 Problem statement A first order system of ordinary di erential equations is a set of equations of the form x 0 1(t) =f 1 (t, x 1 (t),,x n (t)) x 0 2(t) =f 2 (t, x 1 (t),,x n (t)) (24) x 0 n(t) =f n (t, x 1 (t),,x n (t)), for some set of functions f i, i =1 n Note that each f i depends on all the variables x 1,,x n, and thus that solving the system thus corresponds to finding trajectories x i (t) such that all n equations are simultaneously true In general, the solution to the system (24) is not unique, as arbitrary constants are lost in the di erentiation process However, if initial values are given for each of the x i, x 1 (t 0 )=x 10 x 2 (t 0 )=x 20 x n (0) = x n0, (25) then the subsequent trajectories of each of the x i are generally uniquely determined Solving the system (24) with a particular set of initial values (25) is referred to as solving an initial value problem 42 Two motivating examples Applied science is rife with systems of ordinary di erential equations Here were present two simple examples designed to illustrate how such systmes might materialize in practice Example 41 Consider an ecosystem in which at time t the number of sheep is given by s(t) and the number of wolves by w(t) Left to its own devices, the sheep population will grow, but it is subject to predation by wolves Assuming sheep growth is exponential, and that predation is proportional to both the number of sheep and the number of wolves, we are led to the equation s 0 (t) = s(t) s(t)w(t) (26) On the other hand, it is reasonable to assume that the rate at which the wolf population grows will be proportional to level of predation, while the rate at which wolves die o is proportional to the total number of wolves Together, these assumptions lead to the following wolf growth model: w 0 (t) = s(t)w(t) w(t) (27) 21
43 Connection between systems and higher order equations Lecture notes for Numerical Analysis Taken together, equations (26) and (27) represent a first order system of the form s 0 (t) =f(t, s(t),w(t)) w 0 (t) =g(t, s(t),w(t)) where f(t,s(t),w(t)) = s(t) s(t)w(t) and g(t,s(t),w(t)) = s(t)w(t) w(t) If the number of sheep and wolves at time t 0 specified as s 0 and w 0, respectively, this system becomes an initial value problem with initial conditions s 0 and w 0 Example 42 Let x(t) denote the vertical position of a mass thrown straight up Let v(t) denote the vertical velocity of this mass Since velocity is defined as the rate of change of position, and the rate of change is given by the derivative, we have x 0 (t) =v(t) (28) On the other hand, Newton s Law states that the force on an object is equal to its mass times its acceleration, F (t) =m a(t) Since the gravitational force on an object is equal to the object s mass times the gravitational constant of 98m/s 2, and the acceleration of an object is the derivative of velocity, we have Together, (28) and (29) represent a first order system of the form v 0 (t) = 98 (29) x 0 (t) =f(t, x(t),v(t)) v 0 (t) =g(t, x(t),v(t)), where f(t,x(t),v(t)) = v(t) and g(t,s(t),w(t)) = 98 If the position and velocity at some particular time t 0 are specified as x 0 and v 0, respectively, this system becomes an initial value problem with initial values x 0 and v 0 43 Connection between systems and higher order equations A higher order di erential equation in variable is an equation of the form f(t, x(t),x 0 (t),,x (n) (t)) = 0 (30) for some function f : R n+1! R Note that the left hand side is a rather compact way of writing any combination of x(t) and its higher order derivatives up to x (n) Since t shows up as an argument, functions of t can be coe cients or free standing terms in this expression Higher order di erential equations show up often in applied science Example 43 Above, we saw an example that used Newton s Law Note that since acceleration is the second derivative of position, Newton s Law can be restated as mx 00 = F, ie x 00 (t) = F (t) m, where x(t) is position and F (t) is the force at time t This is an equation of the form where f(t, x, x 0,x 00 )=x 00 (t) F (t) m f(t, x, x 0,x 00 )=0, In Example 42, we saw how a one-dimension example involving Newton s Law could be written as a first order system with two equations In Example (43), we saw how the same equation could be written as a single second order equation As the following theorem shows, this feature of being able to swap out higher derivatives for more first order equations is not an accident, but rather a very general property Indeed, this property is one of the reasons that the study of first order systems is so important 22
44 Numerical solutions Lecture notes for Numerical Analysis Theorem 41 Suppose that for some nth order di erential equation, the function f in (30) has the form f(t, x, x 0,,x (n) )=x (n) (t)+g(t, x(t),x 0 (t),,x (n 1) (t)) (31) for some function g Then this nth order equation can be expressed in the form (24), ie as a first order system of n equations in n unknowns Proof Given any equation of the form define the following variables: f(t, x, x 0,,x (n) )=0, y 1 (t) =x(t) y 2 (t) =x 0 (t) y 3 (t) =x 00 (t) y n (t) =x (n 1) (t) Then note that with this notation we have the following di erential equations: y1(t) 0 =y 2 (t) y2(t) 0 =y 3 (t) (32) yn 0 1(t) =y n (t) f(t, y 1 (t),y 2 (t), y n (t),yn(t)) 0 = 0 By (31), the last of these equations can be written as yn(t) 0 = g(t, y(t),y 0 (t),,y (n 1) (t)), which, together with the first n unknowns 1 equations in (32), represents a first order system of n equations in n It is worth noting that even when f does not have the form (31), the equation f(t, y 1 (t),y 2 (t), y n (t),y 0 n(t)) generally defines y 0 n(t) implicitly In other words, it is generally true that any nth order ODE can be written as a system of n first order ODEs in n variables 44 Numerical solutions Numerical solutions for systems are not substantively di erent than numerical solutions for single variable problems As with the single variable case, we distinguish between explicit and implicit schemes, and as with the single variable case, these schemes come in various flavors To develop concrete numerical algorithms for systems, the easiest approach is to write the system in vector notation, and proceed to develop finite di erence approximations exactly as in the single variable case To this end, define 2 3 and write the system (24) as X(t) = 6 4 x 1 (t) x n (t) 7 5 d X(t) =F (t, X(t)), (33) dt 23
45 Phase plane analysis Lecture notes for Numerical Analysis where F : R n+1! R n is the vector valued function whose components are just the functions f i, 2 3 2 3 f 1 (t, X(t)) f 1 (t, x 1 (t),,x n (t)) 6 7 6 7 F (t, X(t)) = 4 5 = 4 5 f n (t, X(t)) f n (t, x 1 (t),,x n (t)) To develop numerical schemes, we fix a time interval [t 0,t 1 ], let t 0,t 1,,t n denote uniformly spaced samples within that interval, and let X i denote X(t i ), i =0,,n To develop an explicit scheme, we let h denote the time step t i t i 1, and approximate (33) with a finite di erence of the form X i+1 h X i = F (t i,x i ) (explicit scheme) (34) To develop an implicit scheme, we replace the right hand side of (34) with F (t i+1,x i+1 ), ie X i+1 h X i = F (t i+1,x i+1 ) (implicit scheme) (35) Note that both (34) and (35) employ = signs, not signs: both are approximations of (33), but the equality is needed because each defines a numerical scheme, ie the succession of points X i Note that just as in the single variable case, the explicit scheme is easy to implement Indeed, once X i is known, X i+1 is given by X i+1 = X i + h F (t i,x i ) (explicit update step) Implicit schemes are harder to implement, since to find X i+1 we need to solve an equation of the form X i+1 h F (t i+1,x i+1 ) X i = 0 (implicit update step) To solve this, we need to know how to find roots of non-linear algebraic systems This is the topic of the next unit 45 Phase plane analysis Consider the simple sheep-wolf system described in Example 41 If we set = = = = 1 and suppose that the initial sheep and wolf populations are s 0 =19 and w 0 = 1, respectively, then we have a well defined initial value problem that we can solve using whatever numerical method we wish Below are some plots that illustrate the solutions: Figure 1: This figure illustrates how the populations of sheep and wolves evolve over time The first figure plots the respective sheep and wolve populations over time Note that these plots reveal a cyclic pattern: populations rise and fall, and there is no natural steady state 24
46 Notes and further reading Lecture notes for Numerical Analysis Figure 2: This figure is a phase-space diagram It shows which sheep-wolf pairs are possible The second figure is called a phase plane portrait Each point on that graph represents the population of both sheep and wolves at a particular time The phase plane portrait is a (deformed) circle, again indicating cyclicity Note that when the wolf population is maximal, the sheep population is small, and when the sheep population is maximal, the wolf population is small These findings jump out from a phase plane portrait in ways that they might not with a standard time-series plot For this reason, phase plane portraits form a basic tool in the numerical analysis of di erential systems 46 Notes and further reading Most of this material closely followed our class text The text provides a detailed analysis of a simplified sheep-wolf system In these notes I have suppressed that analysis, as it is rather specific to one rather unrealistic system, and I wanted to focus on big ideas However, the interested student should consult the text to get ideas for how such analysis might proceed In general, the mathematical analysis of di erential systems is rather ad hoc: we try to say something meaningful about the system, and the tricks we need to employ to do so will vary according to the system The fact that an nth order ODE can be expressed a first order system of n equations in n unknowns is discussed in Boyce and Deprima This reduction is one of the main reasons that the study of di erential systems is so important A variety of software exists to perform phase plan analysis One open source tool that you might consult is called pplane it has a couple of canned algorithms for calculating phase planes, and allows you to experiment easily with changing parameter values Sources: 1 Our textbook 2 PPLANE 200510 Copyright 1994-2005, John C Polking, Rice University http://mathriceedu/ ~dfield/dfpphtml 3 Boyce and DePrima, Elementary Di erential Equations, Wiley and Sons 25