Solving Delay Differential Equations With Julia | David Widmann | JuliaCon 2019

The Julia Programming Language
23 Jul 201931:44

Summary

TLDRThe speaker, a PhD student at Uppsala University, discusses their research on solving delayed differential equations (DDEs) using Julia's differential equations package ecosystem. They explain the concept of DDEs, which extend ordinary differential equations by incorporating past values of the state, and highlight the challenges in solving them due to potential discontinuities and richer dynamical structures. The presentation outlines the process of formulating DDEs in Julia, leveraging existing solvers for ordinary differential equations, and the innovative approaches taken to handle discontinuities and state-dependent delays. The speaker also shares their experience with the Julia package, their contributions to it, and the successful simulation of complex models, emphasizing the potential for further enhancements like Anderson acceleration and the development of stochastic DDE solvers.

Takeaways

  • 🎓 The speaker is a PhD student at Uppsala University researching uncertainty in deep learning but is presenting on solving delayed differential equations (DDEs).
  • 🔍 The speaker's initial work on DDEs began during their master's project at Technical University in Munich, involving comparing two models formulated as DDEs.
  • 💡 The motivation for contributing to the Julia differential equations package ecosystem stemmed from the need to simulate models reliably for parameter estimation.
  • 🧩 DDEs extend ordinary differential equations (ODEs) by allowing the derivative to depend on past values of the state, which is crucial for modeling certain biological phenomena.
  • 📉 The speaker faced issues with simulating DDEs, including negative concentrations and unreliable simulations, prompting the opening of issues and pull requests in the Julia ecosystem.
  • 🛠 The 'delayed' package in Julia was improved by the speaker to address the inability to solve their specific problem, incorporating functionality from the existing ordinary differential equation solvers.
  • 🔬 DDEs can exhibit richer dynamical structures, such as chaotic behavior, even in scalar cases, which is not possible with ODEs unless there are at least three components.
  • 📝 The formulation of DDEs in Julia's 'delayed' package closely mirrors that of ODEs, but with the critical addition of dependence on past state values.
  • 🔄 The 'delayed' package uses a method of steps approach, leveraging the existing ecosystem of ODE solvers in Julia to iteratively solve DDEs by breaking them down into a sequence of ODEs.
  • 🚧 Challenges in solving DDEs include handling discontinuities and ensuring the solution's smoothness, which the 'delayed' package addresses by tracking discontinuities and using fixed point iteration.
  • 🔭 Future work for the 'delayed' package includes implementing Anderson acceleration to speed up fixed point iterations and conducting more extensive benchmarking.

Q & A

  • What is the main research topic of the speaker at Uppsala University?

    -The speaker is a PhD student at Uppsala University, and their main research topic is about uncertainty in deep learning.

  • What was the initial problem the speaker faced during their master's project?

    -The speaker faced issues with simulating trajectories for two different models formulated as delay differential equations, which led to negative concentrations and unreliable simulations.

  • Why did the speaker choose to work with Julia instead of MATLAB for solving differential equations?

    -The speaker chose Julia because they had heard about its great ecosystem for solving differential equations and encountered issues with MATLAB that they did not attempt to fix.

  • What is a delay differential equation and how does it differ from an ordinary differential equation?

    -A delay differential equation is an equation in which the derivative can depend on past values of the state, unlike ordinary differential equations where the derivative only depends on the current time and state.

  • Can you provide an example of a delay differential equation?

    -An example given in the script is Hutchinson's equation, which models population growth with a delay, taking into account resources available at a previous time point.

  • What are some challenges in solving delay differential equations compared to ordinary differential equations?

    -Challenges include the need for a history function instead of just an initial condition, the potential for discontinuities in the solution, and a richer dynamical structure that can exhibit chaotic behavior even in scalar cases.

  • How does the DelayDiffEq package in Julia handle the solution of delay differential equations?

    -The DelayDiffEq package uses a method of steps approach, leveraging the existing ecosystem of ordinary differential equation solvers in Julia by setting up a dummy solver and wrapping the history function to evaluate the solution at any time point.

  • What is the significance of tracking discontinuities in delay differential equation solvers?

    -Tracking discontinuities ensures the correct level of smoothness in the solution and helps solvers hit discontinuities accurately without stepping over them, which is crucial for the accuracy and efficiency of the solution.

  • How did the speaker and their team improve the efficiency of solving state-dependent delay differential equations?

    -They improved efficiency by implementing fixed point iteration for state-dependent delays and updating the method for tracking discontinuities, which allowed for better use of stiff solvers from ordinary differential equations.

  • What are some future improvements planned for the DelayDiffEq package?

    -Future improvements include the potential use of Anderson acceleration to speed up fixed point iterations and more extensive benchmarking to further refine the solver's performance.

  • Can the speaker provide an example of how to specify a delay differential equation problem in Julia?

    -Yes, the speaker can provide an example, which involves specifying a history function, initial values, and the timespan for integration, similar to how ordinary differential equations are specified in Julia.

  • How does the speaker plan to demonstrate the solution of a delay differential equation in Julia?

    -The speaker mentioned working on a special branch to implement Anderson acceleration and is willing to live code the problem after precompiling, to show how the problem is solved in Julia.

