DELAY DIFFERENTIAL EQUATIONS IN MODELING INSULIN THERAPIES FOR DIABETES



Similar documents
Numerical Solution of Delay Differential Equations

Department Of Biochemistry. Subject: Diabetes Mellitus. Supervisor: Dr.Hazim Allawi & Dr.Omar Akram Prepared by : Shahad Ismael. 2 nd stage.

Diabetes mellitus. Lecture Outline

Causes, incidence, and risk factors

AN INTELLIGENT SUPPORT SYSTEM FOR DIABETIC PATIENTS

PowerPoint Lecture Outlines prepared by Dr. Lana Zinger, QCC CUNY. 12a. FOCUS ON Your Risk for Diabetes. Copyright 2011 Pearson Education, Inc.

Class time required: Two 40-minute class periods + homework. Part 1 may be done as pre-lab homework

INJEX Self Study Program Part 1

Glucose-Insulin System based on Minimal Model: a Realistic Approach

Introduction. We hope this guide will aide you and your staff in creating a safe and supportive environment for your students challenged by diabetes.

Am I at Risk for type 2 Diabetes? Taking Steps to Lower the Risk of Getting Diabetes NATIONAL DIABETES INFORMATION CLEARINGHOUSE

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

The Background for the Diabetes Detection Model

HOW TO CARE FOR A PATIENT WITH DIABETES

Diabetes and Heart Disease

Type 1 Diabetes. Pennington Nutrition Series. Overview. About Insulin

What is diabetes? Diabetes is a condition which occurs as a result of problems with the production and supply of insulin in the body.

Nutrition. Type 2 Diabetes: A Growing Challenge in the Healthcare Setting NAME OF STUDENT

Chapter 2: Binomial Methods and the Black-Scholes Formula

Insulin dosage based on risk index of Postprandial Hypo- and Hyperglycemia in Type 1 Diabetes Mellitus with uncertain parameters and food intake

Insulin is a hormone produced by the pancreas to control blood sugar. Diabetes can be caused by too little insulin, resistance to insulin, or both.

Blood glucose levels have important health effects, which is why it is important for people with diabetes to control their blood glucose.

Diabetes Fundamentals

Minimal Models for Glucose and Insulin Kinetics

Overview of Diabetes Management. By Cindy Daversa, M.S.,R.D.,C.D.E. UCI Health

Control of Blood Sugar Levels

Solving ODEs in Matlab. BP205 M.Tremont

Types of insulin and How to Use Them

Diabetes mellitus is a chronic condition that occurs as a result of problems with the production and/or action of insulin in the body.

Automatic Blood Glucose Control in Diabetes

glucose and fatty acids to raise your blood sugar levels.

CLOSED LOOP MODEL FOR GLUCOSE INSULIN REGULATION SYSTEM USING LABVIEW

Numerical methods for American options

Diabetes Mellitus: Type 1

DIABETES MELLITUS. By Tracey Steenkamp Biokineticist at the Institute for Sport Research, University of Pretoria

19.6. Finding a Particular Integral. Introduction. Prerequisites. Learning Outcomes. Learning Style

A Fuzzy Controller for Blood Glucose-Insulin System

X-Plain Hypoglycemia Reference Summary

CME Test for AMDA Clinical Practice Guideline. Diabetes Mellitus

Abdulaziz Al-Subaie. Anfal Al-Shalwi

Homeostatic Model Assessment (HOMA)

The Heat Equation. Lectures INF2320 p. 1/88

Antipsychotic Medications and the Risk of Diabetes and Cardiovascular Disease

DRUGS FOR GLUCOSE MANAGEMENT AND DIABETES

Advisors: Masahiko Saito, Mathematics and Statistics Scott Campbell, Chemical & Biomedical Engineering. Problem Suggested By: Scott Campbell

Markham Stouffville Hospital

WHAT IS DIABETES MELLITUS? CAUSES AND CONSEQUENCES. Living your life as normal as possible

Baskets of Care Diabetes Subcommittee

what is diabetes? What actually goes wrong? Talking diabetes No.42

Cooling and Euler's Method

Type 2 Diabetes. What is diabetes? Understanding blood glucose and insulin. What is Type 2 diabetes? Page 1 of 5

General Theory of Differential Equations Sections 2.8, , 4.1

A Virtual Type 1 Diabetes Patient

N E B R A S K A JAIL BULLETIN NUMBER 102 OCTOBER 1993

DIABETES A chronic, debilitating and often deadly disease A global epidemic Diabetes in Africa

Kansas Behavioral Health Risk Bulletin

Using the Theory of Reals in. Analyzing Continuous and Hybrid Systems

What is Type 2 Diabetes?

Background (cont) World Health Organisation (WHO) and IDF predict that this number will increase to more than 1,3 million in the next 25 years.

CLASS OBJECTIVES. Describe the history of insulin discovery List types of insulin Define indications and dosages Review case studies

19.7. Applications of Differential Equations. Introduction. Prerequisites. Learning Outcomes. Learning Style

Welcome to Diabetes Education! Why Should I Take Control of My Diabetes?

Monitoring and Carbohydrate Counting: The Cornerstones of Diabetes Control. Linda Macdonald, M.D. November 19, 2008

Diabetes 101: A Brief Overview of Diabetes and the American Diabetes Association What Happens When We Eat?

Statistics of Type 2 Diabetes

My Doctor Says I Need to Take Diabetes Pills and Insulin... What Do I Do Now? BD Getting Started. Combination Therapy

5 Numerical Differentiation

Diabetes mellitus 1 عبد هللا الزعبي. pharmacology. Shatha Khalil Shahwan. 1 P a g e

System of First Order Differential Equations

Mathematics Course 111: Algebra I Part IV: Vector Spaces

Other Noninfectious Diseases. Chapter 31 Lesson 3

CITY UNIVERSITY LONDON. BEng Degree in Computer Systems Engineering Part II BSc Degree in Computer Systems Engineering Part III PART 2 EXAMINATION

Cardiovascular Disease Risk Factors Part XII Insulin Resistance By James L. Holly, MD Your Life Your Health The Examiner September 15, 2005

EXIT TIME PROBLEMS AND ESCAPE FROM A POTENTIAL WELL

Is Insulin Effecting Your Weight Loss and Your Health?

Time domain modeling

Diabetes The Basics. What is Diabetes? How does sugar get into your cells? Type 1 diabetes. Type 2 diabetes. Why control Diabetes?

Modern Optimization Methods for Big Data Problems MATH11146 The University of Edinburgh

The Family Library. Understanding Diabetes

Managing Diabetes in the School Setting. Alabama State Department of Education Alabama Board of Nursing

Regulation of Metabolism. By Dr. Carmen Rexach Physiology Mt San Antonio College

INSULIN PRODUCTS. Jack DeRuiter

Diabetes and Obesity in Children. Janie Berquist, RN, BSN, MPH, CDE Children s Mercy Hospitals and Clinics Kansas City, MO

