Honours Finance (Advanced Topics in Finance: Nonlinear Analysis) : Honours Finance (Advanced Topics in Finance: Nonlinear Analysis) Lecture 2: Introduction to OrdinaryDifferential Equations
Why bother? : Why bother? Last week we considered Minsky’s Financial Instability Hypothesis as an expression of the “endogenous instability” explanation of volatility in finance (and economics)
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 This is an ordinary differential equation (ODE); exploring this model mathematically (in order to model it) thus requires knowledge of ODEs
Why bother? : Why 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 circuit
Equilibrium methods (simultaneous algebraic equations using matrices etc.) only tell us the resting point of a real-life process if the process converges to equilibrium (i.e., if the dynamic process is stable)
Is the economy static?
Economies and economic methodology : Economies and economic methodology Economy clearly dynamic, economic methodology primarily static.Why 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 difficult question when the more easy one is yet so imperfectly within our power.” (Jevons 1871 [1911]: 93)
“...dynamics includes statics... But the statical solution… is simpler...; it may afford useful preparation and training for the more difficult dynamical solution; and it may be the first step towards a provisional and partial solution in problems so complex that a complete dynamical solution is beyond our attainment.” (Marshall, 1907 in Groenewegen 1996: 432)
Economies and economic methodology : Economies and economic methodology A 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 from one equilibrium to another is important and is known as dynamic analysis. Throughout this book we will assume that the economic system is stable and most of the analysis will be conducted in the comparative static mode.” (1995: 28)
Steedman, Questions for Kaleckians: “The general point which is illustrated by the above examples is, of course, that our previous 'static' analysis does not 'ignore' time. To the contrary, that analysis allows enough time for changes in prime costs, markups, etc., to have their full effects.” (Steedman 1992: 146)
Economies and economic methodology : Economies and economic methodology Is 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 tendency to fluctuation which exists in the real world. I think, as I shall proceed to show, that something of this sort may well have much to do with the tendency to fluctuation. But mathematical instability does not in itself elucidate fluctuation. A mathematically unstable system does not fluctuate; it just breaks down. The unstable position is one in which it will not tend to remain.” (Hicks 1949)
Lorenz’s Butterfly : Lorenz’s Butterfly So, do unstable situations “just break down”?
An example: Lorenz’s stylised model of 2D fluid flow under a temperature gradient
Lorenz’s model derived by 2nd order Taylor expansion of Navier-Stokes general equations of fluid flow. The result: x displacement y displacement temperature gradient Looks pretty simple, just a semi-quadratic…
First step, work out equilibrium:
Lorenz’s Butterfly : Lorenz’s Butterfly Three equilibria result (for b>1): Not so simple after all! But hopefully, one is stable and the other two unstable…
Eigenvalue analysis gives the formal answer (sort of …)
But let’s try a simulation first …
Simulating a dynamic system : 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 calculus
Most sophisticated is 5th order Runge-Kutta; simplest Euler
The most sophisticated packages let you see simulation dynamically
We’ll try simulations with realistic parameter values, starting a small distance from each equilibrium: So that the equilibria are Over to Vissim...
Lorenz’s Butterfly : Lorenz’s Butterfly Now you know where the “butterfly effect” came from
Aesthetic shape and, more crucially
All 3 equilibria are unstable (shown later)
Probability zero 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”. Wrong:
system starts in a non-equilibrium state, and moves to a non-equilibrium state
not equilibrium dynamics but far-from equilibrium dynamics
Lorenz’s Butterfly : Lorenz’s Butterfly Founding father: “mathematical instability does not in itself elucidate fluctuation. A mathematically unstable system does not fluctuate; it just breaks down”. Wrong:
System with unstable equilibria does not “break down” but demonstrates complex behaviour even with apparently simple structure
Not breakdown but complexity
Researcher: “static … analysis allows enough time for changes in prime costs, markups, etc., to have their full effects”. Wrong:
Complex system will remain far from equilibrium even if run for infinite time
Conditions of equilibrium never relevant to systemic behaviour
When economists are right : When economists are right Economist attitudes garnered from understanding of linear dynamic systems
Stable linear systems do move from one equilibrium to another
Unstable linear dynamic systems do break down
Statics is the end point of dynamics in linear systems
So economics correct to ignore dynamics if economic system is
linear, or
nonlinearities are minor;
one equilibrium is an attractor; and
system always within orbit of stable equilibrium
Who are we kidding?…Nonlinearity rules:
Nonlinearities in economics : Nonlinearities in economics Structural
monetary value of output the product of price and quantity
both are variables and product is quasi-quadratic
Behavioural
“Phillips curve” relation
wrongly maligned in literature
clearly a curve, yet conventionally treated as linear
Dimensions
massively open-multidimensional, therefore numerous potential nonlinear interactions
Evolution
Clearly evolving system, therefore even more complex than “simple” nonlinear dynamics… So Economists "have to" do dynamics
Why bother? : Why bother?
Why Bother? : Why Bother? Lorenz’s bizarre graphs indicate
Highly volatile nonlinear system could still be systemically stable
cycles continue forever but system never exceeds sensible bounds
e.g., in economics, never get negative prices
linear models however do exceed sensible bounds
linear cobweb model eventually generates negative prices
Extremely complex patterns could be generated by relatively simple models
The “kiss” principle again: perhaps complex systems could be explained by relatively simple nonlinear interactions
Why Bother? : Why 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 point
Multiple equilibria
two or more strange attractors generate very complex dynamics
Explanation for volatility of weather
El Nino, etc.
Why bother? : Why bother? Tiny errorin initialreadingsleads toenormousdifferencein time pathof system.And behindthe chaos,strangeattractors...
Why bother? : Why bother?
Why Bother? : Why Bother? Lorenz showed that real world processes could have unstable equilibria but not break down in the long run because
system necessarily diverges from equilibrium but does not continue divergence far from equilibrium
cycles are complex but remain within realistic bounds because of impact of nonlinearities
Dynamics (ODEs/PDEs) therefore valid for processes with endogenous factors as well as those subject to an external 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.
Why Bother? : Why Bother? To understand systems like Lorenz’s, first have to understand the basics
Differential equations
Linear, first order
Linear, second (and higher) order
Some nonlinear first order
Interacting systems of equations
Initial examples non-economic (typical maths ones)
Later we’ll consider some economic/finance applications before building full finance model
Maths and the real world : Maths and the real world Much of mathematics education makes it seem irrelevant to the real world
In fact the purpose of much mathematics is to understand the real world at a deep level
Prior to Poincare, mathematicians (such as Laplace) believed that mathematics could one day completely describe the universe’s future
After Poincare (and Lorenz) it became apparent that to describe the future accurately required infinitely accurate knowledge of the present
Godel had also proved that some things cannot be proven mathematically
Maths and the real world : Maths and the real world Today mathematics is much less ambitious
Limitations of mathematics accepted by most mathematicians
Mathematical models
seen as “first pass” to real world
regarded as less general than simulation models
but maths helps calibrate and characterise behaviour of such 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
Maths and the real world : Maths and the real world Summarising solvability of mathematical models (from Costanza 1993: 33):
Maths and the real world : Maths and the real world To 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 process
But an understanding of the basic maths of the solvable class of equations is still necessary to know what’s going on in the insoluble set
Hence, a crash course in ODEs, with some refreshers on elementary calculus and algebra...
From Differentiation to Differential… : From Differentiation to Differential… In Maths 1.3, you learnt to handle equations of the form Where f is some function. For example On the other hand, differential equations are of the form So how do we handle them? Make them look like the stuff we know: The rate of change of y is a function of its value: y both independent & dependent Dependent variable Independent variable
From Differentiation to Differential… : From Differentiation to Differential… The simplest differential equation is (we tend to use t to signify time, rather than xfor displacement as in simple differentiation) Try solving this for yourself: Continued...
From Differentiation to Differential… : From Differentiation to Differential… Another approach isn’t quite so formal: Because log of a negative number is not defined Because an exponential is always positive
From Differentiation to Differential… : From Differentiation to Differential… Treat dt as a small quantity
Move it around like a variable
Integrate both sides w.r.t the relevant “d(x)” term
dy on LHS
dt on RHS
Some problems with generality of this approach versus previous method, but OK for economists & modelling issues So what’s the relevance of this to economics and finance? How about compound interest?
From Differential Equations to Finance : From Differential Equations to Finance Consider a moneylender charging interest rate i with outstanding loans of $y.
Who saves s% of his income from borrowers
Whose borrowers repay p% of their outstanding principal each year
Then the increment to bank balances each period dt will be dx: Divide by y & Collect terms Integrate Take exponentials
From Differential Equations to Finance : From Differential Equations to Finance Under what circumstances will our moneylender’s assets grow?
C equals his/her initial assets: The moneylender will accumulate if the power of the exponential is greater than zero: The moneylender will blow the lot if the power of the exponential is less than zero: Known as “eigenvalue”;tells how much the equationis “stretching” space
Back to Differential Equations! : Back to Differential Equations! The form of the preceding equation is the simplest possible; how about a more general form: Same basic idea applies: f(t) can take many forms, and all your integration knowledge from Maths 1.3 can be used… A few examples
Back to Differential Equations! : 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 world
so put up with the rote and we’ll get to the final objective eventually!
Back to Calculus! : Back to Calculus! Try the following: Won’t pursue the last one because
Not a course in integration
Most differential equations analytically insoluble anyway
Programs exist which can do most (but not all!) integrations a human can do
But a quick reminder of what is done to solve such ODEs
Also of relevance to work we’ll do later on systems of ODEs
Back to Calculus! : Back to Calculus! Simple to derive from first principles: consider a function which is the product of two other functions: Some useful rules from differentiation and integration:
Product rule:
Back to Calculus! : Back to Calculus! These rules then reworked to give us “integration by parts” for complex integrals:
Back to Calculus! : Back to Calculus! Convert difficult integration into an easier one by either
reducing “u” component to zero by repeated differentiation
repeating “u” and solving algebraically Treat integration as a multiplication operator
Back to Calculus! : Back to Calculus! Practically
choose for “u” something which either
gets simpler when integrated; or
cycles back to itself when integrated more than once
For our example: These don’t get any simpler, but do “cycle” Try sin:
cycles back
formulas exist for expansion
Back to Calculus! : Back to Calculus! Next differentiation of this Reproduces this
Back to Calculus! : Back to Calculus! Stage Two: Finally, Stage Three: we were trying to solve the ODE:
Back to Differential Equations! : Back to Differential Equations! We got to the point where the equation was in soluble form: Then we solved the integral: Now we solve the LHS and take exponentials:
Back to Differential Equations! : Back to Differential Equations! So far, we can solve (some) ordinary differential equations of the form: 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
Back to Differential Equations! : Back to Differential Equations! Next stage is to consider non-homogeneous equations: g(t) can be thought of as a force acting on a system
We can no longer “divide through by y” as before, since this yields which still has y on both sides of the equals sign, and if anything looks harder than the initial equation
So we apply the three fundamental rules of mathematics:
The three fundamental rules of mathematics J : The three fundamental rules of mathematics J (1) What have you got that you don’t want?
Get rid of it
(2) What haven’t you got that you do want?
Put it in
(3) Keep things balanced
Take a look at the equation again What does this look almost like? The product rule:
Non-Homogeneous First Order Linear ODEs : Non-Homogeneous First Order Linear ODEs The LHS of the expression is almost in product rule form Can we do anything to put it exactly in that form?
Multiply both sides by an expression m(t) so that This is only possible if Now we have to find a m(t) such that
The Integrating Factor Approach : The Integrating Factor Approach This is a first order linear homogeneous ODE, which we already know how to solve (the only thing that makes it apparently messy is the explicit statement of a dependence on t in m(t), which we can drop for a while): This is known as the “integrating factor”
The Integrating Factor Approach : The Integrating Factor Approach So if we multiply by we get Anybody dizzy yet?
It’s complicated, but there is a light at the end of the tunnel
Next, we solve the equation by taking integrals of both sides:
The Integrating Factor Approach : The Integrating Factor Approach And finally the solution is: This is a bit like line dancing: it looks worse than it really is.
Let’s try a couple of examples: firstly, try (Actually, line dancing probably is as bad as it looks, and so is this)...
The Integrating Factor Approach : The Integrating Factor Approach The first one becomes using the integrating factor Now we need a m such that Which is only possible if This is a first order homogeneous DE: piece of cake!
The Integrating Factor Approach : The Integrating Factor Approach Thus we multiply by to yield Then we integrate: Next problem: how to integrate this? Back to basics #2:the Chain Rule inreverse
The Chain Rule : The Chain Rule This expression: “Looks like” Or in differential form: That integral is elementary: Now substituting for u and taking account of the constant:
The Integrating Factor Approach : The Integrating Factor Approach Finally, we return to Putting it all together: is the solution to Before we try another example, the general principle behind the technique above is the chain rule in reverse:
The Chain Rule : The Chain Rule In reverse, the substitution method of integration: Rate of change of composite function is rate of change of one times the other =slope of composite Slope of one * slope of other
Back to Differential Equations! : Back to Differential Equations! Try the technique with Stage One: Finding m:
Linear First Order Non-Homogeneous : Linear First Order Non-Homogeneous Stage Two: apply m: Stage Three: integrating RHS…
there is no known integral! (common situation in ODEs)
Completing the maths as best we can: This can only be estimated numerically