Outlines

00:00

📚 Introduction to Uncertainty in Deep Learning and Delay Differential Equations

The speaker introduces themselves as a PhD student at Uppsala University, focusing on uncertainty in deep learning. They delve into their background in mathematics and medicine from Technical University in Munich and recount their initial encounter with delay differential equations (DDEs) during their master's project in mathematical biology. The speaker describes their experience with simulating models formulated as DDEs and the challenges they faced, which led them to contribute to the Julia differential equations package ecosystem. They set the stage for the presentation by expressing the need for a reliable simulation tool for parameter estimation and comparison of models, hinting at the improvements they made to the DDE package in Julia.

05:04

🔍 Exploring Delay Differential Equations and Their Characteristics

This paragraph delves into the nature of delay differential equations, contrasting them with ordinary differential equations (ODEs). The speaker explains that DDEs allow the derivative of a function to depend on past values, which is particularly useful in modeling real-world phenomena where changes do not occur instantaneously, such as in epidemiology or population growth models. The paragraph introduces the concept of constant and time-dependent delays, as well as neutral delay differential equations. The speaker also discusses the challenges in solving DDEs, such as the need for a history function instead of just an initial condition and the potential for discontinuities in the solution. They provide an example of a logistic growth model and its delayed counterpart, highlighting the complexities introduced by the delay.

10:09

📉 Challenges and Dynamics of Solving Delay Differential Equations

The speaker discusses the differences between solving ordinary differential equations and delay differential equations, emphasizing the need for a history function and the potential for discontinuities in the solution. They highlight that even if the initial function and model are smooth, discontinuities can arise, which propagate through time, affecting the solution's dynamics. The speaker also touches on the richer dynamical structure of DDEs, which can exhibit chaotic behavior even in scalar cases, unlike ODEs. They provide a visual example of a simple DDE with constant delays and its resulting discontinuities over time. The paragraph concludes with a brief mention of how DDEs can be formulated in Julia, drawing parallels to the formulation of ODEs.

15:11

🤖 Leveraging Julia's Ecosystem for Solving DDEs

The speaker outlines the approach to solving delay differential equations using Julia's ecosystem, which includes a variety of algorithms for ordinary differential equations. They describe the method of steps, which involves iteratively solving a sequence of ODEs, and how this can be applied to DDEs with constant delays. The speaker also explains how the existing functionality in Julia's ordinary differential equation (ODE) package can be utilized for solving DDEs, by setting up a dummy solver and using the initial function provided by the user. They highlight the importance of updating the solution and solver at each time step to maintain an accurate history function for the DDE.

20:11

🛠 Addressing Discontinuities and Efficiency in DDE Solvers

This paragraph addresses the challenges of handling discontinuities and ensuring efficiency in delay differential equation solvers. The speaker explains that ordinary differential equation algorithms assume a smooth solution, but discontinuities can occur, which requires special handling. They discuss the use of fixed point iteration for small delays and the tracking of discontinuities up to the order of the solver. The speaker also mentions the recent improvements made to the DDE solver in Julia, which allows for more efficient handling of state-dependent delays. They conclude with an example of how using stiff solvers from the ODE package can significantly improve the simulation of a DDE model.

25:12

🚀 Future Enhancements and Contributions to the DDE Solver

The speaker wraps up the presentation by discussing future enhancements to the delay differential equation solver. They mention the potential use of Anderson acceleration to speed up fixed point iterations and the need for more extensive benchmarking. The speaker acknowledges the contributions of others to the development of the DDE solver and expresses gratitude for the collaborative efforts. They also hint at the possibility of live coding an example and discuss the potential for stochastic delay differential equation solvers, indicating that this is an area of interest for future development.

30:13

🔗 Closing Remarks and Future Collaborations

In the final paragraph, the speaker expresses their excitement about meeting in person after years of online interactions and hints at the potential for future collaborations, especially in the area of neural differential equations. They also touch on the topic of stochastic delay differential equations and the possibility of contributing to their development. The speaker leaves the audience with a sense of anticipation for future advancements in the field and the potential for continued collaboration.