Intensive Insulin Therapy in Diabetes Management

Learn about Diabetes. Your Guide to Diabetes: Type 1 and Type 2. You can learn how to take care of your diabetes.

Faculty. Program Objectives. Introducing the Problem. Diabetes is a Silent Killer. Minorities at Greater Risk of Having Type 2 Diabetes

There seem to be inconsistencies regarding diabetic management in

1333 Plaza Blvd, Suite E, Central Point, OR *

Diabetes Mellitus. Melissa Meredith M.D. Diabetes Mellitus

Equilibria and Dynamics of. Supply Chain Network Competition with Information Asymmetry. and Minimum Quality Standards

Introduction. Pathogenesis of type 2 diabetes

Insulin onset, peak and duration of action

UNDERSTANDING AND LEARNING ABOUT STUDENT HEALTH

TYPE 2 DIABETES MELLITUS: NEW HOPE FOR PREVENTION. Robert Dobbins, M.D. Ph.D.

Transcription:

DELAY DIFFERENTIAL EQUATIONS IN MODELING INSULIN THERAPIES FOR DIABETES Final year project submitted to the Dept. of Mathematics of the University of Portsmouth May 2008 By Emma Geraghty B.Sc. (Hons) Mathematics Supervisor: Dr. Athena Makroglou Second Reader: Dr. Andrew Burbanks

Contents Abstract 5 Acknowledgements 6 1 Introduction 7 2 Background Information 8 3 Delay Differential Equations 10 3.1 DDE Methods............................. 10 3.2 Solving DDEs in Matlab....................... 13 4 Mathematical Models for Diabetes 15 4.1 Ordinary differential equations (ODEs)............... 15 4.2 Delay differential equations...................... 17 5 Modeling Insulin Therapies 19 6 Numerical Results 24 6.1 Example DDEs solved using dde23................. 24 6.2 Insulin Therapy Model solved using dde23............. 28 7 Some Proofs 33 8 Conclusions and Ideas for Further Research 36 Bibliography 37 A Matlab File Functions 39 B Inserting graphs in L A TEX. 41 2

List of Tables 5.1 Parameters of the functions in (4.3 to 4.7 and 5.2 to 5.5)..... 21 6.1 Example 1............................... 26 6.2 Example 2............................... 27 6.3 Example 3............................... 28 A.1 Matlab Function Files........................ 39 3

List of Figures 5.1 Lispro insulin infusion rate...................... 22 5.2 Regular insulin infusion rate..................... 22 5.3 Glucose intake rate.......................... 23 6.1 Example 1 graph, dde23 output of t against y(t).......... 26 6.2 Example 2 graph, dde23 output of t against y(t).......... 27 6.3 Example 3 graph, dde23 output of t against y(t).......... 28 6.4 Glucose Concentration over 240 mins................ 29 6.5 Insulin Concentration over 240 mins................. 29 6.6 Glucose Concentration over 480 mins................ 30 6.7 Insulin Concentration over 480 mins................. 30 6.8 Glucose Concentration over 24 hours................ 31 6.9 Insulin Concentration over 24 hours................. 31 6.10 Glucose Concentration over 32 hours................ 32 6.11 Insulin Concentration over 32 hours................. 32 4

Abstract In this project the type of models considered are delay differential equations for the modeling of insulin therapies, following mainly the research paper by Wang, Li, and Kuang (2007). The computational treatment of the equations is developed using Matlab and routine dde23 suite written by S Thomson and L Shampine and some of the related theory is analysed in full detail. In addition some theory and numerical methods of delay differential equations is studied following mainly the book Numerical Methods for Delay Differential Equations. by Bellen and Zenaro (2003). The typing was done in L A TEX, the project is accompanied by a CD containing the corresponding Matlab programs in the subdirectory Matlab files, and the.tex,.sty,.cls and.pdf files in another subdirectory: tex files. 5

Acknowledgements I would like to thank Dr. A Makroglou for her support and encouragement throughout the course of this project. Thanks also to my parents, family and friends for supporting me during my studies at the University of Portsmouth. 6

Chapter 1 Introduction A number of different kinds of mathematical models have appeared in the literature for use in the glucose-insulin regulatory system in relation to diabetes, in particular, modeling for insulin therapies. Such models include forms of ordinary differential equations, delay differential equations, partial differential equations and Fredholm integral equations. Various experiments have shown that in normal circumstances insulin is released in the body at various oscillatory speeds. The mathematical models are designed to mimic these speeds and and help give a better understanding of the mechanisms of the glucose-insulin regulatory sysytem to improve the treatments available for type 1 diabetes sufferers. The organisation of the thesis is as follows: Chapter 2 contains background material on diabetes and types of mathematical models used for modeling insulin therapies for diabetes sufferers. Chapter 3 presents a short introduction to delay differential equations, including some theory and numerical methods for solving delay differential equations. Chapter 4 is concerned with presenting different types of mathematical models used for the glucose-insulin regulatory system, mainly following the review paper by Makroglou, Li and Kwang (2006). In chapter 5 the delay differential equation model for modeling insulin therapies from the research paper by Wang, Li and Kwang (2007) is presented. Chapter 6 contains some example delay differential equations solved using the dde23 solver in Matlab and numerical results from the model presented in Chapter 5 and finally in chapter 7 conclusions and some ideas for further research are presented. The typing was done using L A TEX. The thesis is accompanied by a CD containing the programs, and the L A TEXand.pdf files associated with the project. A list of all the corresponding m-files used can be found in Appendix A. 7

Chapter 2 Background Information Diabetes mellitus is a chronic condition caused by too much glucose in your blood. The pancreatic endocrine hormones insulin and glucagon are responsible for regulating the glucose concentration level. In normal circumstances, insulin is released from β -cells in the pancreas if the blood glucose concentration is too high, this stimulates cells to absorb enough glucose from the blood for the energy, or fuel, that they need. Insulin also stimulates the liver to absorb and store any glucose that is left over. Glucagon is released when the glucose concentration is low, which stimulates liver cells to release glucose into the blood[12]. If a person s blood glucose concentration is constantly above what is considered to be the normal range for humans, because their bodies produce too little or no insulin at all, then they suffer from diabetes, a disease of the glucose-insulin regulatory system, sometimes referred to as hyperglycemia. According to the charity Diabetes UK there are currently over 2.3 million people with diabetes in the UK and there are up to another 750, 000 people with diabetes who have the condition and do not know it[13]. There are two main types of diabetes. Type 1 or insulin-dependent diabetes Type 1 diabetes is an autoimmune disease that occurs when the insulin-producing β -cells in the pancreas are attacked and destroyed by other cells in the body which normally protect us, so the body is only able to produce little or no insulin at all. Someone with this type of diabetes needs insulin replacement treatment for the rest of their life. They must check the levels of glucose in their blood regularly and watch out for complications. Type 1 diabetes is also known as juvenile diabetes, or early onset diabetes because it usually develops before the age of 40, often in the teenage years. Type 1 diabetes is the least common of the two main 8

