• No results found

Lecture 6: Solving Linear Differential Equations

N/A
N/A
Protected

Academic year: 2022

Share "Lecture 6: Solving Linear Differential Equations"

Copied!
7
0
0

Loading.... (view fulltext now)

Full text

(1)

Spring Semester ’12-’13 Akila Weerapana

Lecture 6: Solving Linear Differential Equations

I. INTRODUCTION

• In a previous lecture, we discussed the general principle of the “dynamic” nature of most macroeconomic variables. with values that change over time. We then looked at techniques of solving difference equations that related discretely changing macroeconomic variables to their own past or future values.

• This lecture will cover the basic theory needed to solve macroeconomic models with endoge- nous variables that change continuously over time. We will begin by deriving continuous time models as a limiting case of discrete time models, establish why some key mathematical functions like ln and e play a key role in continuous time and discuss the techniques needed to solve differential equations.

• The solution technique and the concepts of stability and steady state are going to be very similar to what we discussed for difference equations in the previous class.

• Being able to handle basic linear difference and differential equations is also the first step in our journey towards being able to solve dynamic optimization problems.

III. FROM DISCRETE TO CONTINUOUS TIME

• Consider a variable x that changes in value in discrete periods. For simplicity, assume that x has a per-period growth rate of r and changes only once during a period.

• The value of x after 1 period will be x t+1 = x t (1 + r) and the value of x after 2 periods will be x t+2 = x t+1 (1 + r) = x t (1 + r) 2 . Extending this, we can show that after n periods, the future (or compounded) value of x can be expressed as x t+n = x t (1 + r) n .

• Conversely, if we knew the value of x at a future time t + n and a per-period growth rate of r, we can calculate the initial (or discounted) value of that variable at time t as x t = (1+r) x

t+nn

.

• Now let’s make things a little more complicated by supposing that x was still growing at the rate of r a year but the compounding was happening k times a year. Ex: a bank account that pays interest monthly at an interest rate of 5% a year has r=0.05 and k=12.

• Now, the value of x after 1 period will be x t+1 = x t (1 + r k ) k . Generalizing, we can show that after n periods, the future (or compounded) value of x can be expressed as x t+n = x t 1 + r k  kn

• Under continuous compounding, a variable x is changing in value all the time.In other words unlike your bank account on which interest may be calculated annually or quarterly or monthly or daily, many economic variables are changing at every instant in time.

• We can think of continuous compounding as a special case of discrete compounding, where k approaches infinity. So the value, t periods from now, of a variable that is being compounded continuously at a rate r can be expressed as

x t+n = lim

k→∞ x t

 1 + r

k

 kn

(2)

• We can do a little bit of algebra and re-write this as

x t+n = lim

k r

→∞

x t

 1 + 1

k r

!

kr

rn

= x t

 lim

k r

→∞

 1 + 1

k r

!

kr

rn

= x t



z→∞ lim



1 + 1 z

 z  rn

where z = k r

• ‘e’ is a very special constant in mathematics, equal to 2.71828 · · · . e is more precisely defined as e = lim z→∞ 

1 + 1 z  z

. Using this result, the above simplifies to x t+n = x t e rn

• What this means is the following. Let y t be a discretely growing variable and let x t be a continuously growing variable. Suppose also that both variables grow at the same growth rate of r per period. Then, it must be the case that

y t+n = y t (1 + r) n x t+n = x t e rn

III. SOLVING FIRST ORDER LINEAR DIFFERENTIAL EQUATIONS

• A first order linear differential equation relates the continuous change in a variable to the levels of that variable and other exogenous variables. In other words a first order differential equation is of the form dy dt = f (y t , x t ) where x is a vector of exogenous variables.

• Define the following shorthand ‘dot’ notation dy dt ≡ ˙y. We can write this as ˙y t = f (y t , x t )

• A solution to a first order differential equation is the time path for the endogenous variable {y t }. We can find this time path by calculating the general solution which is the sum of the particular solution, y P and the homogenous solution, y H .

• The easiest differential equations to solve are first order linear differential equations of the form ˙ y = ay + b, where the slope and intercept terms are not functions of time.

Method 1: The General Method

• We can use the same general method that we used for solving difference equations, for solving differential equations of the form ˙ y = ay + b.

• Let’s begin by thinking about the homogenous solution, which solves ˙y H = ay H Rearranging, we get y y ˙

HH

= a.

• From the chain rule, we know that d ln(y H )

dt =  d ln(y H ) dy H

  dy H dt



 1 y H



( ˙ y H ) ≡  ˙y H y H



(3)

• So y ˙