Mindmap

Keywords

💡Uppsala University

Uppsala University is an institution of higher learning located in Uppsala, Sweden, known for its strong emphasis on research and academic excellence. In the video, the speaker is a PhD student at this university, which sets the context for their academic pursuits and research focus on uncertainty in deep learning.

💡Deep Learning

Deep Learning is a subset of machine learning that involves artificial neural networks with multiple layers to learn and model complex patterns in data. The speaker's research on uncertainty in deep learning suggests they are exploring how to make these models more robust and reliable by understanding and managing the inherent uncertainties in their predictions.

💡Delayed Differential Equations

Delayed Differential Equations (DDEs) are a type of differential equation where the derivative of a function at a certain time depends not only on the current state but also on past values. The video's theme revolves around solving these equations, which is a complex task due to their nature of involving past states, as opposed to ordinary differential equations.

💡Julia

Julia is a high-level, high-performance programming language for technical computing. The speaker discusses their work with the Julia differential equations package ecosystem, highlighting its capabilities for solving complex mathematical problems, including DDEs.

💡Ordinary Differential Equations (ODEs)

Ordinary Differential Equations are equations that involve functions of one independent variable and its derivatives. The script mentions ODEs as a basis for comparison with DDEs, emphasizing the additional complexity introduced by the delay in DDEs.

💡Pharmacodynamics

Pharmacodynamics is the study of the biochemical and physiological effects of drugs on the body and the mechanisms of drug action. The script mentions that ODEs are used in pharmacodynamics, which is an application area where differential equations model the behavior of drug concentrations in the body over time.

💡Stiff Solvers

Stiff solvers are numerical methods designed to handle differential equations where there are large differences in the rates of change of the solution's components. The speaker discusses the use of stiff solvers from the Julia package to simulate their model, indicating their importance in solving problems with rapid changes.

💡Parameter Estimation

Parameter estimation is the process of finding the values of parameters in a model that best fit the observed data. The speaker mentions wanting to do parameter estimation as part of their work with models formulated as DDEs, which is crucial for validating and refining the models.

💡Anderson Acceleration

Anderson Acceleration is a method used to accelerate the convergence of iterative processes, such as fixed-point iterations. The speaker expresses interest in implementing Anderson acceleration to improve the efficiency of solving DDEs, indicating a future direction for enhancing the Julia package's capabilities.

💡Fixed Point Iteration

Fixed Point Iteration is a numerical method used to find the roots of equations by iteratively applying a function until convergence. The script discusses using fixed point iteration to solve DDEs when the delay is smaller than the time step, which is a technique to handle the complexities introduced by the delay.

💡Stochastic Delay Differential Equations

Stochastic Delay Differential Equations (SDDEs) are an extension of DDEs that incorporate randomness or uncertainty into the model. The speaker hints at the desire to build solvers for SDDEs, indicating a broader interest in extending the capabilities of the Julia package to handle more complex models involving randomness.

Highlights

Introduction of the speaker as a PhD student at Uppsala University researching uncertainty in deep learning.

The speaker's work on a package for solving delayed differential equations during their master's studies at Technical University in Munich.

Initial issues encountered with simulating trajectories for models formulated as delay differential equations.

Contribution to the Julia differential equations package ecosystem by opening issues and pull requests.

Explanation of the difference between ordinary differential equations and delay differential equations.

Characteristics of delay differential equations, including their dependence on past values of the state.

Challenges in solving delay differential equations compared to ordinary differential equations.

The need for a history function or initial function for delay differential equations, as opposed to just an initial condition.

Potential discontinuities in delay differential equations due to difficulties in enforcing equal left and right derivatives at the initial time point.

Rich dynamical structures of delay differential equations, including the possibility of chaotic behavior even in scalar cases.

Formulation of delay differential equations in Julia, leveraging the existing ecosystem for ordinary differential equations.

Use of a dummy solver to handle the history function and previous states in delay differential equations.

Addressing discontinuities in delay differential equations by tracking them up to the order of the solver.

Innovations in handling state-dependent delays by performing fixed point iteration and using extrapolation.

Efficient simulation of models with delay differential equations using stiff solvers from the ordinary differential equation package.

Future plans for the delay differential equation package, including the potential use of Anderson acceleration and more extensive benchmarking.

Invitation for the speaker to contribute to the development of stochastic delay differential equation solvers.

Transcripts

play01:03

thank you very much for this