CHAPTER 2. BACKGROUND INFORMATION 9 types and only accounts for about one in ten people with diabetes. Type 2 or non-insulin dependent diabetes Type 2 diabetes is a metabolic disorder which develops when the body can still make some insulin, but not enough, or when the insulin that is produced does not work properly. This is called insulin resistance. The risk of developing type 2 diabetes is increased if it runs in your family, and is usually linked with obesity. Type 2 diabetes is much more common and accounts for about nine in ten people with diabetes and over 80 % of these people are overweight[16]. Type 2 Diabetes is normally managed by modifying one s diet and engaging in more exercise. Symptoms can develop slowly over time, or not at all. Routine screenings are the most effective way to diagnose the condition. It is sometimes referred to as maturity onset diabetes because it occurs mostly in people over the age of 40. Diabetes is a chronic and progressive disease that has an impact upon almost every aspect of life and it is becoming more common, mainly due to an increase in obesity levels in the UK. Life expectancy is reduced by at least fifteen years for someone with Type 1 diabetes. In Type 2 diabetes, which is preventable in two thirds of people who have it, life expectancy is reduced by up to 10 years. Incidence of diabetes is greater in areas of higher deprivations with mortality rates from diabetes higher in people from lower socio-economic groups. And people from minority ethnic communities have up to a six times higher than average risk of developing diabetes [15]. If diabetes is left untreated or improperly managed, the high levels of blood sugar associated with diabetes can slowly damage both the small and large blood vessels in the body, resulting in a variety of complications: heart disease is two to four times more common in people with diabetes than without; diabetes is a leading cause of adult blindness in the UK; diabetes increases the risk of serious kidney disease; worldwide, half or more of all nontraumatic limb amputations are due to diabetes, and diabetes is a major cause of erectile dysfunction[14]. Many different types of mathematical models have been used and developed in the literature to better understand the mechanisms of the glucose-insulin regulatory system. Such models can be classified mathematically as: ordinary differential equations, delay differential equations, partial differential equations, Fredholm integral equations, stochastic differential equations and integro-differential equations[6].

Chapter 3 Delay Differential Equations A delay differential equation (DDE) is an equation where the evolution of the system at a certain time, t say, depends on the state of the system at an earlier time, t-τ say. This is distinct from ordinary differential equations (ODEs) where the derivatives depend only on the current value of the independent variable. The solution of DDEs therefore requires knowledge of not only the current state, but also of the state a certain time previously. 3.1 DDE Methods Many approaches to solving DDEs start from the problem in the formulation y (t) = f(t, y(t), y(t τ(t))), t 0 t t f y(t) = φ(t), t t 0. (3.1) The function y(t), represents some physical quantity that evolves over time. The derivative, y (t) depends on past values of y(t). φ(t) represents the initial function, and τ is the delay. There are several approaches to finding numerical solutions to (3.1). These include the direct application of linear multi-step methods and Runge-Kutta methods for ordinary differential equations. If the delay is non constant, the methods are combined with interpolation. The first approaches to the numerical solution of DDEs of the above form were characterised by the direct application of formulae for ordinary differential equations, called linear multistep methods. For example Euler s Forward Method, 10

CHAPTER 3. DELAY DIFFERENTIAL EQUATIONS 11 which is y n+1 = y n + h n+1 f(t n, y n, y q ), for some integer q<n. According to [1] Bellman s Method of Steps approach avoids the need for interpolation in solving the numerical solution of (3.1). To simplify, first consider the case of the constant delay τ. Then the discontinuity points are ξ k = t 0 + k r. In the first interval [t 0, t 0 + τ] (3.1) has the form y (t) = f(t, y(t), φ(t τ)), y(t 0 ) = φ(t 0 ). In the second interval [t 0 + τ, t 0 + 2τ], y 1 (t) = y(t τ) and y 2 (t) = y(t) can be defined, so the DDE (3.1) can be written as the 2d-dimensional system of ordinary differential equations y 1(t) = f(t τ, y 1 (t), φ(t τ)), y 2(t) = f(t, y 2 (t), y 1 (t)), y 1 (t 0 + τ) = φ(t 0 ), y 2 (t 0 + τ) = y(t 0 + τ). Hence in general, over the interval [t 0 + (k 1)τ, t 0 + kτ] the DDE (3.1) can be written as the kd-dimensional system of ordinary differential equations y i(t) = f(t (k i)τ, y i (t), y i 1 (t)), i = 1,... k, (3.2) y i (t 0 + (k 1)τ) = y(t 0 + (i 1)τ), i = 1,..., k, where y 0 (t) = φ(t kτ) and y i (t) = y(t (k i)τ), i,...,k are set. Passing from k to k + 1 in (3.2) means shifting the interval of integration from [t 0 + (k 1)τ, t 0 + kτ] to [t 0 + kτ, t 0 + (k + 1)τ, ] and extending the solution from [t 0, t 0 + kτ] to [t 0, t 0 + (k + 1)τ] by adding the component y k+1 (t) = y(t) in the current interval. Therefore, a standard numerical method for solving ordinary differential equations can be selected to solve (3.2), for increasing k, larger systems. For each step k, the numerical solution of the kd-dimension system (3, 2) is intended to provide an approximate value of y k (t 0 + kτ) = y(t 0 + kτ) to be

CHAPTER 3. DELAY DIFFERENTIAL EQUATIONS 12 used as the initial value of the new component y k+1 (t) = y(t) in the next step. The process ends when, for some k, t 0 + kτ t f. So it is necessary to solve a system of ever-increasing dimension and, to calculate repeatedly the same pieces of solution related to the previous intervals. However, due to the presence of the delayed argument that is storing and interpolating the computed solution throughout the interval [t 0, t f τ], reducing to a system of ordinary differential equations avoids standard complications ([1] p.54). Below a simple delay differential equation from [17] is solved using the method of steps. Consider the dde x (t) = 3x(t 5), x(t) = 2, 5 t 0. First consider the sub interval 0 t 0. In that subinterval, 5 t 5 0. So x(t 5) = 2, then the differential equation becomes x (t) = 3x(t 5) x (t) = 3 2 = 6 x(t) = 6t + c 1 using x(0) = 2 = c 1 = 2. Thus x(t) = 6t + 2, 0 t 5. In the next subinterval 5 t 10. Here 0 t 5 5 so x(t 5) = 6(t 5) + 2, the differential equation becomes x (t) = 3(6(t 5) + 2), x (t) = 18t 84, x(t) = 9t 2 84t + c 2, using x(5) = 6(5) + 2 = 32 so x(5) = 9(5) 2 84(5) + c 2 = 32 = c 2 = 227. Thus x(t) = 9t 2 85t + 227, 5 t 10.

