Top Banner
Honours Finance (Advanced Topics in Finance: Nonlinear Analysis) Lecture 2: Introduction to Ordinary Differential Equations BY: Abdul Ghani Khan M.tech School of ICT,GBU
54

08 ODE Intro Ghani

Apr 09, 2018

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 1/54

Honours Finance (Advanced Topics in Finance:Nonlinear Analysis)

Lecture 2: Introduction toOrdinary

Differential EquationsBY:

Abdul Ghani KhanM.tech

School of ICT,GBU

Page 2: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 2/54

W hy bother?Last week we considered Minsky·s Financial Instability

Hypothesis as an expression of the ´endogenousinstabilityµ explanation of volatility in finance (andeconomics)The FIH claims that expectations will rise during periods

of economic stability (or stable profits).That can be expressed as² % rate of change of expectations = f(rate of growth),

or in symbols

¹ º ¸©

ª¨ v!v

dt dY

Y f

dt dE

E 11

This is an ordinary differential equation (ODE); exploringthis model mathematically (in order to model it) thus

requires knowledge of ODEs

Page 3: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 3/54

W hy bother?In general, ODEs (and PDEs) are used to model real-life

dynamic processes² the decay of radioactive particles² the growth of biological populations² the spread of diseases² the propagation of an electric signal through a circuitEquilibrium methods (simultaneous algebraic equations

using matrices etc.) only tell us the resting point of areal-life process if the process converges to equilibrium

(i.e., if the dynamic process is stable)Is the economy static?

Page 4: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 4/54

Economies and economic methodologyEconomy clearly dynamic, economic methodology primarily

static. W hy the difference?Historically: the KISS principle:² ´If we wished to have a complete solution ... we should

have to treat it as a problem of dynamics. But it would

surely be absurd to attempt the more difficultquestion when the more easy one is yet so imperfectlywithin our power.µ (Jevons 1871 [1911]: 93)

² ´...dynamics includes statics... But the staticalsolution« is simpler...; it may afford useful preparationand training for the more difficult dynamical solution;and it may be the first step towards a provisional andpartial solution in problems so complex that a completedynamical solution is beyond our attainment.µ

(Marshall, 1907 in Groenewegen 1996: 432)

Page 5: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 5/54

Economies and economic methodologyA century on, Jevons/Marshall attitude still dominates most

schools of economic thought, from textbook to journal:² Taslim & Chowdhury, Macroeconomic Analysis for Australian

Students: ´the examination of the process of moving fromone equilibrium to another is important and is known asdynamic analysis. Throughout this book we will assume thatthe economic system is stable and most of the analysis willbe conducted in the comparative static mode.µ (1995: 28)

² Steedman, Questions for Kaleckians: ´The general pointwhich is illustrated by the above examples is, of course, that

our previous 'static' analysis does not 'ignore' time. To thecontrary, that analysis allows enough time for changes inprime costs, markups, etc., to have their full effects.µ(Steedman 1992: 146)

Page 6: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 6/54

Economies and economic methodologyIs this valid?² Yes, if equilibrium exists and is stable² No, if equilibrium does not exist, is not stable, or is one of

many...Economists assume the former. For example, Hicks on Harrod:

² ´In a sense he welcomes the instability of his system,because he believes it to be an explanation of the tendencyto fluctuation which exists in the real world. I think, as Ishall proceed to show, that something of this sort may wellhave much to do with the tendency to fluctuation. But

mathematical instability does not in itself elucidatefluctuation. A mathematically unstable system does notfluctuate; it just breaks down. The unstable position is one inwhich it will not tend to remain.µ (Hicks 1949)

Page 7: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 7/54

Lorenz·s Butterfly

So, do unstable situations ´just break downµ?² An example: Lorenz·s stylised model of 2D fluid flow

under a temperature gradientLorenz·s model derived by 2nd order Taylor expansion

of Navier-Stokes general equations of fluid flow. Theresult:

dx a y x

dt dy

b z x y dt dz

x y c z dt

! v

! v

! v v

x displacement

y displacement

temperature gradient

Looks pretty simple, just a semi-quadratic«First step, work out equilibrium:

Page 8: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 8/54

Lorenz·s Butterfly