play01:05

introduction and hi everyone I guess you

play01:10

can hear me it feels like like

play01:12

everything is fine and setup yeah as you

play01:16

already heard I'm at the Uppsala

play01:20

University at the moment I'm a PhD

play01:22

student there doing research about

play01:25

uncertainty a very deep learning and

play01:29

that might sound a bit strange since the

play01:32

topic of my my presentation today is

play01:35

solving delayed differential equations

play01:37

and so I think I have to explain that a

play01:41

bit more I mainly worked on this package

play01:48

or started to work at least at the end

play01:52

of my master studies at the Technical

play01:54

University in Munich so before I went

play01:58

into Salah and started my PhD there I

play02:01

had been studying mathematics and

play02:05

medicine in Munich and so at the end of

play02:09

my master studies when I had to pick a

play02:13

topic for my Master's project and then I

play02:17

picked something a bit more applied from

play02:19

mathematical biology and basically the

play02:23

details are not interesting here now but

play02:27

it was about comparing two different

play02:29

models and these models were formulated

play02:32

as delay differential equations so the

play02:38

first thing when I started my work on

play02:41

this most project the first thing I did

play02:44

was take some parameter guesses that

play02:48

some other people had estimated for one

play02:52

of those two models and tried to

play02:55

simulate a trajectory and that's what

play03:01

happened basically so that's the

play03:04

earliest github issue I think I could

play03:09

find that I opened at the Julia

play03:12

differential equations package ecosystem

play03:16

and here I already fine-tuned that a lot

play03:19

so I try to incorporate the fact that

play03:22

this some concentration that it cannot

play03:24

be negative and try to adjust the step

play03:29

sizes and tolerance is a bit but as you

play03:33

can see that's not something that you

play03:36

would like to to get in your simulation

play03:38

and and I mean I I also wanted to do

play03:42

parameter estimation and then with both

play03:46

models I want you to compare them I want

play03:49

you to run many of these simulations and

play03:51

they they should work reliably and so it

play03:54

felt like yeah there's something missing

play03:57

here and yeah that's why I opened this

play04:00

first issue and then I actually also

play04:05

tried to use MATLAB even though I wanted

play04:08

to use julia also because i had heard

play04:11

about this great ecosystem for solving

play04:14

the differential equations in julia and

play04:18

and also there I had issues so I

play04:21

immediately went back to you - Julia I

play04:24

didn't try to fix the issues in MATLAB

play04:26

and instead I started to open issues and

play04:29

then also pull requests after some time

play04:32

and so I started to contribute - yeah

play04:37

the delay differential equation package

play04:40

which was existing at that time but

play04:42

apparently could not solve my problem

play04:44

and so now today in this talk I want to

play04:47

to explain basically I yeah what you can

play04:51

do with this package right now on how I

play04:53

was able to solve these issues and yeah

play04:59

but first before I do that I I quickly

play05:03

explain able to delay differential

play05:06

equations actually are and some of the

play05:08

characteristics which makes it a bit

play05:11

more difficult maybe to to

play05:15

solve than ordinary differential

play05:17

equations so yeah let's start with

play05:21

ordinary differential equations which I

play05:23

guess more people are familiar with or

play05:25

have even used the player Julia package

play05:29

simulating them I mean for example in

play05:35

the keynote talk today we heard that

play05:38

they're used in pharmaco dynamics and

play05:42

also in many other scientific areas

play05:46

differential equation models and

play05:48

especially also ordinary differential

play05:50

equation models are used I think there

play05:53

are two nice things that you can

play05:57

incorporate in this function f some

play06:01

prior assumptions some prior knowledge

play06:02

but still you have don't have to specify

play06:05

the dynamics of X explicitly and so but

play06:10

there is some more or less implicit

play06:14

assumption I mean it's quite explicit

play06:16

from from this from this formulation but

play06:19

that this the derivative at the time

play06:23

point can only depend on the current

play06:26

time point and the state at the current

play06:29

time but for example in biology many

play06:35

changes do not occur instantaneously

play06:38

for example thinking about a pity on me

play06:41

epidemiology then some yeah

play06:45

disease is there you have an incubation

play06:47

period or also if think about

play06:51

reproduction and then birth then yeah it

play06:54

takes some time for human nine months

play06:57

usually until yeah you're actually born

play07:01

and it has an effect on the birth rate

play07:05

so yeah for animals for example you

play07:08

could think that the birth rate depends

play07:11

on how many resources were available at

play07:14

the time point for example nine months

play07:17

earlier and that's it cannot be captured

play07:20

by this form of differential equations