CHAPTER 3. DELAY DIFFERENTIAL EQUATIONS 13 3.2 Solving DDEs in Matlab Using the routine suite dde23, written by S Thompson and L Shampine in Matlab, it is easier to solve a large class of delay differential equations. The Program is restricted to solving systems of equations of the form y (x) = f(x, y(x), y(x τ 1 ), y(x τ 2 ),... y(x τ k )) for constant delays τ j such that τ = min(τ 1,..., τ k ) > 0. The equations are on hold on a < x < b, which requires the history y(x) = S(x) to be given for x a. dde23 uses explicit Runge-Kutta triple methods used in solving ordinary differential equations, in particular the Runge-Kutta triple BS(2,3), and extends these methods to solve delay differential equations. A triple of s stages involves three formulas. If you have an approximation y n to y(x) at x n and wish to compute an approximation at x n+1 = x n + h n. For i = 1,..., s, the stages f ni = f(x ni, y ni ) are defined in terms of x ni = x n + c i h n and i 1 y ni = y n + h n a ij f nj. The first formula used in the triple is an approximation used to advance the integration, written in terms of the increment function: j=1 φ(x n, y n ) = s b i f ni. (3.3) i=1 The second formula is used only for selecting the step size: y n+1 = y n + h n s b i f ni = y n + h n φ (x n, y n ). (3.4) i=1 The third formula is often described as a continuous extension of the first and has the form: y n+σ = y n + h n s b i (σ)f ni. (3.5) i=1 The coefficients b i (σ) are polynomials in σ, so this represents a polynomial approximation to y(x n + σh n ) for 0 σ 1. It is assumed that this formula yields

CHAPTER 3. DELAY DIFFERENTIAL EQUATIONS 14 the value y n when σ = 0 and y n+1 when σ = 1. When the delay term is less than or equal to the step size and you have an available approximation S(x) to y(x) for all x x n. All the x ni τ j x n and f ni = f(x ni, y ni, S(x ni τ 1 ),..., S(x ni τ k )) is an explicit recipe for the stage and the formulas are explicit. The function S(x) is the initial history for x a. After taking the step to x n+1, then use (3.5) to define S(x) on [x n, x n+1 ] as S(x n + σh n ) = y n+σ. Another step can then be made. When h n > τ j for some j, that is, the step size is greater than the smallest delay, the history term S(x) is evaluated in the span of the current step and the formulas are defined implicitly. In this situation the formulas are evaluated with simple iteration. On reaching x n, S(x) is defined for x x n. Its definition is extended to (x n, x n + h n ] and the resulting function is called S (0) (x). A typical stage of simple iteration begins with the approximate solution S m (x). The next iterate is computed with the explicit formula: S (m+1) (x n + σh n ) = y n + h n φ(x n, y n, σ; S (m) (x)) dde23 predicts S (0) (x) to be the constant y 0 for the first step. [8] A typical invocation of dde23 has the form sol= dde23(ddef ile, lags, history, tspan); where ddefile is the name of the function for evaluating the DDE, lags is the constant delays, supplied as an array. History can be specified as the name of a function that evaluates the solution at the input value of t and returns it as a column vector, and tspan is the interval of integration. See chapter Numerical Results for some examples of using dde23 to solve some simple delay differential equation models.

Chapter 4 Mathematical Models for Diabetes There are a number of different types of mathematical models including delay differential equations, which have been used and developed in the literature to better understand the mechanisms of the glucose-insulin regulatory system, for example, ordinary, partial, stochastic and integro-differential equations, and Fredholm integral equations. In this chapter an overview of some of the other mathematical models is given, including ordinary differential equation and some delay differential models used in modeling various diabetes therapies. 4.1 Ordinary differential equations (ODEs) ODE modeling started with the so-called minimal model which contains a minimum number of parameters, and is widely used in physiological research to estimate glucose effectiveness and insulin sensitivity from intravenous glucose tolerance test data by sampling over certain periods. There are believed to be approximately 50 studies published per year and more than 500 can be found in the literature, which involve the minimal model (cf [6]). It has the form dg(t) dt dx(t) dt di(t) dt = [p 1 + X(t)]G(t) + p 1 G b, G(0) = p 0, (4.1) = p 2 X(t) + p 3 (I(t) I b ), X(0) = 0, = p 4 (G(t) p 5 ) + t p 6 (I(t) I b ), I(0) = p 7 + i b. 15

CHAPTER 4. MATHEMATICAL MODELS FOR DIABETES 16 Where (G(t) p 5 ) + = G(t) p 5 if G(t) > p 5 and 0 otherwise. G(t) denotes blood glucose concentration at time t, I(t) insulin blood concentration, G b is the subjects baseline glycaemia, I b the subject s baseline insulinimia, p 1 p 6 are various rate constants, and p 0 and p 7 are constants. The auxiliary variable X(t) mimics the time delay of the insulin consumption on glucose (cf [3]). Tolic et al [9] developed a six dimensional model, based on two negative feedback loops describing the effects of insulin on glucose utilisation and production and the effect of glucose on insulin secretion. The model simulated ultradian insulin secretion oscillations, and has been the basis of many delay differential equation models, it has the form: dg(t) dt di p (t) dt di i (t) dt dx 1 (t) dt dx 2 (t) dt dx 3 (t) dt = G in f 2 (G(t)) f 3 (G(t))f 4 (I i (t)) + f 5 (x 3 (t)) (4.2) ( Ip (t) = f 1 (G(t)) E I ) i(t) I p(t) V p V i t p ( Ip (t) = E I ) i(t) I p(t) V p V i t p = 3 t d (I p (t) x 1 (t)) = 3 t d (x 1 (t) x 2 (t)) = 3 t d (x 2 (t) x 3 (t)) where G(t) is the mass of glucose, I p (t), and I i (t) is mass of insulin in the blood and the intercellular space, respectively, V p is the plasma insulin distribution volume, V i is the effective volume of the intercellular space, E is the diffusion transfer rate, t p, and t i are insulin degradation time constants in the blood and intercellular space, respectively, G in indicates exogenous glucose supply rate to the blood, and x 1 (t), x 2 (t), x 3 (t) are three additional variables associated with certain delays of the insulin effect on the hepatic glucose production with total time t d. f 1 (G) is a function modeling the pancreatic insulin production as controlled by the glucose concentration, f 2 f 4 are functions for glucose utilisation by various body parts, and f 5 is a function modeling hepatic glucose production.