H

y

H

= a is the same as d ln(y dt

H

) = a. Integrating both sides, Z  d ln(y H )

dt

 dt =

Z adt

ln y H t = at + C where C is an arbitrary constant y H t = e at+C

y H t = Ae at where A = e C

• Now let’s think of the particular solution, which can be ANY solution to the equation ˙y = ay + b. In the difference equation case, we calculated the particular solution by thinking about a solution where the y variable did not change over time. The analogy here is also to think about a constant value of y, i.e. set ˙ y = 0 . The particular solution is then y P = −b a . Combining we get the solution to the differential equation as y t = y H + y P or

y t = Ae at − b a

• We can evaluate at an initial value t = 0 (or a terminal value) to pin down the value of the constant term A. y 0 = A − b a ⇒ A = y 0 + a b So the solution to the differential equation is of the form:

y t =

 y 0 + b

a



e at − b a

• Note that we can verify that this is a solution to the differential equation by calculating

˙

y t = a y 0 + b a  e at and ay t + b = a y 0 + b a  e at − a a b  + b = a y 0 + a b  e at Example:

• Solve the differential equation ˙y = −0.1y + 5 where y 0 = 5.

• The homogenous solution y H , which solves ˙ y H = −0.1y H . The solution is of the form y H = Ae −0.1t where A is a constant. The particular solution we consider is one where y is constant.

So −0.1y P + 5 = 0 ⇒ y P = 50. By combining the particular and homogenous solutions we get y t = Ae −0.1t + 50.

• Since we know the value of y 0 we can pin down the value of A as y 0 ≡ A + 50 = 5 ⇒ A = −45.

So the solution to the differential equation is of the form y t = −45e −0.1t + 50

• You can then verify that ˙y = 4.5e −0.1t and that −0.1y+5 = −.1[−45e −0.1t +50]+5 = 4.5e −0.1t , thus ˙ y does indeed equal −0.1y t + 5

• MATLAB can also do symbolic differentiation. The command diff(expression,x,n) will dif- ferentiate the symbolic expression with respect to x, n times. If n is omitted, only the first derivative is calculated, so you can check the answers using MATLAB

Method 2: Solving by Integration

(4)

• In the difference equation case, in addition to using the general method we also discussed how to find the solution by repeated iteration.

• In the differential equation case, we can’t obviously use repeated substitution since we don’t have discrete time periods. Nevertheless, it is important to come up with an alternative solution method.

• That method is to use integration. How can we solve a simple differential equation of the form ˙ y t = ay t +b by integration? A little bit of rearranging and the judicious use of something called the integrating factor will do the trick.

˙

y t = ay t + b

˙

y t − ay t = b ( ˙ y t − ay t ) e −at = be −at

• Note that we moved the y term over but then multiplied both sides by e −at . This is known as the integrating factor.

• Now integrate both sides of the above with respect to t. We have Z

( ˙ y t − ay t ) e −at dt = Z

be −at dt Z d y t e −at 

dt dt = b

Z

e −at dt y t e −at = b e −at

−a + C ⇒ y t = − b

a + Ce at

• Plugging in t = 0 to eliminate the constant term, we get y 0 + a b = C. So the solution is y t =

 y 0 + b

a



e at − b a

• Note that this is the same solution as we had before. Note also that the general method is easier and should be used when b is constant. But if b = b(t) then the integration method can be used even when the general method can’t be. However coming up with integrating factors and figuring out the tricks of integration are quite hard in that case.

IV. DYNAMICS OF FIRST ORDER LINEAR DIFFERENTIAL EQUATIONS Steady State Value

• We can also calculate some features of the dynamic behavior of a variable As in the difference equation case we can look at the stability of the variable as well as its steady state value.

• The steady state value is a value at which the endogenous variable exhibits no dynamic

adjustment. In other words, given the differential equation ˙ y t = αy t + β, a steady state value

y exhibits the property that ˙ y t = 0 when y = y .

(5)

• In the differential equation ˙y t = αy t + β the steady state value is therefore y = −β α . In the differential equation ˙ y = −0.1y + 5, the steady state value is ˙ y = 0 ⇒ y = 50.

• As before, the existence of a steady state does not imply stability. Steady state simply states that if the endogenous variable reaches that value, then there will be no dynamic adjustment.

Stability

• A differential equation is said to be stable if lim t→∞ y t is a finite value. If lim t→∞ y t = ∞ or lim t→∞ y t = −∞, then the differential equation is said to be unstable.

• A stable difference equation will converge to a steady state value. For example, the differential equation ˙ y t = −0.1y t + 5 is stable because we can show using the solution y t = −45e −0.1t + 50 that lim t→∞ y t = 5