play07:23

so delay differential equations then are

play07:26

basically ordinary differential

play07:28

patience in which this derivative can

play07:31

also depend on past values of the state

play07:35

and so very simple form of delay

play07:40

differential equations you can see here

play07:42

there you have a dependence on the state

play07:48

at time t minus tau and now this tau

play07:53

here is a constant so that's called a

play07:56

constant delay differential equation but

play07:59

it could also be time dependent for

play08:02

example or even state dependent and then

play08:08

we can make it yeah even more

play08:13

complicated or extended and that

play08:16

multiple such delays and then you can

play08:20

also let the derivative depend on values

play08:25

of the derivative at past times and

play08:29

that's then called the neutral delay

play08:33

differential equation and so mostly in

play08:35

this talk when I when I formulate this

play08:37

in the next slide then I will not

play08:41

discuss a neutral delay differential

play08:42

equations to keep it a bit simpler and

play08:44

more compact to make this a bit more

play08:50

concrete maybe one kind of standard

play08:55

example from population growth models so

play08:59

if n denotes the size of a population at

play09:05

the end of T the size at the current

play09:07

time T then a very simple model is the

play09:12

logistic growth model and here basically

play09:16

the underlying assumption is just that's

play09:18

the change in the population size is

play09:22

proportional to to the size of the

play09:25

population and the available resources

play09:28

at that time and now as I said before

play09:32

you could think that actually it should

play09:35

not depend on the available resources at

play09:38

the current time point but at the

play09:41

previous time point and that's exactly

play09:44

what modeled Boyle also called

play09:49

Hutchinson's equation which is a delay

play09:52

differential equation with born

play09:54

constantly and the only difference to

play09:57

the logistic growth model is that in

play10:01

this term you have the delay appearing

play10:08

so now that seems like like I mean so

play10:13

there is an ordinary differential

play10:15

equation and a very similar delay

play10:17

differential equation you could think

play10:19

that ordinary differential equations and

play10:21

delay differential equations are very

play10:23

similar but there are some things that I

play10:26

want to discuss now are quite different

play10:28

for ordinary differential equations and

play10:31

delay differential equations which can

play10:33

also affect how we formulate the problem

play10:35

in delayed effect and also how we can

play10:38

solve it later on so first of all if you

play10:43

want to simulate an ordinary

play10:44

differential equation I want to set up

play10:46

the initial value problem then you need

play10:49

an initial condition so an initial value

play10:54

at the initial time point but for delay

play10:58

differential equations usually you need

play11:00

a whole function the so called history

play11:02

function or initial function that you

play11:06

have to specify if you want to need to

play11:10

compute the solution a second thing is

play11:15

that actually even if your initial

play11:18

function is smooth and also function

play11:23

after your model is say is smooth then

play11:27

usually there exists discontinuities

play11:29

because it's very difficult to enforce

play11:32

that the left and right derivative are

play11:37

at the initial time point are equal and

play11:41

by this formulation so usually you have

play11:43

at least a jump derivative as jump

play11:46

discontinuity of the derivative at the

play11:49

initial time point and yeah that has

play11:53

some consequences

play11:55

because of the lilies this discontinuity

play11:57

is actually propagate in time so you not

play12:00

only get the discontinuity at the

play12:02

initial time point but then also at

play12:04

later time points and I won't discuss

play12:08

this here in detail but just some visual

play12:13

plot for this so basically here we we

play12:16

have very simple delay differential

play12:19

equation with two constant delays

play12:21

one-third and zero point two and the

play12:24

initial function that's zero for all

play12:28

negative values and one at the initial

play12:32

time point t equals zero so we have

play12:35

actually here a jump discontinuity at

play12:37

the initial time point and then you can

play12:39

see that you get these continuities in

play12:43

the derivative at a time point zero

play12:48

point two and time point one third as we

play12:51

would expect it and the last thing I

play12:56

want to mention is that also the

play12:59

dynamical structure of delay

play13:01

differential equations can be much

play13:03

richer so for ordinary differential

play13:06

equations for example chaotic solutions

play13:10

only exist if there are at least three

play13:12

components and varies for delay

play13:15

differential equations there you can

play13:17

observe this chaotic behavior even in

play13:20

the scalar case so again an example this

play13:26

is a model of circulating blood cells I

play13:31

won't discuss that in detail but that

play13:33

has been used also for benchmarking

play13:34

delay differential equation solvers in

play13:36

the past so we also have done that in a

play13:39

repository and for a certain set of

play13:43

parameter values you actually get this

play13:46

chaotic behavior already in the for this

