Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to...

37
Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview Introduction-Modelling Basic concepts to understand an ODE. Description and properties of ODE. Solving ODE. Vector spaces. Dynamic systems.

Transcript of Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to...

Page 1: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Ordinary differential equations

Introduction to Synthetic Biology

E NavarroA MontagudP Fernandez de CordobaJF Urchueguía

Overview

Introduction-ModellingBasic concepts to understand an ODE.Description and properties of ODE.Solving ODE.Vector spaces.Dynamic systems.

Page 2: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Modelling

Page 3: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

ModellingDescribing the behavior of a system.

How to do this?

Understand it.

Predict its future behaviour.

Be able to manipulate the system

Having knowledge of the system

Knowing physical laws

Using math as a working language to describe the system

What to take into account and what

not.

Simulation•A simulation is a set of equations that describes a system

• They do not need to have a solid conceptual background.

•The grade of trust of a simulation is not known when you try to apply it to different conditions

Page 4: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Modelling

By using some knowledge of physical processes involved in the system, a modeling strategy tries to describe the system.Could be less exact than a simulation.It is adaptable to different situations

2)(

2

00gttvxtyymF ++=→= &&

Why is a model useful?

It allows a better understanding of a system.It makes a system more predictableIt allows engineering the systemIt could drive the experimentsIt allows the control of a system.

Page 5: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Engineering cycle

http://openwetware.org/images/5/5b/Vincent_Rouilly_SynBio_Course_Topic_1.pdf

Ordinary differential equations

Page 6: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Introduction

Why should we use differential equations?

Whenever a deterministic relationship involving some continuously changing quantities (modeled by functions) and their rates of change (expressed as derivatives) is known or postulated.

Previous concepts

What is a function?

A function is a relation between two sets of elements

How is it represented in math?

)(: xfxf →

Page 7: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

3)( =tf

12)( += xxf

Page 8: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

2)2()( −= xxf

xexf =)(

Page 9: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

xxf log)( =

11

01

)(≥<

=xx

xf

Page 10: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

)()( ϕ+=TxAsenxf)()(

TxAsenxf =

K=1;τ=2;n=2

K=10;τ=2;n=2

K=1;τ=var;n=2

K=1;τ=2;n=variable

Page 11: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

K=1;τ=2;n=2

K=10;τ=2;n=2

K=1;τ=var;n=2

K=1;τ=2;n=variable

Functions of several variables

It is a function which depends on several variables:

Scalar: z=F(x,y)Vectorial:yi=Fi(xj) mxfn i

m

ℜ⎯⎯ →⎯ℜ )(

Page 12: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Linear function

A linear function is a function which fulfills:

)()()( ybfxafbyaxf

What is a derivative?

Having two variables, related by a function, the derivative givesthe variation of one of them when the remaining is changed

dttdf

ttfttf

t

)()()(lim0

Page 13: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Taylor series development

A serie is a summation of terms.The Taylor serie development of a function f(x) is the approximation of thisfunction by a power serie:

The error of a function is of n+1 order if wedevelop the power serie up to the n power.

)()(!

)('...)(!2

)('')(!1

)(')()( 12 nnn

aaa tatn

tfattfattfafxf

tt

edtde

tetf )(

Page 14: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview
Page 15: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview
Page 16: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview
Page 17: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

ntktf

1

)(

0

2

31

Page 18: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Remark

ααα sincos iei +=

The Taylor development makes to conclude that the complex exponential is equivalent to the sum of a sinus and a cosinus.

What is a differential equation?

What is an equation?Having a variable x, an equation express a mathematical relation between that variable and some other which are known.

{ }( )...,, 21λλxtfdtdx

=

t: variable

x: variable dependent

λi: parameters of the function

What is a differential equation?Equation which relates a function with its derivates.

If the function f depends on more than one variable then the differentialequation is called partial differential equation(PDE)

Page 19: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

The solution of an ODE is a function x(t) which is defined but a constantand is unique.

In order to solve a differential equation, we should transform the problem in a problem in which we can integrate a function.

Integration is the opossite to derivation.If we substract infinitesimal terms in a derivative we perform sum of infinitesimal terms in an integral .

When we solve an indefined integral, there is a costant of integration that weshould fix using the conditions of the defined problem:

Kxgdxxf )()(

Solution of a differential equation

The solution of a differential equation is an equation which allows to know the value of the dependent variable as a function of the independent ones given the value of the dependent variable for adefined value of the independent one.

Initial conditions of the problem: the independent variable is the time.Contour conditions of the problem: the independent variable is another one.

X(t=0)

Y(t=0)

X(t)

Y(t)

Page 20: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Simple examples

dtdf Kttf )(

)()( tfdt

tdf

2)1(

)(

ttf

dtdf

Ketf t )(

)(2

2

tfdt

fd )sin()( 21 KwtKtf

2nd order

Types of differential equations

kxdtdx

dtxd =+2

2

kxdtdx =

kxdtdx

dtxd

=+2

2

1st order kxdtdx

= Linear

Non linear2kxdtdx

=

kxdtdx

=

)(tsenkxdtdx

+=

Autonomous

Non Autonomous

ODE

kyx

txyct

txy =∂

∂−∂

∂ ),(),( 22

2PDE

Page 21: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

How to solve a differential equation?

• In most of the cases this is not possible and several techniques have been developed to solve the problem in an approximated way.

• Some of these techniques are included in the branch of mathematics known as numerical methods

• In some cases there is a possibility of solving analytically the differential equation.

Linear diferential equations

A linear differential equation is:

)()(...)()(01

1

1 tgtfadt

tfdadt

tfda n

n

n

n

n

Y1(t)

Y2(t)

Y2(t)Y1(t) +α β

Solution!!

Solutions

Linear Superposition principle

Page 22: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Linear diferential equations

The problem is reduced to solve thecharacteristic equation

0... 01

1 zazaza n

nn

n

The general solution of the systemwill have the form:

tz

i

ietf )(

Real system

Non linear equations

Linear equations

Simulation

Non linear LinearLinearization

Page 23: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Linearization method

A function f(x) could be approximated by:

First order approximation or linearization:

)()(!

)('...)(!2

)('')(!1

)(')()( 12 nnn

aaa tatn

tfattfattfafxf

)()(!1

)(')()( 2tattfafxf a θ+−+=

Based on this there is a procedure to obtain a linear equation which has a similar behavior to the equations we want to solve, around some special points.

Practical issues of the LP

The working point should be close to an equilibrium point in such a way that the first order derivatives will be 0.The linear model will be more accurate near the equilibrium point.The equilibrium point should be selected as close as possible to the working point.

Page 24: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview
Page 25: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Numerical solution of ODE

We have come to know that there are solutions justfor a few ODE.The meaning of a derivative is the substraction ofvery close terms.If we do not have an exact solution of a differentialequation, we can try to obtain an approximatedsolution of it, substracting by hand these terms time and again.

Very stupid devices can perform very stupid operation but with an incredible

speed

Numerical solution of ODE

))(,()()()()()(' tythftyhtyh

tyhtyty +≈+→−+

))(;()(' tytfty = 00 )( yty =

• Later on an example of a very simple algorithm to solve numerically an ODE is given

We substitute the derivative term by its approximated value:

Selecting a proper value for h, we have a time step with the value t0=t0,t1=t0+h,…,tn=tn-1+h

);(1 nnnn ythfyy +=+

Page 26: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Numerical solution of ODE

This method is called explicit Euler method and it is one of the simplest methods to obtain the solution of ODE.The obtained solution is only an approximation to the real solution, and the goodness of the solution depends on the kind of the problem and on the selection of the different model parameters like h.Although the power of computing has increased a lot in the last years, there are too many problems which require many computing time to be solved.Always you should take care when you solve a problem numerically!!

Usefulness of differential equations

When describing systems, it is usually very useful to know not only the value of the variable but also the evolution of it.

AAM 022

2

xdtdxb

dtxd

2

2

dtxdmF

Page 27: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

An introduction to vectors andmatrix

What is a vector?

1. Any mathematic set of “things” whose sum gives us another “thing” ofthe set.

2. It is defined multiplication property between these “things” andnumbers.

In a more rigurous way 213 vvv

Base of a vector space

Minimum number of vectorswhich generate all the space

Dimension of the space

The number of vectors of thebase

Page 28: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Matrix

Roughly, it is a set of numbers

312231123

⎟⎟⎠

⎞⎜⎜⎝

⎛213321

Determinant of a square matrix

kjiijk aaaA 321ε=

Some matrix properties

dcba

dcba

⎟⎟⎠

⎞⎜⎜⎝

⎛++++

=⎟⎟⎠

⎞⎜⎜⎝

⎛+⎟⎟

⎞⎜⎜⎝

⎛dhcgbfae

dcba

hgfe

fdebhcgafdebfcea

dcba

hgfe

Page 29: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

dycxbyax

yx

dcba

0

0yx

yx

dcba

Eigenvalues and eigenvectors

Linearity

Calculation of eigenvalues

( ) 0=−→= vIAvvA rrr λλ

[ ] 0det =− IA λ

Page 30: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Systems of linear diferentialequations

As in standard algebraic equations, therecan be problems in which instead of a ODE we have a system of differential equations.If the system is linear we can apply all thedeveloped algebraic methods for vectorial spaces.A system of n ODE of n order is equivalentto a system of n+1 ODE of n-1 order

Example

24132

22111

fafadtdf

fafadtdf

2

1

43

21

2

1

ff

aaaa

dtdfdtdf

2

1

2

1

2

1

''

00

'

'

ff

dtdfdt

df

222

111

''

''

fdt

df

fdt

df

Page 31: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Dynamical system

A system that evolves with time is a dynamical system.

State variable: magnitudes whose evolution in time we want to know.Evolution variable: the state variables evolution as a function of them.Parameters: constant magnitudes of the system under certain conditionsEvolution laws: the relation between the state variables and the evolution variables.

Example

[ ][ ]

[ ] γβα +−

⎟⎠⎞

⎜⎝⎛+

= Y

KUdt

Ydn

1

1

Page 32: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Dynamical systems

We are going to describe autonomous systems, which fulfill the following form:

);( iiii fF

dtdf

Autonomous means not explicit dependence in time

Any ODE of order higher than 1 can be changed in anequivalent system of equations of first order

Cykdtdyk

dtydk =++ 012

2

2

)(21 tx

dtdx =

2

21102 )()(k

txktxkCdtdx −−

=

ytx =)(1

dtdytx =)(2

Change of variables

Page 33: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Phase space: It is a representation of the solution of a ODE in which f’ is represented against f. It represents all the possible states of the system.

Stability

•At this point a fundamental concept is the fix point or equilibrium point

0);(0 =→= iiii fF

dtdf α

Stability If all the solutions of a dynamical system which start out near an equilibrium point xeremain near xe, then xe is Lyapunov stable. Even more, if all the solutions which start out near xe converge to xe, then xe is asymptotically stable .

Page 34: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Stability

Linear systems

ii Af

dtdf

=

Re(λ)i>0: The systemwill be not stable

Re(λ)i<0: The systemwill be stable

Obtain eigenvaluesof A

Stability

Linearizable systems

);( iiii fF

dtdf ieiiiie

i ffffJfFdtdf

−=Δ→Δ+= );( α

As we are in a stable point F=0, the equation could be written as

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

∂∂

∂∂

∂∂

∂∂

=

n

n

n

n

n

fF

fF

fF

fF

J...

.........

... 1

1

1

Jacobian matrix

ii fJ

dtdf

Δ=The criteria are the same ones as for

linear systems

Page 35: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Stability

All these procedures are quite simple but here they are explained for very particular cases.

An study of the stability of a system is usually not so simple.

Several mathematically more accurate definitions have been done by mathematicians:

Stability in the sense of Liapunov

Stability in the sense of Lagrange

If we are working with nonlinear systems, the analysis turns into a more complicated one.

Sensibility

• Sensibility analysis is related not only to the dependence of the results of the model in the initial conditions but also in the value of the parameters.

• A sensitive analysis of a problem could give us information about:

- The influence in the system of the different parameters.

- The care we should take when determining the initial conditions of a problem.

- If a model of a system is useful to predict it or not.

- The influence of external perturbations.

Page 36: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Non linearity and Chaos

Why could Non linear systems be so complicated?

The linear property )()()( ybfxafbyaxf

This property states that if we introduce a small variation in the system the system, in

principle, do not change too much

But if we introduce other kind of dependences like product or power laws, this property is not valid. Consequently, small changes could produce very different behaviours of the system.

Non linearity and Chaos

Chaos does not mean randomness in a system, chaos means a determined system but very difficult to be predicted.

dx/dt = s ( y - x ) dy/dt = r x - y - xzdz/dt = xy - b z

http://to-campos.planetaclix.pt/fractal/lorenz_eng.html

Page 37: Ordinary differential equations - Amazon S3 · Ordinary differential equations Introduction to Synthetic Biology E Navarro A Montagud P Fernandez de Cordoba JF Urchueguía Overview

Bibliography

Elementary Differential equations. CH Edwards, DE Penney. Prentice hall.Introduction to dynamical systems: Theory, models and applications. DG Luenberger.Wiley.Calculus, Vol. 1: One-Variable Calculus with an Introduction to Linear Algebra. T Apostol. Wiley