S#ff ODEs and Systems of ODEs

Similar documents
Syntax. Arguments. Solve m oderately stifo DEsand DAEs;trapezoidalrule. 1 of :34

Differential Equations (Mathematics) Evaluate the numerical solution using output of ODE solvers.

Scientific Computing: An Introductory Survey

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 9

CS 450 Numerical Analysis. Chapter 9: Initial Value Problems for Ordinary Differential Equations

Lesson 14: Van der Pol Circuit and ode23s

Remark on the Sensitivity of Simulated Solutions of the Nonlinear Dynamical System to the Used Numerical Method

Ordinary differential equations - Initial value problems

Optimal Robust Controller Design for Heartbeat System

Solving Ordinary Differential equations

Bindel, Fall 2011 Intro to Scientific Computing (CS 3220) Week 12: Monday, Apr 18. HW 7 is posted, and will be due in class on 4/25.

CS520: numerical ODEs (Ch.2)

NUMERICAL SOLUTION OF ODE IVPs. Overview

Initial value problems for ordinary differential equations

(5.5) Multistep Methods

Solving ODEs and PDEs in MATLAB. Sören Boettcher

Numerical Methods for the Solution of Differential Equations

CHAPTER 5: Linear Multistep Methods

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

Graded Project #1. Part 1. Explicit Runge Kutta methods. Goals Differential Equations FMN130 Gustaf Söderlind and Carmen Arévalo

Modeling & Simulation 2018 Lecture 12. Simulations

Review for Exam 2 Ben Wang and Mark Styczynski

MA3232 Summary 5. d y1 dy1. MATLAB has a number of built-in functions for solving stiff systems of ODEs. There are ode15s, ode23s, ode23t, ode23tb.

Module 6 : Solving Ordinary Differential Equations - Initial Value Problems (ODE-IVPs) Section 1 : Introduction

Math 660 Lecture 4: FDM for evolutionary equations: ODE solvers

MATH 350: Introduction to Computational Mathematics

Lesson 13: Rapid Cooling and Euler-trapezoid

Lesson 13: Rapid Cooling and Euler-trapezoid

Ordinary Differential Equations

Chapter 6 - Ordinary Differential Equations

8.1 Introduction. Consider the initial value problem (IVP):

The Chemical Kinetics Time Step a detailed lecture. Andrew Conley ACOM Division

Chapter 5 Exercises. (a) Determine the best possible Lipschitz constant for this function over 2 u <. u (t) = log(u(t)), u(0) = 2.

2803/01 Transport January 2005 Mark Scheme

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

4.4 Computing π, ln 2 and e

Jim Lambers MAT 772 Fall Semester Lecture 21 Notes

[ ] is a vector of size p.

sing matlab Farida Mosally Mathematics Department King Abdulaziz University

B4 Organising animals and plants. Student Book answers. B4.1 The blood. Question Answer Marks Guidance

Solution of Stiff Differential Equations & Dynamical Systems Using Neural Network Methods

Lecture 8: Calculus and Differential Equations

Lecture 8: Calculus and Differential Equations

Numerical Algorithms for ODEs/DAEs (Transient Analysis)

Systems Models of the Circula4on BENG 230C Lecture 2

Numerical Integration of Equations of Motion

2 Ordinary Differential Equations: Initial Value Problems

ODE solvers in Julia. Gabriel Ingesson. October 2, 2015

Rezolvarea ecuaţiilor şi sistemelor de ecuaţii diferenţiale ordinare (II)

Index. higher order methods, 52 nonlinear, 36 with variable coefficients, 34 Burgers equation, 234 BVP, see boundary value problems

Numerical solution of ODEs

Solving PDEs with PGI CUDA Fortran Part 4: Initial value problems for ordinary differential equations

Ordinary Differential Equations

MATH2071: LAB 3: Implicit ODE methods

Solving Models With Off-The-Shelf Software. Example Of Potential Pitfalls Associated With The Use And Abuse Of Default Parameter Settings