Three equilibria result (for b>1):

00

0

d x y x

d t d y

z x y d t d z

x y c z d t

! v !

! v !

! v v !

,1, 1

1

y x a

z b b

x y b c

x y z

! {! "

! ! v! ! !

111

b c x

y b c

z b

« » v« » ¬ ¼¬ ¼ ¬ ¼! v¬ ¼ ¬ ¼¬ ¼ ¬ ¼- ½ ¬ ¼- ½

000

x

y

z

« » « »¬ ¼ ¬ ¼!¬ ¼ ¬ ¼¬ ¼ ¬ ¼- ½ - ½

11

1

b c x

y b c

z b

« » v« » ¬ ¼¬ ¼ ¬ ¼! v¬ ¼ ¬ ¼¬ ¼ ¬ ¼- ½

¬ ¼- ½

Not so simple after all! Buthopefully, one is stable andthe other two unstable«Eigenvalue analysis gives the

formal answer (sort of «)But let·s try a simulation

first «

Page 9: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 9/54

Simulating a dynamic system

Many modern tools exist to simulate a dynamic system² All use variants (of varying accuracy) of approximation

methods used to find roots in calculusMost sophisticated is 5th order Runge-Kutta; simplest

Euler

² The most sophisticated packages let you see simulationdynamically

W e·ll try simulations with realistic parameter values,starting a small distance from each equilibrium:

5151

a

b

c

« » « »¬ ¼ ¬ ¼!¬ ¼ ¬ ¼¬ ¼ ¬ ¼- ½ - ½

So that theequilibria are

3.742 3.742

03.742 , 3.742 , 0 14 14 0

x y

z

« » « » « » « »¬ ¼ ¬ ¼ ¬ ¼ ¬ ¼! ¬ ¼ ¬ ¼ ¬ ¼ ¬ ¼¬ ¼ ¬ ¼ ¬ ¼ ¬ ¼- ½ - ½ - ½ - ½

Lorenz_Any.vsm

Page 10: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 10/54

Lorenz·s ButterflyNow you know where the ́ butterfly effectµ came from² Aesthetic shape and, more crucially

All 3 equ i l ibria ar e unst ab le (shown later)² Probability ze ro that a system will be in an equilibrium

state (Calculus ´Lebesgue measureµ)Before analysing why, review economists· definitions of

dynamics in light of Lorenz:² Textbook: ´the process of moving from one equilibrium

to anotherµ. W rong:

² system starts in a non-equilibrium state, and movesto a non-equilibrium state² not equilibrium dynamics but far-from equilibrium

dynamics

Page 11: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 11/54

Lorenz·s Butterfly² Founding father: ´mathematical instability does not in

itself elucidate fluctuation. A mathematically unstablesystem does not fluctuate; it just breaks downµ.W rong:

System with unstable equilibria does not ´break downµbut demonstrates complex behaviour even withapparently simple structureNot breakdown but complexity

² Researcher: ́ static « analysis allows enough time forchanges in prime costs, markups, etc., to have theirfull effectsµ. W rong:

Complex system will remain far from equilibrium even ifrun for infinite timeConditions of equilibriumneve r relevant to systemic

behaviour

Page 12: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 12/54

Page 13: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 13/54

Nonlinearities in economicsStructural² monetary value of output the product of price and

quantityboth are variables and product is quasi-quadratic

Behavioural² ´Phillips c u r ve µ relation

wrongly maligned in literatureclearly a curve, yet conventionally treated as linear

Dimensions² massively open-multidimensional, therefore numerous

potential nonlinear interactionsEvolution² Clearly evolving system, therefore even more complex

than ´simpleµ nonlinear dynamics«

Page 14: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 14/54

W hy bother?

0 10 20 30 40 50 60 70 80 90 100

Time

-8

-6

-4

-2

-0

2

4

6

8

X w

i t h

b =1

5

Lorenz's "strange attractor "X displacement as a function of time

Page 15: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 15/54

W hy Bother?Lorenz·s bizarre graphs indicate² Highly volatile nonlinear system could still be

systemically stablecycles continue forever but system never exceeds

sensible bounds

² e.g., in economics, never get negative priceslinear models however do exceed sensible bounds² linear cobweb model eventually generates negative

prices² Extremely complex patterns could be generated by

relatively simple modelsThe ´kissµ principle again: perhaps complex systems

could be explained by relatively simple nonlinearinteractions

Page 16: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 16/54

W hy Bother?But some problems (and opportunities)² systems extremely sensitive to initial conditions and

parameter values² entirely new notion of ´equilibriumµ

´Strange attractorsµ

² system attracted to region in space, not a pointMultiple equilibria² two or more strange attractors generate very

complex dynamics

² Explanation for volatility of weatherEl Nino, etc.

Page 17: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 17/54

W hy bother?

0 10 20 30 40 50 60 70 80 90 100

Ti e

-8

-6

-4

-2

-0

2

4

6

8

X d

i

p l a e

e n t

Loren ' Strange Attra tor One small step f or a butter f ly, one enor mous f lap f or mankin d... Tiny error

in initialreadings

leads toenormousdifferencein time pathof system.And behindthe chaos,

strangeattractors...

Page 18: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 18/54

W hy bother?

Loren ' s trange ttra tor ,Y an d Z displa e ment

Page 19: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 19/54

W hy Bother?Lorenz showed that real world processes could have

unstable equilibria but not break down in the long runbecause² system necessarily diverges from equilibrium but does

not continue divergence far from equilibrium

² cycles are complex but remain within realistic boundsbecause of impact of nonlinearitiesDynamics (ODEs/PDEs) therefore valid for processes

with endogenous factors as well as those subject to anexternal force² electric circuit, bridge under wind and shear stress,

population infected with a virus as before; and also² global weather, economics, population dynamics with

interacting species, etc.

Page 20: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 20/54

W hy Bother?To understand systems like Lorenz·s, first have to

understand the basicsDifferential equations² Linear, first order² Linear, second (and higher) order² Some nonlinear first order² Interacting systems of equationsInitial examples non-economic (typical maths ones)Later we·ll consider some economic/finance applications

before building full finance model

Page 21: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 21/54

Maths and the real worldMuch of mathematics education makes it seem irrelevant

to the real worldIn fact the purpose of much mathematics is to

understand the real world at a deep levelPrior to Poincare, mathematicians (such as Laplace)

believed that mathematics could one day completelydescribe the universe·s futureAfter Poincare (and Lorenz) it became apparent that to

describe the future accurately required infinitelyaccurate knowledge of the present² Godel had also proved that some things cannot be

proven mathematically

Page 22: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 22/54

Maths and the real worldToday mathematics is much less ambitiousLimitations of mathematics accepted by most

mathematiciansMathematical models² seen as ´first passµ to real world² regarded as less general than simulation models

but maths helps calibrate and characterise behaviour ofsuch models

² ODEs and PDEs have their own limitations

most ODEs/PDEs cannot be solved² however techniques used for those that can are used

to analyse behaviour of those that cannot

Page 23: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 23/54

Maths and the real worldSummarising solvability of mathematical models (from

Costanza 1993: 33):

Linear Non-linear

EquationsOneequation

Severalequations

Manyequations

Oneequation

Severalequations

Manyequations

Algebraic trivial easyessentiallyimpossible very difficult very difficult impossible

OrdinaryDifferential easy difficult

essentiallyimpossible very difficult impossible impossible

PartialDifferential difficult

essentiallyimpossible impossible impossible impossible impossible

Page 24: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 24/54

Maths and the real worldTo model the vast majority of real world systems that

fall into the bottom right-hand corner of that table, we² numerically simulate systems of ODEs/PDEs² develop computer simulations of the relevant processBut an understanding of the basic maths of the solvable

class of equations is still necessary to know what·s goingon in the insoluble set² Hence, a crash course in ODEs, with some refreshers

on elementary calculus and algebra...

Page 25: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 25/54

From Differentiation to Differential«In Maths 1.3, you learnt to handle equations of the form

x f d xdy !

W here f is some function. Forexample

c x y

d x xd xd xd y

x

d x

d y

!

!

!

´´cos

sin

sin

On the other hand, differential equations are of the

form y x f

dxdy

,!So how do we handle them? Make them look like the

stuff we know:

The rate of change of y is a function of itsvalue: y both independent & dependent

Dependent variable Independent variable

Page 26: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 26/54

From Differentiation to Differential«The simplest differential equation is

ydt d y ! (we tend to use t to signify time , rather than x

for displa cement as in simple differentiation)

Trysolvingthis for

yourself:

ct dt ydt y

y

dt d y y y

ydt d y

ydt d y

!!!

!

v!

!

!

´´1lnln

dt

d

:tw.r.t.sides bothIntegrate1lndtd

:ormin thisequationtheRewrite1lndtd

:A tri ck 1

y bysides bothDivide

Continued...

Page 27: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 27/54

From Differentiation to Differential«

Another approach isn·t quite so

formal:

growthlExponentia

lsexponentiaTa k eln

t

t

t ct ct

eC y

C e y

C eeee y

ct y

v!

!v

v!v!!!B ecause log of a negative

number is not definedB ecause an

exponential isalways positive

Page 28: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 28/54

From Differentiation to Differential«Treat dt as a small quantityMove it around like a variableIntegrate both sides w.r.t the relevant

´d(x)µ term² dy on LHS² dt on RHSSome problems with generality of this

approach versus previous method, but OKfor economists & modelling issues

t e yct y

dt yd y

dt y

d y

ydt d y

v!!

!!

!

´´ln

So what·s the relevance of this toeconomics and finance? How aboutcompound interest?

Page 29: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 29/54

Page 30: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 30/54

From Differential Equations to FinanceUnder what circumstances will our moneylender·s assets

grow?² C equals his/her initial assets:

t p pi set y vvv!

C C eC eC y p pi s !v!v!v! vv 10 00

The moneylender will accumulate if the power of theexponential is greater than zero:

gpgp"!v v¹ º ¸©ª̈ tasethen0If t p pi s PP

The moneylender will blow the lot if the power of theexponential is less than zero:

gppv

tas0ethen0It P

P

Known as ´eigenvalueµ;Known as ´eigenvalueµ;tells how much the equationtells how much the equation

is ´stretchingµ spaceis ´stretchingµ space

Page 31: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 31/54

Back to Differential Equations!The form of the preceding equation is the simplest

possible; how about a more general form:

yt f d t

dy v!Same basic idea applies:

dt t f yd y v!

´ v! dt t f yln

´ vv! dt t f eC y

f(t) can take many forms, and all your integrationknowledge from Maths 1.3 can be used« A few

examples

Page 32: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 32/54

Back to Differential Equations!But firstly a few words from our sponsor² These examples are just ´roteµ exercises

most of them don·t represent any real world system² However the ultimate objective is to be able to

comprehend complex nonlinear models of finance that

do purport to model the real worldso put up with the rote and we·ll get to the finalobjective eventually!

Page 33: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 33/54

Back to Calculus!

Try the following:

0sin

0

0sin

0

0

2

!vv

!v

!v

!v

!v

v

v

yt edt d y

ye

dt

d y

yt dt d y

yt dt d y

yt dt d y

t b

t b

W on¶t pursue the last one be causeN ot a course in integrationM ost differential equations

analyti cally insoluble any wayP rograms exist which can do most

( but not all!) integrations a human cando

B ut a qui ck reminder of what is doneto solve su ch O Es

A lso of relevan ce to wor k we¶lldo later on systems of O Es

Page 34: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 34/54

Back to Calculus!

Simple to derive from first principles: consider afunction which is the product of two other functions:

ud xd

vvd xd

uvud xd vv!v

Some useful rules from differentiation and integration:² Product rule:

t et f t b sinv! v

Page 35: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 35/54

Back to Calculus!

10

10

u x( )

x( )

u x( ) x( )

1010 x10 5 0 5 10

10

5

0

5

10

¢ (x)exp (-bx)s

¡

¢ (x)*e xp (-bx)

dxd u

vdxd v

u

x

uv x

vu

xvu

xvuuvvuvuvu

x

vuvvuu

x f f f

x f dxd

vvuu f f vu f

x

x

x

x

vv!

((v(

(v(

((v!

(v(v(v((vv!

(

v(v(!

((!

(v(!(v!

p(

p(

p(

p(

lim

lim

lim

lim

0

0

0

0

Thenxof functionsarevu,f ,whereConsider

These rules thenreworked to give us´integration by partsµ forcomplex integrals:

Page 36: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 36/54

Back to Calculus!

Convert difficult integration into an easier one by either² reducing ´uµ component to zero by repeateddifferentiation

² repeating ´uµ and solving algebraically

´´ vv!vvv!vvv!v

vv!v

d uvvudvu

d uvvud dvu

d uvdvuvud d xd u

vd xdv

uvud xd

Treat integration as amultiplication operator

Page 37: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 37/54

Back to Calculus!Practically

² choose for ´uµ something which eithergets simpler when integrated; orcycles back to itself when integrated more than once

² For our example:

t et f t b sinv! v

These don·t getany simpler, but

do ´cycleµ

T ry sin:cycles backformulas exist for

expansion

Page 38: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 38/54

Page 39: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 39/54

Back to Calculus!

Stage Two:

t f unc t ion

t f unc t iond t t e X

t f unc t ion X t f unc t ion

X t f unc t iont f unc t ion X

b

at b

ab

ba

!v!!v

v!

´ v

1)(

sin

)(1

)(

Finally, Stage Three: we were trying to solve the ODE:

0sin !vvv yt ed t dy t b

Page 40: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 40/54

Back to Differential Equations!W e got to the point where the equation was in soluble

form:

´´ vv! v d t t e ydy t b sin

Then we solved the integral:

t f unc t ion

t f unc t iondt t e X

b

at b !v! ´ v

1)(

sin

Now we solve the LHSand take exponentials:

t f unc t ion

t f unc t ion

b

a

b

a

eC y

t f unc t iont f unc t ion y

v!

!

1

1ln

Page 41: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 41/54

Back to Differential Equations!So far, we can solve (some) ordinary differential

equations of the form:

0!v yt f dt d y

These are known as:² First order

because only a first differential is involved² Linear

Because there are no functions of y such as sin(y)² Homogeneous

Because the RHS of the equation is zero

Page 42: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 42/54

Back to Differential Equations!Next stage is to consider non-homogeneous equations:

t g yt f dt d y !v

g(t) can be thought of as a force acting on a systemW e can no longer ´divide through by yµ as before,since this yields

dt t f y

t g

y

d y v¹¹ º

¸©©ª

¨!

which still has y on both sides of the equals sign, andif anything looks harder than the initial equationSo we apply the three fundamental rules of

mathematics:

Page 43: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 43/54

The three fundamental rules of mathematics

(1)W hat have you got that you don·t want?

² Get rid of it(2)W hat haven·t you got that you do want?² Put it in(3) Keep things balancedTake a look at the equation again

t g yt f dt d y !vW hat does this look almost like?

The product rule: ud xd

vvd xd

uvud xd vv!v

Page 44: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 44/54

Non-Homogeneous First Order Linear ODEsThe LHS of the expression

t g yt f dt d y !v is almost in product rule

form

Can we do anything to putit exactly in thatform?² Multiply bo th s i d es by an expression Q(t)

so that t g t yt f t dt d y

t v!vvv Q Q Q

This is only possible if

yt f t dt d y

t yt dt d vvv!v Q Q Q

Now we have to find aQ(t) such that

t f t t d t d v! Q Q

Page 45: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 45/54

The Integrating Factor ApproachThis is a first order linear homogeneous ODE, which we

already know how to solve (the only thing that makes itapparently messy is the explicit statement of adependence on t in Q(t), which we can drop for a while):

´ v!

v!

v!

v!v!

´́´d t t f et

d t t f

d t t f d

d t t f d

t f d t

d

Q

Q Q

Q Q Q

Q Q

lnThis is k nown as the ³integrating fa ctor´

Page 46: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 46/54

The Integrating Factor ApproachSo if we

multiply t g yt f dt d y !v by ´ v! d t t f et Q we get

´v!¹ º ¸©ª

¨ ´v!v´v´ dt t f dt t f dt t f dt t f et g e y

dt d

yet f dt d y

e

Anybody dizzy yet?² It·s complicated, but there is a light at the

end of the tunnel

Next, we solve the equation by takingintegrals of both sides:

dt et g e ydt e ydt d dt t f dt t f dt t f ´´ ´v!´v!¹ º

¸©ª¨ ´v

Page 47: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 47/54

The Integrating Factor ApproachAnd finally the solution is:

´

´v! ´

dt t f

dt t f

e

dt et g y

This is a bit like line dancing: it looks worse than itreally is.² Let·s try a couple of examples: firstly, try t yt

dt d y !vv2

(Actually, line dancing probably is as bad as it looks,and so is this)...

Page 48: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 48/54

The Integrating Factor Approach

The first one t yt dt d y !vv2 becomes

t yt dt d y v!vvvv Q Q Q 2 using the integrating factor

Now we need aQ suchthat

yt dt d y y

dt d vvvv!v Q Q Q 2

Q Q vv! t dt d

2W hich is only possibleifThis is a first order homogeneous DE: piece of cake!

222ln2 t et dt t dt t d !p!vv!pvv! ´ Q Q Q Q

Page 49: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 49/54

The Integrating Factor ApproachThus we multiply

t yt dt d y !vv2 by

2t e to yield

2222

2 t t t t et yedt d

et ydt d y

e v!v!vvvv

Then we integrate:

´´ v!v!v dt et yedt yedt d t t t 222

Next problem: how to integrate this?

Back to basics #2:the Chain Rule in

reverse

Page 50: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 50/54

The Chain RuleThis expression:

´ v d t et t 2

´Looks likeµ t t dt d

t ud ue u v!!´ 2sincewhere 22

22 so2

1 t udt t t d !v!vOr in differential form:

That integral is elementary: ced ue uu !´

C eced ued uet t t ut v!v!v!v ´´ 222

21

21

21

Now substituting for u and taking account of theconstant:

Page 51: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 51/54

The Integrating Factor ApproachFinally, we return to

´´ v!v!v dt et yedt yedt d t t t 222

Putting it all together: C e ye t t v!v 22

2

1

2

22

2

21

212

1t

t t

t

eC e

C

e

C e y v!!

v!

t yt dt d y !vv2

is the solution to

Before we try another example, the generalprinciple behind the technique above is the chainrule in reverse:

Page 52: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 52/54

The Chain Rule

10

10

u x( )

£ x( )

u x( ) £ x( )( )

¤ u x( )( )

1010 x10 5 0 5 10

10

5

0

5

10

s i¥ (x)¦ xp (-bx)s i¥ (x)* ¦ xp (-bx)¦ (s i¥ (x))

C t g F

dt t g t g F dt t g t g f

x f x F d x x f x F

!v!v

!!

´´´

'''o

'thenI

In reverse, thesubstitution method ofintegration:

Rate of change ofcomposite function is rateof change of one times theother

x g x g f x F

x g f x F '''then

Iv!

!

=slope of composite

Slope of one

* slope of other

Page 53: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 53/54

Back to Differential Equations!Try the technique with

12 !v yt d t dy

3

3

1

32

2

2

2

2

3

1dtln

d

dtddtd

iff

:factor gintegratinTimes1

t e

t t

t

t

yd t d yt

d t dy

yt d t dy

!

!v!!

v!

v!

!v!vvv

!v

´´ Q

Q Q Q

Q Q

Q Q

Q Q Q Q

Stage One: Finding Q:

Page 54: 08 ODE Intro Ghani

8/7/2019 08 ODE Intro Ghani

http://slidepdf.com/reader/full/08-ode-intro-ghani 54/54

Linear First Order Non-HomogeneousStage Two: applyQ:

cdt e yedt yedt d

e yedt d

yet dt d y

e yt dt d y

e yt dt d y

t t t

t t t t

t

!v!¹¹ º

¸©©ª

¨v

!¹¹ º

¸©©ª

¨v!vvv!vvv

!!v

´´333

3333

3

3

13

13

1

3

13

13

123

12

3

12 actor gintegratinTimes1

Q Q

Q

Stage Three: integrating RHS«² there is no known integral! (common situation in

ODEs)² Completing the maths as best we can:

cedt ee yt t t

vv! ´333

3

13

13

1

This can only be estimated numerically