• For the general form ˙y t = αy t + β, which has the solution y t = h

y 0 + β α i

e α

t

β α , we can see that the differential equation will only be stable if α < 0 in which case the steady state will be

t→∞ lim y t = lim

t→∞

 y 0 + β

α



e α

t

− β α = − β

α

IV. LINEARIZATION

• This would also be a good time to learn another important concept, which is the idea of linearizing a model. By now, we have learned how to solve simple linear models using either linear algebra (if no dynamics) or difference equations (if discrete time dynamics are involved) or differential equations (if continuous time dynamics are involved). But many economic models are non-linear: the Solow model being perhaps the most prominent example.

• When faced with a computationally intensive non-linear model, particularly a dynamic model, a common practice is to linearize the model around its steady state. Another variant of this technique is to do a log-linearization. I will discuss how to do both below, and we can then apply those in our next class to work with the Solow model.

• Linearizing a model implies replacing the original non-linear equations with linear versions around some known point. The basic idea of linearization is to replace a non-linear function y = f (x) with a first-order Taylor series approximation around some point x = a.

• Recall that the Taylor series approximation of y = f (x) around x = a is y = f (a) + ∂f

∂x x=a

(x − a) + ∂ 2 f

∂x 2 x=a

(x − a) 2

2! + ∂ 3 f

∂x 3 x=a

(x − a) 3 3! + · · ·

• A first order Taylor series approximation is just y ≈ f (a) + ∂f

∂x x=a

(x − a)

(6)

• Let’s consider some examples. Suppose we have an equation of the form y = mx α + b. Then we would derive a linearized version of this model around some point x 0 as

y ≈ (mx α 0 + b) + (αmx α−1 0 )(x − x 0 )

• To see this more practically, let’s consider a linearized version of y = 3x 2 + 5 around the point x = 1. Using the above, the linearized version would be y ≈ 8 + 6(x − 1). Here’s how a plot of the two functions would like:

0 0.5 1 1.5 2

5 10 15

Plot of y = 3x 2 + 5 and Linear Approximation y = 8 + 6(x − 1) around x = 1

Log-Linearization

• Economists often use a variant of this technique called log-linearization. This would be something similar to the above, but aiming to take a function y = f (x) around some point x = a as a linear approximation in ln x rather than x. This is often done because a log difference is a percentage change, and we are interested in measuring the impact of some percentage change in the x variable.

• Formally, a log-linearization works as follows. Suppose y = f (x), and we want to express y as a linear function of ln x around the point (x=a). This would be (drawing an analogous expression from before)

y ≈ f (a) + ∂f

∂ ln x x=a

(ln x − ln a)

• Log-linearizations often seem very confusing, so an example is probably the best way to illustrate this technique is to go back to the same example. y = 3x 2 + 5 around x = 1. We have

y ≈ 8 + ∂f

∂ ln x x=1

(ln x − ln 1)

• Since ∂ ln x ∂f = (

∂f∂x

)

(

∂ ln x∂x

) ≡ (

∂f∂x

)

(

1x

) ≡ x ∂f ∂x , and 

∂f

∂x



= 6x we can express the above as y ≈ 8 + 6x 2

x=1 (ln x − ln 1) ≡ 8 + 6 ln x

(7)

0 0.5 1 1.5 2

−5 0 5 10 15

Plot of y = 3x 2 + 5, Linear y = 8 + 6(x − 1), and Log-Linear y = 8 + 6 ln x around x = 1

References

Related documents

I first discovered yoga in 1987 when I was pregnant with my daughter. I took a prenatal yoga class at the Tualatin Valley Rec Center in Beaverton. What struck me initially about

We have however extended further this design and analysis to explore the violations of the axioms of revealed preferences, and classify the subject pool among categories of

Seventy-seven percent of the isolates were identi�ed at least at species level (32% as variety or serotype, 23% as species, and 22% as molecular type), and 23% were reported

Here, we identify the HPV6 neutralization sites and discriminate the inhibition of virus attachment and entry by three potent neutralizing antibodies (nAbs), 5D3, 17D5, and

[r]

Outline Taylor Series Roots of Equations Linear Algebra Systems of Linear Equations.. Root Finders and Solving

Nalmefene is recommended as an option for reducing alcohol consumption, for people with alcohol dependence, who have a high drinking risk level (defined as alcohol.. consumption

The Sobel filter is an edge finding algorithm that is frequently used in computer vision as it can efficiently find edges in an imageN. In order to calculate the Sobel filter for