Designing Efficient Software for Solving Delay Differential Equations. C.A.H. Paul. Numerical Analysis Report No. 368. Oct 2000



Similar documents
1 Error in Euler s Method

Numerical Solution of Delay Differential Equations

Homework 2 Solutions

1 The Brownian bridge construction

5 Numerical Differentiation

Nonlinear Algebraic Equations. Lectures INF2320 p. 1/88

1 Review of Least Squares Solutions to Overdetermined Systems

Model order reduction via Proper Orthogonal Decomposition

Recursive Algorithms. Recursion. Motivating Example Factorial Recall the factorial function. { 1 if n = 1 n! = n (n 1)! if n > 1

Euler s Method and Functions

1 Review of Newton Polynomials

INDIRECT INFERENCE (prepared for: The New Palgrave Dictionary of Economics, Second Edition)

Section 1.3 P 1 = 1 2. = P n = 1 P 3 = Continuing in this fashion, it should seem reasonable that, for any n = 1, 2, 3,..., =

Numerical Analysis An Introduction

12.5: CHI-SQUARE GOODNESS OF FIT TESTS

Numerical Methods for Option Pricing

S. Boyd EE102. Lecture 1 Signals. notation and meaning. common signals. size of a signal. qualitative properties of signals.

Volterra integral equations and fractional calculus: Do neighbouring solutions intersect?

Confidence Intervals for Cp

Introduction to the Finite Element Method

SENSITIVITY ANALYSIS AND INFERENCE. Lecture 12

Numerical Methods for Differential Equations

Math 21a Curl and Divergence Spring, Define the operator (pronounced del ) by. = i

Several Views of Support Vector Machines

Roots of Equations (Chapters 5 and 6)

7 Gaussian Elimination and LU Factorization

Real Roots of Univariate Polynomials with Real Coefficients

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

Section 3.7. Rolle s Theorem and the Mean Value Theorem. Difference Equations to Differential Equations

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

Modeling, Computers, and Error Analysis Mathematical Modeling and Engineering Problem-Solving

November 16, Interpolation, Extrapolation & Polynomial Approximation

Continued Fractions and the Euclidean Algorithm

Numerical Methods for Differential Equations

4 Lyapunov Stability Theory

A power series about x = a is the series of the form

Trend and Seasonal Components

Significant Figures, Propagation of Error, Graphs and Graphing

Exact Nonparametric Tests for Comparing Means - A Personal Summary

Maximizing volume given a surface area constraint

Special Situations in the Simplex Algorithm

Suggestions for simplified Fixed Capital Stock calculations at Statistics Sweden Michael Wolf, National Accounts Division Statistics Sweden

OUTLIER ANALYSIS. Data Mining 1

Graphical Integration Exercises Part Four: Reverse Graphical Integration

The normal approximation to the binomial

3. Reaction Diffusion Equations Consider the following ODE model for population growth

10.2 Series and Convergence

(Refer Slide Time: 01.26)

CS 3719 (Theory of Computation and Algorithms) Lecture 4

1 Cubic Hermite Spline Interpolation

01 In any business, or, indeed, in life in general, hindsight is a beautiful thing. If only we could look into a

Math 120 Final Exam Practice Problems, Form: A

Reading 13 : Finite State Automata and Regular Expressions

8 Divisibility and prime numbers

EXPONENTIAL FUNCTIONS

Numerical Matrix Analysis

Numerical Methods in MATLAB

abc GCE 2005 Mark Scheme January Series Mathematics MPC1

For additional information, see the Math Notes boxes in Lesson B.1.3 and B.2.3.

Fixed Point Theorems

Math 241, Exam 1 Information.

MATH10040 Chapter 2: Prime and relatively prime numbers

Predict the Popularity of YouTube Videos Using Early View Data

Confidence Intervals for Cpk

Dynamic Programming Problem Set Partial Solution CMPSC 465

The Steepest Descent Algorithm for Unconstrained Optimization and a Bisection Line-search Method

Linear Equations and Inequalities

3. Mathematical Induction

Non Parametric Inference

Sensitivity of Hospital Clinic queues to patient non-attendance. Neville J. Ford, Paul D. Crofts, and Richard H. T. Edwards

INTRUSION PREVENTION AND EXPERT SYSTEMS

Version 1.0. klm. General Certificate of Education June Mathematics. Pure Core 3. Mark Scheme

Exponential Functions and Laplace Transforms for Alpha Derivatives

Natural cubic splines

Overview of Violations of the Basic Assumptions in the Classical Normal Linear Regression Model

The Effects of Start Prices on the Performance of the Certainty Equivalent Pricing Policy

Sequential Data Structures

Linear and quadratic Taylor polynomials for functions of several variables.

Numerical Methods with Excel/VBA:

Numerical Analysis. Professor Donna Calhoun. Fall 2013 Math 465/565. Office : MG241A Office Hours : Wednesday 10:00-12:00 and 1:00-3:00

3 An Illustrative Example

DERIVATIVES AS MATRICES; CHAIN RULE

MATH 425, PRACTICE FINAL EXAM SOLUTIONS.

A Strategy for Teaching Finite Element Analysis to Undergraduate Students

Lecture 7: Finding Lyapunov Functions 1

Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy

Turing Machines, Part I

degrees of freedom and are able to adapt to the task they are supposed to do [Gupta].

POISSON AND LAPLACE EQUATIONS. Charles R. O Neill. School of Mechanical and Aerospace Engineering. Oklahoma State University. Stillwater, OK 74078

Pricing I: Linear Demand

NPV Versus IRR. W.L. Silber We know that if the cost of capital is 18 percent we reject the project because the NPV

DELAY DIFFERENTIAL EQUATIONS IN MODELING INSULIN THERAPIES FOR DIABETES

Module 3: Correlation and Covariance

Irrational Numbers. A. Rational Numbers 1. Before we discuss irrational numbers, it would probably be a good idea to define rational numbers.

Chapter 4. Polynomial and Rational Functions. 4.1 Polynomial Functions and Their Graphs

The Aggregate Production Function Revised: January 9, 2008

Version : klm. General Certificate of Education. Mathematics MPC1 Pure Core 1. Mark Scheme examination - June series

Transcription:

ISSN 1360-1725 UMIST Designing Efficient Software for Solving Delay Differential Equations C.A.H. Paul Numerical Analysis Report No. 368 Oct 2000 Manchester Centre for Computational Mathematics Numerical Analysis Reports DEPARTMENTS OF MATHEMATICS Reports available from: Department of Mathematics University of Manchester Manchester M13 9PL England And over the World-Wide Web from URLs http://www.ma.man.ac.uk/nareports ftp://ftp.ma.man.ac.uk/pub/narep

Designing Efficient Software for Solving Delay Differential Equations Christopher A.H. Paul Oct 1, 2000 Abstract In this paper the efficient implementation of numerical software for solving delay differential equations is addressed. Several strategies that have been developed over the past 25 years for improving the efficiency of delay differential equation solvers are described. Of particular interest is a new method of automatically constructing the network dependency graph used in tracking derivative discontinuities. Key words. Numerical software, delay differential equations. AMS subject classifications. 34K99, 65C20, 65D30 1 Introduction The past ten years have seen a substantial increase in both the research into and the use of delay differential equations (DDEs), such as y (t) =f(t, y(t),y(t τ(t))) where τ(t) 0. (1) The increased use of DDEs in mathematical modelling has been fuelled by the availability of efficient and robust software for solving such types of problem. In this paper some aspects of the design of efficient numerical software for solving DDEs are discussed. In particular, several methods of automatically obtaining useful information about a DDE are described and then used to improve the efficiency with which the DDE is solved. Funded by the U.K. Engineering & Physical Science Research Council, granr GR/L35218 1

The DDE (1) may be solved numerically by combining an interpolation method (for evaluating delayed solution values) with an ordinary differential equation (ODE) integration method (for solving the resulting ODE ). However there are certain features of DDEs, such as the propagation of derivative discontinuities [4, 6] and the possibility of vanishing delays [1], that make such an over-simplification unhelpful when writing efficient and robust software unless measures are taken to address them. 2 Evaluating delayed solution values In order to evaluate delayed solution values, it is necessary to construct a suitable continuous solution for each accepted step and store this solution for later use. Whilst there are several possible continuous extensions for Runge-Kutta methods (see [2, p.186]), the most flexible are those one-step natural continuous extensions [7] that are also Hermite interpolants: They can be used to provide defect error control [3], to evaluate delayed derivative values for NDDEs, and to construct smooth graphical output (where appropriate). 2.1 Storage of the past solution A key feature of any DDE solver is the ability to evaluate delayed solution values efficiently. This feature is related to, although not necessarily the same as, the ability to provide a dense output of the solution. Consider the DDE y (t) =y(t τ(t)). If the delay function τ(t) is bounded then the oldest solution information may eventually be safely overwritten. However if τ(t) is unbounded then it is necessary to keep as much of the past solution as possible. This is because once a delayed solution value that is not available is required, the DDE cannot be solved any further. Given that the storage available for the past solution is limited, this can best be achieved by using a cyclic storage structure once a cyclic storage structure is full, the oldest solution information is overwritten. This means that some DDEs may be solved over much larger ranges of integration than would otherwise be possible. 2

2.2 Dense output One of the requirements of any good DDE solver is the ability to produce a dense output (continuous extension) of the solution. Using a cyclic storage structure for storing the past solution means that it is possible that, even after successfully solving a DDE, not all of the solution is available for dense output. However if the dense output points are known before the DDE is solved, then they can be output as soon as the appropriate continuous solution becomes available. This means that graphical output can be provided and parameter fitting problems can be solved over much larger ranges of integration. 2.3Retrieving delayed solution values Efficient implementation of the routine that calculates delayed solution values is essential, otherwise the time taken to solve simple DDEs may be dominated by housekeeping. When a delayed solution value is required, it is necessary to locate the correct previously stored solution if a fixed stepsize is used then the location of the stored solution can be easily computed, otherwise it is necessary to search the solution history. For a DDE with more than one delay function, if only one pointer is used to search the solution history, considerable time can be spent searching backwards and forwards between calculating different delayed solution values [5, p.200]. For a DDE with more than three delay functions, such as y (t) =y(t 1) y 2 (t 7) + y(t 3) + y(t 5), (2) there is also the problem of the most efficient order for evaluating the delayed solution values a question that should not really have to concern the user. The best ordering of the delayed arguments for the above example is y (t) =y(t 1) + y(t 3) + y(t 5) y 2 (t 7), because then the delayed solution values are evaluated in strictly increasing order. The answer to both problems is simply to have separate pointers for each delay function; then the ordering of delayed arguments is irrelevant and the time spent searching for the solution information is minimised (see Table 1). 3

Four pointers One pointer Stepsize Worst ordering Best ordering Worst ordering Best ordering 0.001 0.89 secs 0.89 secs 89.79 secs 74.89 secs 0.0005 1.78 secs 1.78 secs 356.48 secs 297.35 secs 0.00025 3.50 secs 3.50 secs 1442.13 secs 1185.42 secs Table 1: Archi [5] timings for solving equation (2) over the range [0, 10] using a fixed stepsize. 3Derivative discontinuities In order to treat derivative discontinuities (from now on referred to as discontinuities) efficiently and effectively, it is necessary to know how they arise and how they are propagated. It is also useful to understand what impact discontinuities have on the numerical solution of DDEs. There are two ways of improving the efficiency of a DDE solver in the presence of discontinuities, defect control [3] and discontinuity tracking [6]. How discontinuities are treated determines how some parts of the user-interface should be specified. 3.1 Origin and propagation of derivative discontinuities Consider the scalar DDE y (t) =y(t τ(t)) (t t 0 ), y(t) =Ψ(t) (t<t 0 ), y(t 0 )=y 0. (3) Discontinuities can originate in the initial function Ψ(t), from the initial point t 0 when Ψ (k) (t 0 ) y (k) (t 0 +) for some integer k 0, and from discontinuities in the DDE itself and the delay functions. Suppose that t 0 =0,τ(t) =1and Ψ(t 0 )=y 0 but that Ψ (t 0 ) y (t 0 +), then there is a discontinuity in y (t) at t = 0. This discontinuity is propagated by the lag function α(t) =t τ(t) so that y (1 ) =Ψ (0 ) y (0+) = y (1+). Note that when a discontinuity is propagated in a DDE it is also smoothed, that is to say, it occurs in a higher derivative. For a general lag function α(t), a discontinuity in y (r) (t) typically propagates into y (r+1) (t). However if σ k is an odd-multiple zero of α(t) =σ i,whereσ i is some previous discontinuity, then σ k occurs in a much higher derivative [4, p.847]. 4

3.2 Impact of derivative discontinuities A fundamental assumption made when deriving integration methods is that the solution is sufficiently smooth (over each step). If the solution is not sufficiently smooth, a high-order integration method collapses to lower order and consequently the reliability of the local error estimator will be affected. When this happens, the extra computational cost involved in using a high-order method can be wasted because a cheaper, lower order method could have been used to achieve the same order with better error control. Thus when a DDE is not sufficiently smooth, unless appropriate measures are taken, the efficiency of a high-order integration method can be severely compromised. 3.3 Defect control of derivative discontinuities One way in which discontinuities can be detected and located is by using the defect δ(t) [3]; in the case of equation (1), δ(t) =f(t, y(t),y(t τ(t))) y (t). An advantage of defect control (over discontinuity tracking) is that no extra information about the DDE is required in order to locate discontinuities. However, in practice, an estimate of the maximum size of δ(t) on each step is used, and this estimate is based on asymptotic arguments that are no longer valid if a low-order discontinuity occurs in the step. Significant discontinuities 1 are detected by monitoring the sequence of rejected steps and their associated defects. Once detected, it is usually necessary to locate the position of the discontinuity more precisely. However, because defect control is concerned with the accuracy of the solution and not its order, it is not generally necessary to locate the discontinuity precisely. Having detected a discontinuity in the interval (t n,t n +h), a bisection method can be used to locate it to within a smaller interval (r, s) (t n,t n +h), where the defect over the interval (r, s) is acceptably small. (In general the exact location of a discontinuity cannot be found because there is no precise event function, and thus high-order event location methods cannot be used.) Each bisection it- 1 A significant discontinuity is any discontinuity that gives rise to such a large defect (estimate) that a step is rejected. Thus not all low-order discontinuities are significant and, in fact, the treatment of discontinuities relies on a discontinuity becoming less significant as the size of the step in which it occurs decreases. 5

eration requires a defect evaluation, so that repeated derivative evaluations may be required. However in systems of DDEs only one solution component can have the most significant discontinuity at any one point. Thus evaluating all the derivative components can be very inefficient. This problem may be overcome by specifying the derivatives so that they can be evaluated separately. (However this approach may severely affect the efficiency of the numerical integration. method) Consider the DDE y 1(t) =y 1 (t)y 2 (t 1), y 2(t) =y 2 (t 2 ) y 3 (y 1 (t)), y 3(t) =y 2 (t 3). (4) The corresponding fortran 90 code could be written as REAL FUNCTION DERIVATIVE(COMPONENT,T) USE DELAY_SOLVER INTEGER, INTENT(IN) :: COMPONENT REAL, INTENT(IN) :: T SELECT CASE (COMPONENT) CASE(1) DERIVATIVE = DELAY(1,T)*DELAY(2,T-1) CASE(2) DERIVATIVE = DELAY(2,T*T)-DELAY(3,DELAY(1,T)) CASE(3) DERIVATIVE = DELAY(2,T-3) END SELECT END FUNCTION DERIVATIVE where the module DELAY SOLVER contains a function DELAY(i,t) that evaluates the i-th solution component at the argument t. 3.4 Tracking derivative discontinuities Discontinuity tracking maintains the order of a numerical solution by including low-order discontinuities in the meshpoints. It is much more intimately connected with the structure of the DDE being solved than defect control. Software that tracks discontinuities àlawillé & Baker [6] requires the user to specify the lag functions and derivative functions separately, as well as specifying the initial discontinuities and the network dependency graph ( 3.4.3). 6

3.4.1 The derivative discontinuity tracking equations Reconsider equation (3) and assume that Ψ(t 0 ) y(t 0 +). The discontinuity in y(t) att = t 0 is propagated to the point t = σ 1 when the lag function crosses the position of the discontinuity, that is to say, (α(σ 1 +) t 0 ) (α(σ 1 ) t 0 ) < 0. (5) Condition (5) is almost equivalent to requiring α(σ 1 )=t 0,exceptthatthis does not exclude even-multiplicity zeros whereas only odd-multiplicity zeros satisfy the switching condition (5). However since multiple zeros are numerically ill-conditioned [4], in practice they are given no special treatment. The discontinuity at t = σ 1 may itself be propagated to a point t = σ 2, where α(σ 2 )=σ 1. It is also possible, depending on the lag function, that the discontinuity at t = t 0 is again propagated to a point t = σ 2,whereσ 2 >σ 1 can be arbitrarily large. Thus y(t) cannot be guaranteed to be ultimately smooth. Thus discontinuity tracking in a scalar DDE involves the evaluation of the lag functions and a record of the (initial) discontinuities and how they have been propagated. The need to evaluate the lag functions means that they must be specified separately from the DDE ( 3.4.3). 3.4.2 Tracking derivative discontinuities in systems of DDEs In a system of DDEs discontinuity tracking can be complicated by discontinuities being propagated between solution components. This fact gives rise to the concept of strong and weak coupling and network dependency graphs (NDGs) [6]. Strong coupling describes the propagation of discontinuities between different solution components by an ODE term, that is to say τ(t) 0. Weak coupling describes the propagation of discontinuities within the same solution component and between different solution components by a DDE term, that is to say τ(t) 0. Given a system of DDEs, the NDG is key to tracking the propagation of discontinuities. For the system of DDEs (4), the NDG is 7

y 1 t-1 t y 1 (t ) y 2 t 2 y 3 t-3 Thus tracking discontinuities requires the following extra information about the DDE to be specified: (i) the initial discontinuities and (ii) the network dependency graph. Whilst the initial discontinuities cannot be automatically determined, it is possible to construct the NDG automatically. 3.4.3 Constructing the network dependency graph Reconsider the DDE system (4). Unlike using defect control for treating discontinuities ( 3.3), the lag functions have to be specified separately from the derivative functions. Thus the DDE could be specified using fortran 90 as REAL FUNCTION DERIVATIVE(COMPONENT,T) USE DELAY_SOLVER INTEGER, INTENT(IN) :: COMPONENT REAL, INTENT(IN) :: T SELECT CASE (COMPONENT) CASE(1) DERIVATIVE = DELAY(1,1)*DELAY(2,2) CASE(2) DERIVATIVE = DELAY(2,3)-DELAY(3,4) CASE(3) DERIVATIVE = DELAY(2,5) END SELECT END FUNCTION DERIVATIVE where the function DELAY(i,j) evaluates the i-th solution component using the j-th lag function. The corresponding lag functions would then be given as REAL FUNCTION LAG(COMPONENT,T) USE DELAY_SOLVER INTEGER, INTENT(IN) :: COMPONENT 8

REAL, INTENT(IN) :: T SELECT CASE (COMPONENT) CASE(1) LAG = T CASE(2) LAG = T-1 CASE(3) LAG = T*T CASE(4) LAG = DELAY(1,1) CASE(5) LAG = T-3 END SELECT END FUNCTION LAG By evaluating each of the lag functions in turn and counting the number of calls to the DELAY function, it is possible to determine which lag functions are state-independent (do not depend on the solution) and which are statedependent (and on which solution components and other lag functions they depend). This information is necessary for constructing the NDG, as well as being useful when tracking discontinuities because there are additional difficulties associated with discontinuities propagated by state-dependent lag functions. Next, by evaluating each derivative component in turn and monitoring calls to the DELAY function, it is possible to determine the links in the NDG and which lag functions are associated with each link. For state-dependent lag functions there is also the question of the propagation of discontinuities in the lag functions, which gives rise to additional links in the NDG. This then completes the construction of the NDG. 3.4.4 Efficient tracking of derivative discontinuities The implementation of discontinuity tracking is even more complicated than already suggested. Having specified the initial discontinuities and constructed the NDG, it is necessary to calculate ( predict ) where discontinuities will be propagated to before attempting to solve the DDE over an interval in which a discontinuity occurs. This can be achieved efficiently by determining whether an interval contains a discontinuity just before attempting to solve over it. 9

Testing the switching condition (α(t n + h) σ i ) (α(t n ) σ i ) < 0 on each step [t n,t n + h] might appear to be sufficient for detecting if the discontinuity σ i is propagated into the interval [t n,t n + h]. However if the lag function α(t) propagates the discontinuity σ i into the interval an even number of times, then the propagated discontinuities will not be detected (see below). () t i t n t n + h t Once detected, the location of the discontinuity must be found more precisely by solving the equation α(t) =σ i. However the convergence test is usually of the form α(t) σ i <ν σ i ɛ, whereν > 1andɛ is the unit-roundoff. For some DDEs, for example, y (t) =y(t 2 )y(t 1 10 )witht 0 =0,thisgivesriseto numerous spurious discontinuities [5, p.86]. A strategy for reducing the impact of this problem is to require discontinuities in the same solution component and derivative to be at least a distance δ ɛ apart before they are considered to be distinct. Having located a discontinuity at the point t = σ k, it still remains to advance the solution up to t = σ k. For DDEs in which y(t) is discontinuous at the point t = t 0, it is particularly important to evaluate delayed solution values correctly [5, p.87]: If α(t) t 0 +ast σ k,theny(α(σ k )) should be evaluated as y(t 0 +) and not y(t 0 ). The correct evaluation of delayed solution values can be achieved by monitoring whether the current interval is [t n,σ k )or[σ k,t n+1 ] and by knowing whether α(t n ) <t 0 or α(t n ) >t 0. (For continuous solutions this problem does not arise because y(t 0 + ɛ) y(t 0 ɛ) = O(ɛ).) Discontinuity tracking maintains the order of the solution by including discontinuities in the meshpoints, whilst attempting to avoid unnecessarily small and inefficient stepsizes. However for discontinuities propagated by state-dependent lag functions, very small stepsizes may still arise because the discontinuities may 10

move slightly as the solution advances [5, p.150]. This problem has still to be adequately addressed by codes that track discontinuities. Tracking discontinuities can be computationally expensive, and it becomes more expensive as the number of discontinuities that need to be tracked increases [5, p.177]. However it is not necessary to track every discontinuity: The smoothing of discontinuities when they are propagated means that they eventually occur in a sufficiently high derivative that they can be ignored. Also, although it is necessary to track every low-order discontinuity (for a general lag function), if the user can specify a bound on the size of the delays then the oldest discontinuities can eventually be safely ignored. 4 Conclusion The analytical theory underlying the numerical solution of DDEs has advanced considerably over the past decade. However the number of available DDE solvers has remained somewhat limited and has thus delayed the widespread use of DDEs by non-mathematicians. Whilst there are a number of theoretical areas in the numerical solution of DDEs, convergence, stability, bifurcations, oscillations, etc., this paper has aimed at shedding light on some of the practical issues in writing an efficient and robust code for solving DDEs. Having identified some of the obvious and less obvious design problems, the next generation of DDE solvers should hopefully be more efficient and easier to use. References [1] C.T.H. Baker and C.A.H. Paul, Parallel continuous Runge-Kutta methods and vanishing lag delay differential equations, Adv. Comp. Math. 1 (1993) 367 394. [2] C.T.H. Baker, C.A.H. Paul and D.R. Willé, Issues in the numerical solution of evolutionary delay differential equations, Adv. Comp. Math. 3 (1995) 171 196. [3] W.H. Enright and H. Hayashi, A delay differential equation solver based on a continuous Runge-Kutta method with defect control, Numer. Algorithms 16 (1997) 349 364. 11

[4] M.A. Feldstein and K.W. Neves, High-order methods for state-dependent delay differential equations with non-smooth solutions, SIAM J. Numer. Anal. 21 (1984) 844 863. [5] C.A.H. Paul, Runge-Kutta methods for functional differential equations, Ph.D. Thesis, Department of Mathematics, University of Manchester, 1992. [6] D.R. Willé and C.T.H. Baker, The tracking of derivative discontinuities in systems of delay differential equations, Appl. Num. Math. 9 (1992) 209 222. [7] M. Zennaro, Natural continuous extensions of Runge-Kutta methods, Math. Comp. 46 (1986) 119 133. 12