Anda di halaman 1dari 21

numerical methods for

differential equations and


applications

Supervisor: Camile Fraga Delfino Kunz

October 30th, 2018


What do we have for today?

I Linear difference equations theory and applications.


I Some exercises.
Difference Equations

Definitions
I A sequence (yn )n≥0 is an infinity list of terms
y0 , y1 , y2 , . . ..
I A difference equation express a relationship between
terms of a sequence (yn )n≥0 .
I Examples:

yn+1 = yn
yn+1 = r yn (1 − yn )
Difference Equations
A general m-th order homogeneous linear difference equation
with constant coefficients can be written in the form

am yn+m + am−1 yn+m−1 + . . . + a1 yn+1 + a0 yn = 0

Observe that if the order is m, we need m initial conditions to


the sequence (yn ) be uniquely defined.

The nonhomogeneous linear difference equation is written as

am yn+m + am−1 yn+m−1 + . . . + a1 yn+1 + a0 yn = r (n)

where r (n) is an arbitrary function.


Difference Equations

Classification
We indicate for each of the following difference equations its
order and whether it is linear or not.
I yn+1 − 3yn + yn−1 = e n (second order, linear)
I yn+1 = yn2 (first order, nonlinear)
I yn+4 − yn = n 2n (fourth order, linear)
I yn+3 = cos yn (third order, nonlinear)
n
I yn+2 + (3n − 1)yn+1 − y
n+1 n
=0 (second order, linear)
Difference Equations
1st order (homogeneous)
Consider the simple equation Mn+1 = aMn . We get

yn = ayn−1 = a(ayn−2 ) = . . . = an y0

The general solution for this kind of equation is given by


yn = C λn , where C is some constant. Substituting on
Mn+1 = aMn ,
Mn+1 − aMn = 0
C λn+1 − aC λn = 0
C λn (λ − a) = 0
λ=a

By simple calculations we can show that C = y0 . Therefore,


the solution is in fact yn = an y0 .
Difference Equations

1st order (nonhomogeneous)


Consider now the equation Mn+1 − aMn = n .

What is the solution?