Lecture 4: Numerical solution of ordinary differential equations

Numerical Methods for Differential Equations

The Plan. Initial value problems (ivps) for ordinary differential equations (odes) Review of basic methods You are here: Hamiltonian systems

MATH 100 Introduction to the Profession

M A : Ordinary Differential Equations

THE MATLAB ODE SUITE

Bellman s Curse of Dimensionality

Chapter 10. Initial value Ordinary Differential Equations

The Initial Value Problem for Ordinary Differential Equations

The Milne error estimator for stiff problems

16.7 Multistep, Multivalue, and Predictor-Corrector Methods

Review Higher Order methods Multistep methods Summary HIGHER ORDER METHODS. P.V. Johnson. School of Mathematics. Semester

Applied Numerical Analysis

Module 4: Numerical Methods for ODE. Michael Bader. Winter 2007/2008

Parallel Methods for ODEs

Richarson Extrapolation for Runge-Kutta Methods

LABORATORY 10 Forced Equations and Resonance

Linear Multistep Methods I: Adams and BDF Methods

Numerical Differential Equations: IVP

Numerical Methods I Solving Nonlinear Equations

MTH 452/552 Homework 3

AMS 27L LAB #8 Winter 2009

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

CHAPTER 10: Numerical Methods for DAEs

A definition of stiffness for initial value problems for ODEs SciCADE 2011, University of Toronto, hosted by the Fields Institute, Toronto, Canada

ODEs. PHY 688: Numerical Methods for (Astro)Physics

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

Linearized Equations of Motion!

Ordinary Differential Equations

ODEs. PHY 688: Numerical Methods for (Astro)Physics

x n+1 = x n f(x n) f (x n ), n 0.

10.34: Numerical Methods Applied to Chemical Engineering. Lecture 19: Differential Algebraic Equations

Differential Equations FMNN10 Graded Project #1 c G Söderlind 2017

Multistep Methods for IVPs. t 0 < t < T

Chapter 5. Formulation of FEM for Unsteady Problems

Woods Hole Methods of Computational Neuroscience. Differential Equations and Linear Algebra. Lecture Notes

Mathematics for chemical engineers. Numerical solution of ordinary differential equations

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

Ordinary differential equation II

Forced Mechanical Vibrations

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

Products & Services Solutions Academia Support User Commu

Chapter #4 EEE8086-EEE8115. Robust and Adaptive Control Systems

B 2 P 2, which implies that g B should be

M-RICh v0.5 MATLAB Rate Integrator for Chemical equations

Transcription:

S#ff ODEs and Systems of ODEs

Popula#on Growth Modeling Let the number of individuals in a given area at time t be. At time the number is so that is the number of individuals that have arrived in the area during the time interval Suppose that the change is entirely due to individuals being born. We hypothesize that: the more individuals there are at time t, the more births are likely to occur, in a short time interval we would expect about twice as many births as in a time interval of half its length Thus we expect that the number of births will be proportional to when is small.

Popula#on Growth Modeling We define the reproductive rate of the population per unit time by the constant K, where K is positive, so that the actual number of births in the time interval is Hence or (11.1) Letting, equation (11.1) can be approximated by the following ODE: (11.2)

Popula#on Growth Modeling Aside from constant, the quantity K may involve both N and t because the production of births may depend on various factors, such as changing environment. When K is constant, the solution of (11.2) is where is the size of the population at time (11.3) Populations that obey equations such as (11.3) are said to be undergoing exponential growth, dramatically increase over time. In any real situation, there will be a limit to the growth because of lack of food, shortage of essential supplies, selfpollution of the environment, etc.

Popula#on Growth Modeling It is possible to allow for more facets of the population problem. For instance, members may die and we may postulate that the number of deaths in the short time interval is Then leading to (11.4) when Individuals may enter the given area from outside; say immigrants in the time and some may depart from the area giving rise to emigrants.