CHAPTER 4. MATHEMATICAL MODELS FOR DIABETES 17 Their forms are given as: f 1 (G) = R m /(1 + exp((c 1 G/V g )/a 1 )), (4.3) f 2 (G) = U b (1 exp( G/(C 2 V g ))), (4.4) f 3 (G) = G/(C 3 V g ), (4.5) f 4 (I) = U 0 + (U m U 0 )/(1 + exp( β ln I(1/V i + 1/(Et i )) c 4 )), (4.6) f 5 (I) = R g /(1 + exp(ˆα(i/v p C 5 ))). (4.7) The parameters of the functions are given in Table (5.1). 4.2 Delay differential equations A number of delay differential equation developed in the literature are modifications to the ordinary differential equation model (4.2). The following model (4.8) is developed in [4], its forms are the same as in (4.2). dg(t) dt di(t) dt = G in (t) f 2 (G(t)) f 3 (G(t))f 4 (I(t)) + f 5 (I(t τ 2 )), (4.8) = f 1 (G(t)) I(t) t 1 This model is for ultradian insulin oscillation but the glucose triggered insulin production delay is missing. Model (4.9) was introduced in [2] also as a modification of the ordinary differential delay equation model (4.2). By incorporating a discrete delay term, the three auxiliary variables representing the delay between plasma insulin and its effect on hepatic glucose production are dispensed. di p (t) dt di i (t) dt dg(t) dt ( Ip (t) = f 1 (G(t)) E V p ( Ip (t) = E I ) i(t) V p V i I ) i(t) I p(t) (4.9) V i t p I i(t) t i = G in (t) f 2 (G(t)) qg(t)f 4 (I i (t)) + f 5 (I p (t τ)) where I p (s) = I 0 p(s) 0, sɛ[ τ, 0] with I 0 p(0) > 0, G(0) = G 0 > 0, I i (0) = I 0 i > 0, q > 0 is a constant, G in > 0 represents the input of glucose from outside the system and the functions f 1 f 5 are the same as for (4.2), except the function f 3

CHAPTER 4. MATHEMATICAL MODELS FOR DIABETES 18 hasn t been labelled, here it is the linear function qg. The following model from [5] models the glucose-insulin regulatory system with one explicit time delay, and uses auxiliary variables as in (4.2) to mimic the hepatic glucose production delay. G (t) = G in f 2 (G(t)) f 3 (G(t))f 4 (I(t)) + f 5 (x 3 ) (4.10) I (t) = f 1 (G(t τ 1 )) d i I(t) x 1(t) = 3(I x 1 )/t d x 2(t) = 3(x 1 x 2 )/t d x 3(t) = 3(x 2 x 3 )/t d. See (cf [6]) for references of other types of models, for example in the form of partial differential equations and integro-differential equations, used in the literature.

Chapter 5 Modeling Insulin Therapies The idea of insulin therapy is to mimic the normal reaction of the β -cells in the pancreas when they are stimulated by an increase in glucose concentration of the blood, for example after meal ingestion. Numerous experiments have demonstrated that insulin is released from β -cells in two oscillatory modes: pulsatile oscillations and ultradian oscillations. Insulin therapies must mimic the insulin secretion at these to time scales, and are normally introduced based on clinical experiences, although mathematical models have been proposed for some specific situations [10]. In the paper by Wang et al. [10] the following generic model is put forwards to simulate the pancreatic insulin secretion with insulin infusion after blood glucose concentration increases for type 1 diabetics: G (t) = G in (t) f 2 (G(t)) f 3 (G(t))f 4 (I(t τ 3 )) + f 5 (I(t τ 2 )), (5.1) I (t) = I in (t) d i I(t), with initial condition I(0) > 0, G(0) > 0, and I(t) I(0) for tɛ[ max{τ 2, τ 3 }, 0], τ 2, τ 3 > 0. G(t) and I(t) denote glucose and insulin concentration at t 0 respectively. I in (t) is the exogenous insulin infusion rate. G in (t) is the glucose intake rate. f 2 is the insulin-independent glucose utilisation by the brain and nerve cells. f 3 (G)f 4 (I) is the insulin-dependent glucose utilisation by muscle, fat and other tissues. τ 3 > 0 stands for the time delay for insulin-dependent glucose uptake by cells. f 5 (I) is the glucose production controlled by insulin concentration I. When the blood glucose level is low, glucagon is released in the pancreas and causes the liver to 19

CHAPTER 5. MODELING INSULIN THERAPIES 20 produce and release glucose, τ 2 > 0 stands for this glucose production delay in the liver. Insulin degradation is proportional to insulin concentration, so it is assumed that the clearance rate is a constant, denoted by d i > 0. The following conditions are assumed: G in (t), I in (t)ɛc([0, ), (0, )) are positive ω -periodic functions. f 2 (x), f 3 (x), f 4 (x)ɛc 1 [0, ) are positive for x > 0.f 2 (0) = f 3 (0) = 0 f 2(x), f 3(x), f 4(x) are positive on [0, ). f 5 (x)ɛc 1 [0, ) is positive on [0, ), f 5(x) is negative on [0, ). There exist positive numbers b 2, a 3, b 3 f 2 (x) b 2 x and a 3 x f 3 (x) b 3 x. such that, for 0 x, 0 Also the functions f 2 f 5 are defined as: f 2 (G) = U b (1 exp( G/(C 2 V g ))), (5.2) f 3 (G) = G/(C 3 V g ), (5.3) f 4 (I) = U 0 + (U m U 0 )/(1 + exp( β ln I(1/V i + 1/(Et i )) c 4 )), (5.4) f 5 (I) = R g /(1 + exp(ˆα(i/v p C 5 ))). (5.5) Parameters of the function in (5.2) to (5.5) can be found in Table (5.1) [9].

CHAPTER 5. MODELING INSULIN THERAPIES 21 Table 5.1: Parameters of the functions in (4.3 to 4.7 and 5.2 to 5.5) Parameter Units Values Parameters Units Values V g 1 10 U 0 mg min 1 40 U b mg min 1 72 U m mg min 1 940 C 2 mg l 1 144 β 1.77 C 3 mg l 1 1000 C 4 mul 1 80 V p l 3 R g mg min 1 180 V i l 11 ˆα lmu 1 0.29 t i min 100 C 5 mul 1 26 E l min 1 0.2 a 1 mg l 1 300 Managing type 1 diabetes has changed dramatically over the past 30 years, there are now a wide range of insulin products available for injection to maintain a near normal blood sugar level, for example rapid-acting insulin, short-acting insulin, intermediate-acting insulin and long-acting insulin. With different types of insulin products, different therapies and algorithms can be developed for treatments of different diabetes [10]. Following [10]; model (5.1) is used with the effects of regular insulin, a shortacting insulin which has an onset time of 5-15 minutes, a peak time of 30-90 minutes and lasts for a duration of about 3-5 hours, and lispro insulin which is a rapid-acting insulin which has an onset time of 30-60 minutes, a peak time of 1-5 hours and lasts for a duration of 6-10 hours [10]. Functions (5.6) and (5.7) and figures (5.1) and (5.2) show the infusion rates of lispro and regular insulin respectively: 0.25, 0 t < 5(min), 0.25 + 1 ( 1 + ( t 30 I INlispro (t) = 30 5)), 5 t < 30(min), 0.25 + 1 ( 1 ( t 30 120 30)), 30 t < 120(min), 0.25, 120 t 240(min). (5.6) I INregular (t) = 0.25, 0 t < 30(min), 0.25 + 1 ( 1 + ( )) t 120 90, 30 t < 120(min), 0.25 + 1 ( 1 0.5 ( )) (5.7) t 120 120, 120 t < 240(min), 0.25 + 0.5 ( 1 ( )) t 240 240, 120 t 480(min)