The solution of the nonhomogeneous equation will be the sum
of the solution from the homogeneous and a particular
solution. It happens because for a linear equation we have the
linear superposition principle, that is, the sum of solutions is
also a solution.
Difference Equations
1st order (nonhomogeneous)
Consider now the equation Mn+1 − aMn = n .
We have already calculated the solution for the homogeneous
equation. Let us now try to find a particular solution.
We suppose that the solution looks like yn = An + B.
Substituting on the original equation:
A(n + 1) + B − a(An + B) = n
(
A(1 − a) = 1

A + B(1 − a) = 0
1 1
Solving for A and B we get A = and B = , so:
1−a (1 − a)2
1 1
yn = a y 0 + n −
1−a (1 − a)2
Difference Equations
2nd order
For difference equations of second order the actual generation
depends on two generations before:
xn + bxn−1 + cxn−2 = 0

Considering the general solution xn = C λn , and substituting


on the difference equation, we get the following polynomial:
P(λ) = λ2 + bλ + c = 0
We have the following possible solutions depending on the
roots of P,
I if λ1 6= λ2 are real: xn = C1 λn + C2 λn
1 2
I if λ1 = λ2 = λ: xn = C1 λn + C2 nλn

I if λ1 , λ2 are complex: λ1 = a + bi and λ1 = a − bi and


xn = C1 λn1 + C2 λn2 .
Difference Equations

Real roots
I The second order difference equations have two solutions,
and the sum of the solutions is also a solution.
I We also want that these solutions is a linearly
independent set.
I When we have real roots λ1 and λ2 , they can be equal or
different.
I For equal roots, it is not possible to have a linearly
independent set on the same way for different roots, that
is why, when the roots are equal, we write the solution
xn = C1 λn1 + C2 nλn2 .
Difference Equations
Complex roots
When the roots are complex, they occur in conjugate pairs:
λ1 = a + bi and λ2 = a − bi.
In this case it is necessary to make sense of general solutions
that involve powers of complex numbers:
xn = C1 (a + bi)n + C2 (a − bi)n
We can make
( a change of coordinates
( from (a, b) to (r , θ):
p
a = r cos θ r = (a2 + b 2 )

b = r sin θ θ = arctan (b/a)

Using the Euler’s theorem, we can summarize these relations:


a + bi = r (cos θ + i sin θ) = r e iθ
a − bi = r (cos θ − i sin θ) = r e −iθ
Difference Equations
Complex roots
Using the De Moivre’s formula, we know write the power of a
complex number:
(a + bi)n = (r e iθ )n = r n e inθ = r n (cos nθ + i sin nθ)

Now we can rewrite the solution as


xn = C1 (a + bi)n + C2 (a − bi)n
= C1 r n (cos nθ + i sin nθ) + C2 r n (cos nθ − i sin nθ)
= B1 r n cos nθ + iB2 r n sin nθ

where B1 = C1 + C2 and B2 = C1 − C2 .
Thus xn has a real part and an imaginary part.
Difference Equations
Complex roots
For
un = r n cos nθ
vn = r n sin nθ

we have xn = B1 un + i B2 vn .
It can be proved that the real and the imaginary parts of this
complex solution are themselves solutions. It is then usual to
define a real-valued solution by linear superposition of the real
quantities un and vn :
xn = A1 un + A2 vn
= r n (A1 cos nθ + A2 sin nθ)
Difference Equations

Complex roots
Complex eingenvalues are associated to oscilatory solutions.
These solutions have a growing amplitude if r > 1 and
decreasing amplitude if r < 1, and constant amplitude if
r = 1. The frequency of oscilation depends on the ratio b/a.
Difference Equations
Example: complex roots
The difference equation
xn+2 − 2xn+1 + 2xn = 0

has a characteristic equation


λ2 − 2λ + 2 = 0

with the complex conjugate roots λ = 1 ± i. Thus a = 1 and


b = 1, so that, p √
r = (a2 + b 2 ) = 2
θ = arctan (b/a) = π/4

Thus the real-valued general solution to the equation is



xn = ( 2)n [C1 cos (n π/4) + C2 sin (n π/4)]
Difference Equations
Systems of linear difference equations
Consider the two equations system:

xn+1 = a11 xn + a12 yn
yn+1 = a21 xn + a22 yn

This system can be written in vector notation as Vn+1 = MVn ,


where    
x n a11 a12
Vn = y and M =
n a21 a22

The solution to this system are of the form


 
n
Vn = BλnAλ
Difference Equations

Systems of linear difference equations


So we can rewrite the system as:
    
Aλn+1 = a11 a12 Aλn
Bλn+1 a21 a22 Bλn

We expand the right hand side to get


Aλn+1 = a11 Aλn + a12 Bλn
Bλn+1 = a21 Aλn + a22 Bλn

We can cancel the term λn and arrive at the following system:


0 = A(a11 − λ) + B(a12 )
0 = A(a21 ) + B(a22 − λ)
Difference Equations
Systems of linear difference equations
So we can rewrite the system as:
    
0 = a11 − λ a12 A
0 a21 a22 − λ B

These are now equations on A and B. One solution is


A = B = 0, which leads to the trivial solution V = 0. To have
nonzero solutions for A and B we must set the determinant of
the coefficients matrix to zero:
 
a11 − λ a12
det = 0
a21 a22 − λ

This leads to
(a11 − λ)(a22 − λ) − a12 a21 = 0
Difference Equations

Systems of linear difference equations


Corresponding
  to each eigenvalue λi is a eigenvector
Ai
vi = that satisfies:
Bi
Mvi = λi vi

For each λi we find the eigenvalue vi by solving the system:


  
a11 − λi a12 Ai
= 0
a21 a22 − λi Bi

Thus the solution for the system will be given by

Vn = C1 v1 λn1 + C2 v2 λn2
Exercise

1) The Fibonacci’s sequence is given by {1, 1, 2, 3, 5, . . .} and


can be writen as the difference equation:
un = un−1 + un−2 , given that u0 = 1 and u1 = 1.

Find the solution of this second order equation.

2) Find the solution for the system



pn+1 = fan
an+1 = r (1 − m)fan

Considering a0 = 2, pn = 10, m = 0.1, f = 10 and r = 0.6.


References

1. Edelstein-Keshet, L. Mathematical Models in Biology.


SIAM, 2005.

2. Meyer, C. Matrix Analysis and Applied Linear Algebra.


SIAM, 2000.

Anda mungkin juga menyukai