Popula#on Growth Modeling Then or Suppose the parameters K, D, I, and E are given as the following: (11.5)

S#ffness of ODEs Then the equation (11.5) becomes (11.6) If the initial condition is using the integrating factor method where the equation (11.6) is rearranged into and of (11.6) is as the integrating factor, the analytical solution (11.7)

(11.10) S#ffness of ODEs Insight into the step size required for stability of such a solution can be gained by examining the homogeneous part of equation (11.6), (11.8) If, the solution is given by (11.9) Using Euler s forward method to approximate the solution numerically gives

S#ffness of ODEs The stability of the formula (11.10) clearly depends on the step size h, that is The absolute inequality is solved as Taking thus If

S#ffness of ODEs

S#ffness of ODEs As shown in the figure, the solution is initially dominated by the fast exponential term After a short period the transient dies out and the solution is dictated by the slow exponential Such ODE given in equation (11.6) is called stiff because it involves rapidly changing components (fast exponential terms) with slowly changing components (slow exponential terms). Despite above, the phenomenon of stiffness is not precisely defined in literature. Some attempts at describing a stiff problems are:

S#ffness of ODEs A problem is stiff if it contains widely varying time scales, some components of the solution decay much more rapidly than others. A problem is stiff if the step size is dictated by stability requirements rather than by accuracy requirements. A problem is stiff if explicit methods don t work, or work only extremely slowly. A linear problem is stiff if all of its eigenvalues have negative real part, and the stiffness ratio (the ratio of the magnitudes of the real parts of the largest and smallest eigenvalues) is large. More generally, a problem is stiff if the eigenvalues of the Jacobian differ greatly in magnitude.

Heart Beat Modeling

Heart Beat Modeling The heart is a complicated but robust pump. It consists of four chambers and four valves. There are essentially two circuits for the blood, one which spread through the lungs to pick up oxygen and the other which spreads through the body to deliver the oxygenated blood. The first circuit (vein to lungs + right auricle + right ventricle + vein from body) is a low-pressure circuit so as not to damage the delicate membrane in the lungs, whereas the second (vein to body + left auricle + left ventricle + vein from lungs) is a high-pressure circuit in order for the blood to get down to the feet and up again.

Heart Beat Modeling Each pump has a main pumping chamber called the ventricle with an inlet and an outlet valve. The purpose of the inlet valve is to prevent flow back up the veins while pumping, and the outlet valve is to prevent flow back from the arteries while filling. Since the heart is made of non-rigid material, it only has the power to push out and no power to suck in. Thus, to get a good pump it is necessary to fill the ventricle completely, and to aid this there is a small chamber called the auricle/ atrium whose job is to pump gently beforehand, just enough to fill the ventricle but not enough to cause any flow back.

Heart Beat Modeling During the heart beat cycle, there are two extreme equilibrium states: Diastole à the relaxed state Systole à the contracted state What makes the heart beat is the presence of a pacemaker which is located on the top of the atrium. The pacemaker causes the heart to contract into systole. That is, it triggers off an electrochemical wave which spreads slowly over the atria causing the muscle fibers to contract and push blood into the ventricles.

Heart Beat Modeling The electrochemical wave then spreads rapidly over the ventricles causing the whole ventricle to contract into systole and deliver a big pump of blood down the arteries. The muscle fibers then rapidly relax and return the heart to diastole; the process is then repeated. In order to develop a mathematical model which reflects the behavior of the heart beat action described above, we choose to single out the following features: The model should exhibit an equilibrium state, corresponding to diastole.

Heart Beat Modeling There must be a threshold for triggering the electrochemical wave emanating from the pacemaker causing the heart to contract into systole. The model must reflect the rapid return to the equilibrium state. Suppose we let: F denote muscle fiber length referred to some convenient origin, say F = 0, which corresponds to the equilibrium state. E be an electrical control variable which governs the electrochemical wave.