CHAPTER 5. MODELING INSULIN THERAPIES 22 Figure 5.1: Lispro insulin infusion rate 1.6 1.4 1.2 µ U/min 1 0.8 0.6 0.4 0.2 0 50 100 150 200 250 300 350 400 450 500 minutes Figure 5.2: Regular insulin infusion rate 1.6 1.4 1.2 µ U/min 1 0.8 0.6 0.4 0.2 0 100 200 300 400 500 600 700 800 900 1000 minutes

CHAPTER 5. MODELING INSULIN THERAPIES 23 It is assumed that a subject takes a meal every 4hours (here ω = 240min). The maximum glucose intake is 5mg/min that is attained at 15minutes. whole duration of the glucose intake is 45minutes. The function (5.8) and figure (5.3) represent the glucose intake functions: 0.05 + ( 5 15) t, 0 t < 15(min), G in (t) = 0.05 + 5 ( 45 t 45 15), 15 t < 45(min), 0.05, 45 t 240(min). The (5.8) Figure 5.3: Glucose intake rate 6 5 4 mg/min 3 2 1 0 0 50 100 150 200 250 300 350 400 450 500 minutes See section 6.2 for numerical results for solving model (5.1)

Chapter 6 Numerical Results 6.1 Example DDEs solved using dde23 Below are two examples from [18] of solving systems of DDEs in Matlab using the dde23 program. A list of all the corresponding m-files created in Matlab can be found in Appendix A Example 1 The equations (originally example 3 from [11]) y 1(t) = y 1 (t 1), y 2(t) = y 1 (t 1) + y 2 (t 0.2), y 3(t) = y 2 (t), are to be solved on the interval [0, 5] with history y 1 (t) = 1, y 2 (t) = 1, y 3 (t) = 1 for t 0 Here the ddefile used is function v = exam1f(t,y,z) ylag1 = Z(:,1); ylag2= Z (:,2); v = zeros(3,1); v(1) = ylag1(1); v(2) = ylag1(1) + ylag2(2); v(3) = y(2); Here the vector y approximates y(t) and column j of the array Z approximates y(t τ j ) for j = 1,...,k. dde23 computes an approximate solution y(t), called sol, valid throughout tspan, and also provides the information necessary to evaluate it. This evaluation is 24

CHAPTER 6. NUMERICAL RESULTS 25 done using the deval function, here it computes the solution y(t) between 0 and 5 and plots the graph time, t, against the solution y(t). Table (6.1) gives the dde23 output, and Figure (6.1) shows the graph of t against y(t) Example 2 This example (originally example 4.4 from [7] )shows how to solve problems that have a continuous solution with discontinuities in a low-order derivative at points known in advance. The history is the solution prior to the initial point and its discontinuities must also be taken into account because they propagate into the interval of integration. It models the spread of an infectious disease, the different phases of the disease are described by different equations, here the phase changes are known in advance. The model requires the solution to be continuous, but the changes in the equation lead to jumps in low order derivatives. Using the jumps option in dde23 tells the solver where the discontinuities are in the model. The equation ry(t)0.4(1 t) if 0 t 1 c y ry(t)(0.4(1 t) + 10 e µ y(t)) if 1 c t 1 (t) ry(t)(10 e µ y(t)) if 1 t 2 c re µ y(t)(y(t 1) y(t)) if 2 c t is solved on [0, 10] with history y(t) = 10 for t 0. Here c = 1/ 2, µ = r/10 and r = 0.5 dde23 solves the problem and computes an approximation to y(t) at 10 points between 0 and 10, the values are shown in table (6.2) and figure (6.2) shows the graph of t against y(t) Example 3 This example from (cf [19]) uses dde23 to solve the following delay differential

CHAPTER 6. NUMERICAL RESULTS 26 equation y (t) = y(t) + y(t π) + 3 cos(t) + 5 sin(t); 0 t 3 y(t) = 3 sin(t) 5 cos(t); t 0. the true solution for the equation is given by y(t) = 3 sin t 5 cos t; t 0. so it can be compared to the dde23 solutions. Table (6.3) shows the dde23 output for y(t), the true solution and the error between the two, and figure (6.3) plots the graph of t against y(t). Table 6.1: Example 1 (t) 1 2 3 4 5 y 1 1 2.2813 4.6458 9.4376 19.1749 y 2 1 4.8536 17.3118 56.5652 176.4120 y 3 1 4.2464 16.6112 58.2548 190.3353 Figure 6.1: Example 1 graph, dde23 output of t against y(t) 200 180 160 140 y1(t) y2(t) y3(t) 120 y(t) 100 80 60 40 20 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 t

CHAPTER 6. NUMERICAL RESULTS 27 Table 6.2: Example 2 t 1 2 3 4 5 y 10 4.91911 0.0900 0.0631 0.0630 t 6 7 8 9 10 y 0.0630 0.0630 0.0630 0.0630 0.0630 Figure 6.2: Example 2 graph, dde23 output of t against y(t) 10 9 8 7 6 y(t) 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 time t

CHAPTER 6. NUMERICAL RESULTS 28 Table 6.3: Example 3 t y(t) True Solution Error 0 5 5 0 1 0.181385 0.177099 0.004286 2 4.798128 4.808626 0.010498 3 5.350834 5.373323 0.022488 Figure 6.3: Example 3 graph, dde23 output of t against y(t) 6 4 2 y(t) 0 2 4 6 0 0.5 1 1.5 2 2.5 3 time t 6.2 Insulin Therapy Model solved using dde23 The routine suite dde23 was applied to the generic model (5.1) put forwards in [10] to simulate the dynamics of the insulin therapies for type 1 diabetic patients. The units of G and I in the functions (5.2) to (5.5) are in mg and mu, respectively. These are converted to mg/dl and µ U/ml when plotting the figures. The initial values of glucose and insulin concentration used were 1420v g and 18v p respectively for the effects of lispro insulin and 1550v g and 5v p for regular insulin. Glucose concentration is calculated by G/v g 10 and insulin concentration by I/V p Figures (6.4)and (6.5) show the glucose and insulin concentration for the

CHAPTER 6. NUMERICAL RESULTS 29 model (5.1) after the subcutaneous injection of lispro insulin following function (5.6), with τ 3 = 15min, τ 3 = 5min, d i = 0.0076(min 1 ) and ω = 240. Figure 6.4: Glucose Concentration over 240 mins 150 di=0.0076 /min, τ 2 =15, τ 3 =5, I in : insulin lispro 140 y1(t): Glucose in mg /dl 130 120 110 100 90 0 50 100 150 200 250 time t in min Figure 6.5: Insulin Concentration over 240 mins 28 di=0.0076 /min, τ 2 =15, τ 3 =5, I in : insulin lispro 26 y2(t): Insulin in µ U /ml 24 22 20 18 16 0 50 100 150 200 250 time t in min