play13:50

color model and now since since the

play13:56

topic of the talk is actually how to

play13:57

solve these delay differential equations

play14:00

let's start again with the no sorry I

play14:05

missed one slide

play14:07

before we start to solve them

play14:11

let's first shortly mention how you can

play14:13

formulate them in a delayed effect

play14:18

that's mainly to show how similar you

play14:23

can actually in this package basically

play14:26

translate encode the mathematical

play14:28

formulation in julia so here for this

play14:34

model you specify the model function

play14:38

which depends on the history function so

play14:42

here the value at time t minus 1 and

play14:46

then you specify the initial function

play14:49

which is just 1 in this case you specify

play14:52

the initial value and for which timespan

play14:57

you want to integrate your problem and

play15:01

so this is very similar to how you do it

play15:04

for ordinary differential equations if

play15:06

you have worked with the ordinary

play15:07

differential equation solver in julia

play15:10

and the only main difference is actually

play15:12

that we not only have dependence on the

play15:16

stage but on this previous values and

play15:19

this changes the formulation a bit

play15:28

[Music]

play15:36

yeah because this is this H function

play15:39

that's way H stands for the the whole

play15:44

solution the the whole function and that

play15:47

you can evaluate at every time point

play15:49

then basically here we pause the whole

play15:52

function object and then here in this

play15:56

case which is well I want to evaluate it

play15:58

at time point t minus one and so the

play16:02

only thing we do is basically evaluate

play16:04

it it may depend on the parameters but a

play16:09

valid just at time point t minus one so

play16:14

basically by evaluating this we get the

play16:17

state at time t minus 1 and u that's

play16:23

just the current state so if we would

play16:24

have a term X of T here in the equation

play16:28

then you would have some you appearing

play16:30

here in this formulation okay I think I

play16:39

continue for now and then we can discuss

play16:41

that later maybe so if you if we

play16:46

consider this very simple delay

play16:47

differential equation we won't

play16:49

constantly than one approach to solve

play16:51

that even analytically is to iteratively

play16:54

solve a sequence of ordinary

play16:57

differential equations because with the

play17:00

one constant delay basically for the

play17:02

first interval from your initial time

play17:05

point to the initial time point plus tau

play17:07

plus the delay there you've given all

play17:10

the information so you can basically

play17:14

plug in the initial function and this

play17:17

your system only depends on the time the

play17:20

current time and the current state

play17:21

anymore and then you can step by step

play17:25

that's why it calls method of steps you

play17:27

can build up your solution and basically

play17:31

just by concatenating these solutions of

play17:34

the ordinary differential equation

play17:36

problems you can solve the delay

play17:38

differential equation and now that's

play17:41

nice both theoretically because then

play17:44

you can transfer theorems from ordinary

play17:47

differential equation theory to delay

play17:51

differential equations and also I mean

play17:55

we considered a very simple example but

play17:56

this holds even for state dependent

play17:58

delays at law as long as there is a

play18:01

strictly a they're strictly greater than

play18:04

zero so you can find a minimal step that

play18:07

you can take and now that of course

play18:11

motivates the the idea of just taking

play18:15

all this huge set of native algorithms

play18:19

implemented in julia that we have an

play18:21

ordinary defect to solve ordinary

play18:23

differential equations and i mean there

play18:27

we have solvers for stiff and non stiff

play18:30

problems classic algorithms ones from

play18:33

recent research and also I mean very

play18:35

important if we want to evaluate the

play18:38

solution at previous time points and we

play18:40

also have interpolations of the

play18:43

solutions so we get the solution not

play18:45

only a discrete time point and we get

play18:49

some additional support for for example

play18:52

dual numbers which allow us to use

play18:56

automatic differentiation and yeah there

play19:00

is a whole ecosystem of other packages

play19:03

that we can use for parameter estimation

play19:06

for example or something more recent

play19:09

these neural Oh des which you can

play19:11

combine machine learning and ordinary

play19:14

differential equations and so the the

play19:18

basic set up in this package is that we

play19:21

just try to use the functionality that's

play19:23

already existing an ordinary defect so

play19:26

we are we set up a dummy solver for

play19:29

solving this problem an OD e problem

play19:35

with this function and that's basically

play19:40

it just so that it's well-defined

play19:41

all the time we will never really solve

play19:44

this problem that's why it's called a

play19:45

dummy solver and then we just take the

play19:50

initial function that was in the

play19:52

mathematical formulation and that it's

play19:53

provided by the user we take the

play19:56

solution of this dummy solver

play19:58

and this solver that we constructed and

play20:01