Heart Beat Modeling As far as the muscle fibers are concerned, we are to look for a differential equation which has F = 0 as an equilibrium state and at least for small times has a rapidly decreasing solution. An appropriate equation is (11.11) where ℇ is a small positive parameter. When the velocity of the fiber is zero, that is we have the equilibrium state F = 0.

Heart Beat Modeling Equation (11.11) has the general solution: (11.12) which is rapidly decreasing in time. This represents the behavior initially of the muscle fibers causing contraction into systole. For the electrochemical wave, we need to control E to represent initially the relatively slow spread of this wave over the atria. A simple model which does this is: (11.13)

Heart Beat Modeling Here E = 0 is an equilibrium state, and (11.13) has the general solution (11.14) which, in comparison with (11.12), represents a relatively slow decay in time. Thus, we obtain a system of ODEs consisting of simple equations (11.11) and (11.13) to model heart beats. To make the model more realistic, thhe features we need to add to this simple model are: The threshold or trigger The rapid return to equilibrium

Heart Beat Modeling The model which incorporates the desired features is the coupled nonlinear 1 st order ODE system: (11.15) where: F = the length of the muscle fiber a = tension E = the chemical control F a = a typical fiber length when the heart is in diastole

S#ff ODE Systems Since the parameter ℇ is very small, the first ODE of the system (11.15) reacts/decays much faster than the second one. We can observe this by multiplying the first ODE with ℇ, then: Hence, this gives us a system of stiff ODEs.

Van der Pol Equa#on Another example of system of ODE can be written from the (2 nd order) van der Pol equation: (11.16) where µ is a scalar parameter. By making the substitution the resulting system of 1 st order ODE is (11.17) The stiffness of the van der Pol equation is determined by the scalar parameter μ.

MATLAB Implementa#ons (a) Choosing μ = 1 (non-stiff), we code the system of the 1 st order ODE: function dydt = vdp1(t,y) dydt = [y(2); (1-y(1)^2)*y(2)-y(1)]; end (b) Apply a MATLAB solver to the problem. For the van der Pol system, you can use ode45 on time interval [0 20] with initial values y(1) = 2 and y(2) = 0: [t,y] = ode45(@vdp1,[0 20],[2; 0]);

MATLAB Implementa#ons (c) View the solver ouput: plot(t,y(:,1),'-',t,y(:,2),'--') title('solution of van der Pol Equation, \mu = 1'); xlabel('time t'); ylabel('solution y'); legend('y_1','y_2')

MATLAB Implementa#ons For stiff van der Pol equation, we set μ = 1000 and choose ode15s solver: function dydt = vdp1000(t,y) dydt = [y(2); 1000*(1-y(1)^2)*y(2)-y(1)]; end [t,y] = ode15s(@vdp1000,[0 3000],[2; 0]); plot(t,y(:,1),'-',t,y(:,2),'--') title('solution of van der Pol Equation, \mu = 1000'); xlabel('time t'); ylabel('solution y'); legend('y_1','y_2')

MATLAB Implementa#ons Plot of stiff van der Pol equation:

MATLAB ODE Solvers Solver Problem Type Order of Accuracy When to Use ode45 Nons*ff Medium Most of the *me. This should be the first solver you try. ode23 Nons*ff Low For problems with crude error tolerances or for solving moderately s*ff problems. ode113 Nons*ff Low to high For problems with strict error tolerances or for solving computa*onally intensive problems. ode15s S*ff Low to medium If ode45 is slow because the problem is s*ff. ode23s S*ff Low If using crude error tolerances to solve s*ff systems and the mass matrix is constant. ode23t Moderately s*ff Low For moderately s*ff problems if you need a solu*on without numerical damping. ode23tb S*ff Low If using crude error tolerances to solve s*ff systems.