CHAPTER 6. NUMERICAL RESULTS 30 Figure (6.6) and (6.7) show the glucose and insulin concentration for the model (5.1) after the subcutaneous injection of regular insulin following function (5.7) with τ 2 = 15min, τ 3 = 5min, d i = 0.0107(min 1 ) and ω = 480. Figure 6.6: Glucose Concentration over 480 mins 200 di=0.0107 /min, τ 2 =15, τ 3 =5, I in : regular insulin 180 y1(t): Glucose in mg /dl 160 140 120 100 80 0 50 100 150 200 250 300 350 400 450 500 time t in min Figure 6.7: Insulin Concentration over 480 mins 30 di=0.0107 /min, τ 2 =15, τ 3 =5, I in : regular insulin 25 y2(t): Insulin in µ U /ml 20 15 10 5 0 50 100 150 200 250 300 350 400 450 500 time t in min

CHAPTER 6. NUMERICAL RESULTS 31 As it is assumed that a subject takes a meal every 4 hours, and glucose intake and insulin infusion are periodic functions, figures (6.8) to (6.11) show the glucose and insulin concentration profiles under the exogenous infusion of glucose and insulin throughout the day. Figures (6.8) and (6.9) show the glucose and insulin concentrations after injections of lispro insulin, with τ 2 = 15min, τ 3 = 5 min, d i = 0.0076(min 1 ) with ω = 240min over 24hours. Figure 6.8: Glucose Concentration over 24 hours 150 di=0.0076 /min, τ 2 =15, τ 3 =5, I in : lispro insulin 140 y1(t): Glucose in mg /dl 130 120 110 100 90 80 0 500 1000 1500 time t in min Figure 6.9: Insulin Concentration over 24 hours 28 di=0.0076 /min, τ 2 =15, τ 3 =5, I in : lispro insulin 26 y2(t): Insulin in µ U /ml 24 22 20 18 16 0 500 1000 1500 time t in min

CHAPTER 6. NUMERICAL RESULTS 32 Figures (6.10) and (6.11) show the glucose and insulin concentration after injections of regular insulin, with τ 2 = 15min, τ 3 = 5 min, d i = 0.0107(min 1 ) with ω = 480min over 32hours. Figure 6.10: Glucose Concentration over 32 hours 200 di=0.0107 /min, τ 2 =15, τ 3 =5, I in : regular insulin 180 y1(t): Glucose in mg /dl 160 140 120 100 80 60 0 200 400 600 800 1000 1200 1400 1600 1800 2000 time t in min Figure 6.11: Insulin Concentration over 32 hours 30 di=0.0107 /min, τ 2 =15, τ 3 =5, I in : regular insulin 25 y2(t): Insulin in µ U /ml 20 15 10 5 0 200 400 600 800 1000 1200 1400 1600 1800 2000 time t in min

Chapter 7 Some Proofs In this chapter, a detailed proof is included expanding on thar given in ([10] p.21) that derives the form of I (t), a ω-periodic solution of (7.3) given below. In addition, the results concerning the existence of a positive ω-periodic solution of (7.2) and (7.3) and its global stability as stated in [10]. Consider the model from [10] G (t) = G in (t) f 2 (G(t)) f 3 (G(t))f 4 (I(t τ 3 )) + f 5 (I(t τ 2 )), (7.1) I (t) = I in (t) d i I(t), (7.2) and the homogeneous form of the equation (7.2) is: I (t) = d i I(t) (7.3) Separate variables I (t) I(t) = d i Integrate di(t) = I(t) d i dt ln I(t) = d i t + c I(t) = e dit e c I h (t) = C 0 e d it 33

CHAPTER 7. SOME PROOFS 34 where h:homogeneous and nh:non-homogeneous. Try trial solution I nh (t) = C 0 (t)e d it Differentiate I (t) = C 0(t)e dit + C 0 (t)e dit ( d i ) C 0(t)e dit + C 0 (t)e dit ( d i ) = I in (t) d i C 0 (t)e d it C 0(t) = I in (t)e d it C 0 (t) C 0 (0) = t C 0 (t) = C 0 (0) + C 0 (t) = I(0) + 0 I in (s)e d is ds t 0 t 0 I in (s)e d is ds I in (s)e d is ds I(t) = I in (t) + I in (t) = C 0 e d it + [I(0) + t = C 0 e d it + I(0)e d it + e d it = C 1 e d it + e d it t 0 0 I in (s)e d is ds]e d it t 0 I in (s)e d is ds I in (s)e d is ds I(0) = C 1 I(t) = I(0)e dit + e dit + t 0 I in (s)e d is ds

CHAPTER 7. SOME PROOFS 35 In order to find a ω-periodic solution, we set I(t + ω) = I(t) for all t, I(t + ω) = e d i(t+ω) (I 0 + = e d it e d iω (I 0 + + t+ω t t+ω 0 t 0 I in (s)e d is ds) I in (s)e d is ds) I in (s)e d is ds = I(t)e d i(ω) + e d it e d iω I(t + ω) = I(t) (I e diω )I(t) = e dit e d iω t+ω t t+ω t I in (s)e d is ds) I in (s)e d is ds) and thus, if we denote by I (t), the positive ω-periodic solution we have I (t) = e d it d i ω t+ω I 1 e d in (s)e dis ds (7.4) iω t It is easy to verify that (7.4) indeed satisfies (7.3) Lemma 3.1 All solutions of model (7.1) and (7.2) exist for t > 0, and they are positive and bounded from above. Proof can be found in ([10] p.22) Theorem 3.4 Model (7.1) and (7.2) has a positive periodic solution (G, I ), proof can be found in ([10] p.28), where I is defined in (7.4) Theorem 3.5 The periodic solution (G (t), I (t)) in Theorem 3.4 is globally asymtotically stable and unique, i.e., any solution (G(t), I(t)) with initial conditions G > (0)0 and I(0) > 0 satisfies G(t) G (t) 0, I(t) I (t) 0 as t The proof of Theorem 3.5 can be found in ([10] p.30)

Chapter 8 Conclusions and Ideas for Further Research Delay differential equations are an interesting form of differential equations, with many different applications, particularly in the biological and medical worlds. All the numerical results and graphs presented in the project were in agreement with those presented in the relevant corresponding papers. As shown in example 3 in Chapter 6 the output results generated by dde23 have a relatively small error of less than 0.03 when compared to the true solutions of the problem. dde23 is therefore an effective tool for solving delay differential equations. Ideas for further research include: Solving other types of delay differential equations. Such as equations with a variable delay, or state dependent equations where the delay depends on an unknown function. To consider other types of models used in modeling insulin therapies, for example ordinary or partial differential equation models. To attempt estimations of some other parameters. For example different delay times. To use other computer software programs to calculate numerical solutions to delay differential equations. 36