wrap this in instruct and by doing this

play20:09

that the main purpose is that we can

play20:11

then evaluate this function at any time

play20:15

point and get kind of with the previous

play20:19

states at any time point so basically

play20:21

instead of working directly with the

play20:24

user provided history function we wrap

play20:28

it so that we can add to it by by

play20:33

changing this solution and then we just

play20:38

create our the OD solver that we

play20:41

actually use which yeah then uses this

play20:46

history function instead of the initial

play20:49

function that was provided by the user

play20:52

and then we solve the this OD a problem

play20:56

and in every step we ensure that we

play20:59

update the solution accordingly and the

play21:03

solver as well of course and so in that

play21:06

way we at every time step we we have

play21:10

some some dance history some dance

play21:13

solution already readily available that

play21:16

we can evaluate and use for computing

play21:19

the next time step so now the question

play21:25

is are we done and of course not because

play21:29

there are some issues so first of all we

play21:33

have to deal with these discontinuities

play21:34

that I mentioned in the beginning

play21:36

because the most ya ordinary

play21:41

differential equation algorithms they

play21:43

assume that the solution is sufficiently

play21:45

smooth in each integration interval and

play21:49

I mean quite intuitively if you have a

play21:52

jump discontinuity and just just try to

play21:57

integrate over that and then you get to

play21:59

smooth interpolation in the end then

play22:01

this probably is not very correct then

play22:07

also I mean now we have those time steps

play22:11

that we

play22:11

can take and move forward but actually

play22:14

if these time steps are very small

play22:16

compared to the whole integration

play22:17

interval then that will be very

play22:20

inefficient so we probably don't want to

play22:23

do that

play22:23

actually and then also I mean it works

play22:27

for state dependent delays but only for

play22:28

some of them so yeah it does not work

play22:32

for arbitrary delays and so what we do

play22:36

in delayed effect of course we took

play22:38

inspiration from what has been done

play22:40

before in literature and try to apply

play22:44

that to our setting here we track the

play22:49

discontinuities up to the order of the

play22:51

solver that's to ensure on that that we

play22:55

have the correct kind of level of

play22:58

smoothness and there are some existing

play23:01

functionality actually an ordinary

play23:03

defect that we can use to ensure that we

play23:06

actually hit those discontinuities and

play23:08

not step over one if the delay is

play23:12

smaller than the time step then we

play23:15

perform fixed point iteration so that

play23:16

means first by by using this dummy

play23:20

solver here we get not only some

play23:24

interpolation but we can also use

play23:26

extrapolation to do kind of yeah a

play23:32

future time points and so the first time

play23:36

we we take the the next step and we

play23:40

would like to evaluate our history

play23:42

function at the time point that is that

play23:45

we haven't computed yet that we just use

play23:48

that extrapolation and compute the first

play23:50

guess of how the the solution continues

play23:54

and then we iteratively update that but

play23:57

by using our first and second and third

play24:01

iteration and for the dependent delays

play24:04

there we took some some inspirational so

play24:07

from from radar five I'm not sure about

play24:10

the pronunciation by the existing a

play24:12

delayed differential equation solver in

play24:14

Fortran and only if a step is rejected

play24:18

and we try to point dependent delays in

play24:20

the current time step and that was a

play24:21

change that we made

play24:23

roughly two weeks ago on that really

play24:25

helped you to solve some state-dependent

play24:28

to delay differential equations a lot

play24:30

more efficiently and now I just wanted

play24:32

to show now in the end how actually

play24:35

being able to use the stiff solvers from

play24:38

ordinary different helped to me to

play24:41

simulate my model that I had am a

play24:45

monster is this is so here on top you

play24:47

can see non-stiff solvers and yeah that

play24:52

doesn't really break well but here on

play24:55

the bottom you see that I can get a nice

play25:00

proper simulation if I make use of the

play25:04

stiff solvers and then also I don't want

play25:07

to discuss this model but this is a

play25:08

standard model that was used for

play25:10

benchmarking for other delay

play25:11

differential equation solvers and by

play25:13

yeah with this change that we made for

play25:16

how we track the disk dependent delays

play25:20

some weeks ago we're now also able to

play25:23

compute the solution to this problem

play25:27

even though you can see there is some

play25:29

some things happening on a very small

play25:32

scale and on a much larger scale some

play25:34

order

play25:35

yeah and then I'm at the end of my

play25:38

presentation and basically yeah

play25:43

we most of the functionality from

play25:44

ordinary different we try to and very

play25:47

able to also add to you to the delay

play25:50

differential equation solver by mostly