MATLAB ODE Solvers Solver ode45 ode23 ode113 ode15s ode23s ode23t ode23tb Algorithm is based on an explicit Runge- KuKa (4,5) formula, the Dormand- Prince pair. It is a one- step solver in compu*ng y(t n ), it needs only the solu*on at the immediately preceding *me point, y(t n- 1 ). In general, ode45 is the best func*on to apply as a first try for most problems. is an implementa*on of an explicit Runge- KuKa (2,3) pair of Bogacki and Shampine. It may be more efficient than ode45 at crude tolerances and in the presence of moderate s*ffness. Like ode45, ode23 is a one- step solver. is a variable order Adams- Bashforth- Moulton PECE solver. It may be more efficient than ode45 at stringent tolerances and when the ODE file func*on is par*cularly expensive to evaluate. ode113 is a mul0step solver it normally needs the solu*ons at several preceding *me points to compute the current solu*on. is a variable order solver based on the numerical differen*a*on formulas (NDFs). Op*onally, it uses the backward differen*a*on formulas (BDFs, also known as Gear's method) that are usually less efficient. Like ode113, ode15s is a mul*step solver. Try ode15s when ode45 fails, or is very inefficient, and you suspect that the problem is s*ff, or when solving a differen*al- algebraic problem. is based on a modified Rosenbrock formula of order 2. Because it is a one- step solver, it may be more efficient than ode15s at crude tolerances. It can solve some kinds of s*ff problems for which ode15s is not effec*ve. is an implementa*on of the trapezoidal rule using a "free" interpolant. Use this solver if the problem is only moderately s*ff and you need a solu*on without numerical damping. ode23t can solve DAEs. is an implementa*on of TR- BDF2, an implicit Runge- KuKa formula with a first stage that is a trapezoidal rule step and a second stage that is a backward differen*a*on formula of order two. By construc*on, the same itera*on matrix is used in evalua*ng both stages. Like ode23s, this solver may be more efficient than ode15s at crude tolerances.

Eigenvalues of Linear Systems of ODEs Linear Systems of ODEs are given by (11.18) Differentiating both sides of the first ODE in (11.18) with respect to time gives: Substitute the second ODE:

Eigenvalues of Linear Systems of ODEs Further working on the equation: (11.19) Using the definitions of matrix trace and determinant: (11.20)

Eigenvalues of Linear Systems of ODEs We write the system (11.18) in matrix notation: where To solve (11.20), we try the exponential function

Eigenvalues of Linear Systems of From : ODEs Substituting these into (11.20) we get: Therefore, is a solution to (11.20) if (11.21) Thus, the eigenvalues of the linear systems of ODEs: (11.22)

Eigenvalues of Nonlinear Systems of ODEs We consider a nonlinear system of ODEs (11.23) First, we require that system (11.23) has a unique steady state solution that occurs by setting from which we get a steady state point

Eigenvalues of Nonlinear Systems of ODEs Second, we determine the stability of the steady state (or equilibrium state) by adding small perturbations, hence the solutions of the system (11.23) should satisfy (11.24) The common form of perturbations is an exponential growth with respect to time perturbation, that is where A 0 and B 0 are constants. (11.25)

Eigenvalues of Nonlinear Systems of ODEs Next, we linearise the system (11.23) by approximating the perturbations around the steady state point Using Taylor s theorem for functions with 2 variables, the approximations are: If the steady state and consequently

Eigenvalues of Nonlinear Systems of ODEs So, the linear approximation to system (11.23) is where a Jacobian matrix J is defined: (11.26)

Eigenvalues of Nonlinear Systems of ODEs Using (11.25), system (11.26) becomes By solving (11.27), we obtain the eigenvalues which are determined from (11.27)

Eigenvalues of Nonlinear Systems of ODEs Example: Consider a system of ODEs (11.28) We first find the steady state points, by which imply This leads to, which is the only stead state point.

Eigenvalues of Nonlinear Systems of ODEs Next, we find the linearization. Here and by the steady state point, Thus, the Jacobian matrix

Eigenvalues of Nonlinear Systems of ODEs Applying the perturbations given in (11.25) to the system (11.28) by using (11.26): or, From which, the eigenvalues