Bibliography [1] Bellen A., and Zennaro M. Numerical Methods for Delay Differential Equations, Oxford University Press, 2003. [2] Bennett D., and Gourley S. Asymptotic properties of a delay differential equation model for the interaction of glucose with plasma and inerstitial insulin. Applied Mathematics and Computation 2004; 151; 189-207. [3] Boutayeb A., and Chetouani A. A critical review of mathematical models and data used in diabetology. BioMedical Engineering Online 2006; 5; 43. [4] Engelborghs K., Lemaire V., Belair J., and Roose D. Numerical bifurcation analysis of delay differential equations arising from physiological modeling. Journal of Mathematical Biology 2001; 42; 31-385. [5] Li J., Kuang Y., and Mason C. Modeling the glucose-insulin regulatory system and ultradian insulin oscillations with two explicit time delays. Journal of Theoretical Biology 2006; 242; 722-735. [6] Makroglou A., Li J., and Kuang Y. Mathematical models and software tools for the glucose-insulin regulatory system and diabetes: an overview. Applied Numerical Mathematics, 2006; 56; 559-573. [7] Oberle H., and Pesch H. Numerical treatment of delay differential equations by Hermite interpolation. Numerical Mathematics, 1981; 37; 235-255. [8] Thompson S., and Shampine L.F. Solving DDEs in Matlab. Applied Numerical mathematics 2001; 37; 441-458. [9] Tolic I., Mosekilde E., and Sturis J. Modelling the Insulin-Glucose Feedback Sysyem: The Significance of Pulsatile Insulin Secretion. Journal of Theoretical Biology, 2000; 207; 361-375. 37

BIBLIOGRAPHY 38 [10] Wang H., Li J., and Kuang Y. Mathematical modeling and qualitative analysis of insulin therapies. Mathematical Biosciences 2007; 210; 17-33. [11] Wille D., and Baker C.T.H. DELSOL-A numerical code for the solution of a system of delay differential equations. Applied Numerical Mathematics. 1992; 9; 223.234 [12] http://www.bbc.co.uk/health/conditions/diabetes/aboutdiabetes what.shtml (cited 2008 Feb 20) [13] http://www.diabetes.org.uk/guide-to-diabetes/what is diabetes (cited 2008 Feb 20) [14] http://www.diabetes.co.uk/info/generalinformation.html (cited 2008 Feb 20) [15] http://www.dh.gov.uk/en/healthcare/nationalserviceframeworks/diabetes /DH 074762 (cited 2008 Feb 20) [16] http://www.nhsdirect.nhs.uk/articles/article.aspx?articleid= 128. (cited 2008 Feb 20) [17] http://solar.physics.montana.edu/reu/2006/awilmot/ delaydifferentialequations.html (cited 2008 Mar 5) [18] Thompson S, Shampine LF. Solving Delay Differential Equations with dde23. Tutorial (cited 2008 Mar 2) Available from: http://www.radford.edu/ thompson/webddes/tutorial.pdf. [19] l:/technology/student/maths/makroglo/e13/labs/labs2/lab2.ps

Appendix A Matlab File Functions Table A.1: Matlab Function Files Subdirectory Files used File Function Example 1 exam1f.m Function to be evaluated programexam1f.m dde23 program file to run Example 2 exam2.m Function to be evaluated programexam2.m dde23 program file to run Example 3 lab2.m Function to be evaluated lab2a.m Gives history of equation proglab2.m dde23 program file Delay Eqn f 2 f 3 Function files used in main model f 4 f 5 Wang et al. Gin.m Glucose intake rate Plotgin.m Plots glucose intake rate graphglu.fig Graph of glucose intake rate Iinr2.m Regular insulin infusion rate graphinreg2.m Plots regular insulin infusion rate graphinreg2.fig Graph of regular insulin infusion rate Iinlis.m Lispro insulin infusion rate Plotlis.m Plots lispro insulin infusion rate graphinlis.fig Graph of lispro insulin infusion rate 39

APPENDIX A. MATLAB FILE FUNCTIONS 40 Subdirectory Files used File Function Delay Eqn2 dde1hist.m Gives history of equation ddeval.m Evaluates sol given by dde23 at given points exam1f.m Function to be evaluated exam2.m dde23 program file to run Gin.m Glucose intake rate Iinlis.m Lispro insulin infusion rate Delay Eqn3 dde1hist.m Gives history of equation ddeval.m Evaluates sol given by dde23 at given points exam1f.m Function to be evaluated exam2.m dde23 program file to run Gin3.m Glucose intake rate Gin3b.m Glucose intake rate Iinr3.m Regular insulin infusion rate Iinr3b.m Regular insulin infusion rate Delay Eqn4 dde1hist.m Gives history of equation ddeval.m Evaluates sol given by dde23 at given points exam1f.m Function to be evaluated exam2.m dde23 program file to run Gin3.m Glucose intake rate Gin3b.m Glucose intake rate Iinr3.m Regular insulin infusion rate Iinr3b.m Regular insulin infusion rate Delay Eqn5 dde1hist.m Gives history of equation ddeval.m Evaluates sol given by dde23 at given points exam1f.m Function to be evaluated exam2.m dde23 program file to run Gin3.m Glucose intake rate Gin3b.m Glucose intake rate Iinlis3.m Regular insulin infusion rate Iinlis3b.m Regular insulin infusion rate tex files Project.tex Final year project.tex file muthesis2.cls Thesis template setspace.sty Thesis template graphinlis.pdf Graph of lispro insulin infusion rate graphinreg.pdf Graph of regular insulin infusion rate Glucoseingraph.pdf Graph of glucose intake rate example1.pdf Graph example2.pdf Graph example3 graph.pdf Graph glucoseconlisp.pdf Graph of glucose concentration over 240min insulinconlisp.pdf Graph of insulin concentration over 240min glucoseconreg.pdf Graph of glucose concentration over 480min insulinconreg.pdf Graph of insulin concentration over 480min glucoseconlis2.pdf Graph of glucose concentration over 24hours insulinconlis2.pdf Graph of insulin concentration over 24hours glucoseconreg2.pdf Graph of glucose concentration over 32hours insulinconreg2.pdf Graph of insulin concentration over 32 hours

Appendix B Inserting graphs in LATEX. To insert graphs into my L A TEXdocument directions from the website http://www.cqf.info/forum/viewtopic.php?t=3038 were used All graphs are saved as.pdf files in the same directory as my document. The graphs were saved in the centre of the page with a large white space around them. To crop the images and adjust the white space around the graphs the bounding box (bb) command in L A TEXwas used. To determine the correct bounding box dimensions for the graphs the user package Ghostview was used. By selecting the options menu and show bounding box option, then hovering the mouse over the graph, the coordinates are calculated for the lower left corner and for the upper right corner of the graph as the bb command in L A TEXrequires two sets of coordinates; the first two numbers are the coordinates of the bottom left of the figure, and the second two are the coordinates of the top right corner. This crops all the white space around the figure making the graph fit properly onto a page. For example the code for example 1 graph is \includegraphics[bb=142 298 468 554, scale=0.9]{example1.pdf} 41