play25:53

relying on the already existing

play25:54

implementation and ordinary defect and

play25:58

there is also a functionality available

play26:01

in external packages and yeah future

play26:05

things that we would like to do and this

play26:07

is on our list since I don't know 2017 I

play26:10

think is try to use Anderson

play26:14

acceleration to maybe speed up these

play26:16

fixed point iterations and also do more

play26:20

extensive benchmarking and yeah then I

play26:24

just wanted to thank all the

play26:25

contributors to delayed effect and of

play26:28

course Chris and you

play26:31

were also here today and contributed a

play26:35

lot and not only to delayed effect but

play26:37

also of course to the other packages and

play26:39

especially ordinary defect which will

play26:41

rely on thank you very much house nice

play27:00

talk so how do you code that the first

play27:04

example you had with the step

play27:05

discontinuity how do you actually write

play27:08

that in Julia you mean how I specify

play27:12

this problem yeah so if we go back just

play27:16

quickly go back to this unfortunately it

play27:20

seems it's not very clearly visible

play27:21

these code fragments but basically here

play27:25

we specify both a history function and

play27:29

the initial values actually that's kind

play27:32

of easy because we just specify that the

play27:35

history function would be zero and the

play27:38

initial value would be born because did

play27:41

they yeah but that's that's implicitly

play27:45

than a given by because the day for

play27:48

where we start the integration that's

play27:50

this use 0 and for all the other post

play27:55

time points we use the age but you could

play27:59

of course also here just branch on on

play28:02

the time point t if you specify this if

play28:05

you have a more complicated or at time

play28:06

point t minus 1 then we could jump then

play28:10

you could write if T is less than minus

play28:14

1 I want to get 0 and otherwise I want

play28:17

to get yeah 1 how do you detect the

play28:25

discontinuity when you're doing the

play28:26

integration how do you know there's a

play28:27

discontinuity there yeah so if there is

play28:29

a discontinuity in the initial function

play28:31

then the user should specify it because

play28:33

otherwise we don't know about it I mean

play28:35

here usually we assume if nothing is

play28:38

specified that there is a jump

play28:40

discontinuity at the initial time point

play28:42

I mean it usually changes the order

play28:44

of discontinuities that we track only

play28:47

bye-bye yeah one because usually you

play28:51

have a discontinuity in the derivative

play28:53

so if we have a jump discontinuity at

play28:55

the initial time point that's just one

play28:57

order more that we have to track that's

play29:01

not much more not very inefficient so

play29:07

but the user can also specify if there

play29:10

is some other discontinuities if they

play29:11

have a specific order yeah that's about

play29:14

that's something I didn't discuss and

play29:16

that's explained in more detail

play29:18

hopefully in the documentation

play29:35

was the graph you showed for that

play29:37

problem and I asked about actually a

play29:39

real solution from the package and or is

play29:44

it like analytical or something this

play29:46

year that's yeah and that's the plot you

play29:48

mean yeah that's just analytical

play29:50

solution if you solve it with a package

play29:52

would it look the same oh yes or would

play29:56

would it be rounded it yeah yeah because

play30:02

we then specify would you like to live

play30:05

code that problem I'm working on a

play30:10

special branch right now because of you

play30:12

I try to implement this Anderson

play30:14

acceleration or changing the fixed point

play30:16

iteration so probably I would have to

play30:18

pre compile and and it would take some

play30:20

time but I I can do it afterwards and

play30:23

show you so nice seeing you finally

play30:27

after all these years and I'm hoping

play30:30

that with all these things with neural

play30:32

differential equations we can really

play30:33

pull you back into the differential

play30:35

equation world after you come to ml but

play30:37

I'm kind of wondering so oh I want to

play30:39

get you on the spot to say yes to this

play30:41

because that people are wanting to see

play30:43

stochastic delay differential equation

play30:44

solvers you want to start helping to

play30:46

build that as well yeah I mean that's

play30:49

also on the agenda for quite some time

play30:51

at least there's an issue for it and

play30:53

yeah I think we were able to fix up the

play30:58

code a bit in the last week's so that

play31:00

hopefully that we didn't take too much

play31:03

time so I think that would be fun yeah

play31:05

see you next year

play31:15

you

play31:26

you

play31:30

I think this might be

Rate This

5.0 / 5 (0 votes)

Связанные теги
Delay Differential EquationsJulia ProgrammingAcademic ResearchNumerical MethodsPhD InsightsUppsala UniversityTechnical UniversityMathematicsBiology ModelsSimulation Techniques
Вам нужно краткое изложение на английском?