continous system: differential equations deterministic models derivatives instead of n(t+1)-n(t)

Post on 26-Dec-2015

216 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Continous system: differential equations

Deterministic models

derivatives instead of n(t+1)-n(t)

n(t)Rn(t))n(ttrndt

tdn 1 compare )(

)(

)n(Rn(t)netn trt 0 )0()(

Determine the equation Decide what have an effect on

the system Determine whether the

parameters are positive or negative, i. e. give growth or reduction

Determine whether the parameter is linear or nonlinear in relation to your entity (often population density or amount of a compound)

Population xrx

growth

Population xbx

birth

-dx

deaths

i immigration

Determine the equation What act on the system,

entity: sign, constant or linear/nonlinear relation: rx is positive, linear

What act on the system, entity: sign, constant or linear/nonlinear relation: bx, positive, linear dx, negative, linear i, positive, constant

Population xrx

tillväxt

Population xbx

birth

-dx

deaths

i immigration

)()(

trxdttdx

)()()(

itxdbdttdx

differential equations, part 1 Linear differential equations Separable equations System of linear differential

equationerchap 5.1-2

Using numerical methodschap 5.4

What is differential equations?

Derivatives in an equation, i e both y and y’ in the very same equation

Example: Both concentration and change of concentration

To solve this one how to maken some kind of integration, that is make y’ to y.

Note: most of the differential equations is not possible to solve analytically, one is referred to numerical solutions

Separable equations Separate variables to respective

right and left handside RHS resp LHS

Thereafter integrate each side:

tdttxtdx

ttxdttdx

)()(

)()(

tdttdxtx

)()(

1

Solution, general tdttdx

tx)(

)(1

1)(ln)()(

1Ctxtdx

tx 2

2

21

Cttdt

2

2

21

21

2

')(

)(

21

)(ln

t

Ct

eCtx

etx

Cttx

Solution, general and particular

221

')(t

eCtx

)()(

ttxdttdx

Has the general solution:

If we know that, for example, x(0)=4 then we can find C’ i e the particular solutionen

2

2

21

021

4)(

'' x(0),4)0(

tetx

CeCx

Separable equations, summarizing

Separate variables to RHS resp LHS

Integrate each side

rteCtnrdttntdn

trndttdn

')( )()(

)()(

rteC

Ktntn

Ktn

rdttdn

'1)( ????????? )()

)(1(

)(

Interprete differential equation

How will the solution, solution function, look like?

When the derivative is negative the function decrease positive the function increase zero the function is constant, at

equilibrium study )()

)(1(

)(tn

Ktn

rdttdn

Linear differential equation: integrating factor Linear regarding n(t), (regarding the solution

function we try to determine) These linear equations can hence be written as:

)()()()(

tQtntPdttdn

The Integrating factor is used to solve these kind of equations.

Integrating factor:

dttPet

)()(

solution by integrating factor

)()()()(

tQtntPdttdn

integrating factor:

dttPet

)()(

)()()(

1)( )()()()( CdttQt

ttnCdttQtttn

dttQt )()(If exists (solvable) you can determine a solution for n(t)

Example: integrating factor)()()(

)(tQtntP

dttdn integrating factor:

dttPet

)()(

)()()(

1)( CdttQt

ttn

23 2)()(

ttntdttdn

3231

)(tdtt

eet

CedttedttQttt

33

31

231

22)()(

Example:

33

331

31

31 2)(2

)(tt

teCCe

e

tn

solution:

Maple: program that finds analytical solutions

CedttedttQttt

33

31

231

22)()(

int(exp((1/3)*(t^3))*(2*t^2),t);

Uses the same tehnique as us, that is a database. But its in the computer instead of in our heads.

Example: integrating factor)()()(

)(tQtntP

dttdn integrating factor:

dttPet

)()(

)()()(

1)( CdttQt

ttn

1.02.0)(5.0)( tttn

dttdn tdt

t

eet 2)(ttt e.t-e.dttedttQt 3020)1.02.0()()(

Example:

tttt CetCe.t-e.e

tn 3.02.0)3020(1

)(solution:

Partial integration: derivating one term, integrating the other

Example: integrating factor

1.02.0)(5.0)( tttn

dttdn

Example:

tttt CetCe.t-e.e

tn 3.02.0)3020(1

)(general solution:

int(exp(t)*(0.2*t-0.3),t);Maple:

n(0)=0.1 och03.002.0)0( Cen

0.1=-0.3+C C=0.4

tettn 4.03.02.0)(Particular solution:

Homogenous linear differential equation with

constant coefficients Same kind of problem as in linear

recursive equations, chapter 1. Find the eigenvalues. Or rather the

roots of a polynom.

0... 11

1

10

xadtdx

adt

xda

dt

xda nnn

n

n

n

Example:062

2

xdtdx

dt

xd Both the first and second derivative in the eq.

Eigenvalues and the character of the solution Solution is achieved by assuming

that the solutions is: Put in the equation

and determine

,0... 11

1

10

xadtdx

adt

xda

dt

xda nnn

n

n

n

tCetx )(tCetx )(

tCetx )(

0... 11

10 t

nt

ntntn CeaeCaeCaeCa

00,C iff ,0... 11

10 nnnn aaaa

Eigenvalues and the character of the solution

00,C om ,0... 11

10 nnnn aaaa

This is a polynom, find the roots!

Example: 062

2

xdtdx

dt

xd

2 ,3

00,C iff ,06

21

2

tt eCeCx 22

31

Initial values: x(0)=2, x’(1)=3

tCesolution x assume

tt eex 23

5

1

5

1 gives 3(1)x'2, with x(0)

Eigenvalues and the character of the solution

Particular solution:

062

2

xdtdx

dt

xd Initial values: x(0)=2, x’(1)=3

tt eex 23

51

51

tex 3

51For large t

If Im()=0Re()>0, exponential growth Re()<0, exponential decreaseRe()=0, constant

If Im()0Re()>0, increasing oscillations Re()<0, decreasing oscillationsRe()=0, oscillation

solution character

System of first order homogenous linjear differential equations with

constant coefficients

Couple a set of linear equations, for example two or more populations or ageclasses or . The populations have effect on each others growth, a linear effect.

Almost like ageclasses but the solutions is of et instead of Rt

Eigenvalues and character of the solution

dycxdtdy

byaxdtdx

dc

baA

Determine eigenvalues, 1 and 2 as well as eigenvectors, v1 and v2

tt

tt

evCevCy

evCevCx21

21

)2()2(

)1()1(

2211

2211

You must have an initial value (x,y) to calculate C1 och C2

Eigenvalues and the character of the solution

Calculate eigenvalues, 1 and 2

•If the dominating eigenvalueis positive both x and y increase regardless of initial value The eqilibrium, which is (0,0), is then a source

•If both eigenvalues are negative both x and y decrease regardless of initial value.

•The equlibrium, (0,0), is then a sink

See page 260 for further definition to make from the eigenvalues (if complex etc)

The character of the solution

•Generallly: for linear systems all variables either increase or decrease exponentially except in few exceptionally cases.

•Hence, a model that deals with a system that is robust and stable ought to be expressed as a nonlinear system

Most equations can be approximated with linear

functions over a short interval equations that are possible to derivate,

that is continous over an interval, can be approximated with a Taylor expansion. Using the derivatives

The first tem of the Taylor expansion is a linear term and hence it possible to approximate

The interval is smaller the larger derivative

numerical solutions Most differential equations is not possible to

solve analytically. One have to solve it by numerical methods Euler method is a way to make a diff ekv to a

difference equation with appropriate step-length

With more refined methods, like Runge Kutta, uses a set of derivatives at each point. In this way the direction of the solution is improved for each step,

Matlab: numerical solutions [t,y] =ode45(’function',timeinterval,initialvalues);

Create a m-fil rigid.m

function dy = rigid(t,y)

dy = zeros(3,1); % a column vector

dy(1) = y(2) * y(3);

dy(2) = -y(1) * y(3);

dy(3) = -0.51 * y(1) * y(2);

Solve the equation on the interval 0-12 [t,y] = ode45('rigid',[0 12],[0 1 1])

Matlab: numerical solutions

[t,y] = ode45('rigid',[0 12],[0 1 1]) plot(t,y(:,1),'-',t,y(:,2),'-.',t,y(:,3),'.')

Remake rigid.m and test different equations

Some kinds of diff equations, so called stiff equations, should be solved by ode15s(…)

stiff diff equations

top related