Docsity

Solving Difference Equations: Method and Examples, Study notes of Algorithms and Programming

Toggle sidebar
bg1
11/1/2002
1
1
Difference Equations
Solve fn= fn-1 + fn-2f0= 2, f1= 1
Step 1: Find Roots
fn=fn-1 +fn-2
fn- fn-1 - fn-2= 0
λ2-λ-1 = 0
(1±√(12-4*1*(-1)))/(2*1) = (1±√5)/2
⇒λ1= (1+√5)/2, λ2= (1-√5)/2
2
Step 2: Find General Solution
fn= a1λ1n+ a2λ2n
substitute in initial conditions and solve
n = 0: f0= 2 = a1λ10+ a2λ20= a1+ a2
2 -a1 = a2
n = 1: f1= 1 = a1λ11+ a2λ21
1 = a1λ1+ (2 -a1)λ2
1 = a1λ1+ 2 λ2-a1λ2
1 -2 λ2= (λ1 -λ2) a1
a1 = (1 -2 λ2)/ (λ1 -λ2)
a1= 1 ⇒a2= 2 -1 = 1
⇒fn= 1*λ1n+ 1*λ2n= ((1+√5)/2)n+ ((1-√5)/2)n
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Solving Difference Equations: Method and Examples and more Study notes Algorithms and Programming in PDF only on Docsity!

1

Difference Equations

Solve fn = fn-1 + fn-2 f 0 = 2, f 1 = 1 Step 1: Find Roots fn = fn-1 + fn- fn - fn-1 - fn-2 = 0 λ^2 - λ - 1 = 0 (1±√(1^2 - 41(-1)))/(2*1) = (1±√5)/ ⇒λ 1 = (1+√5)/2, λ 2 = (1-√5)/

2

Step 2: Find General Solution fn = a 1 λ 1 n^ + a 2 λ 2 n substitute in initial conditions and solve n = 0: f 0 = 2 = a 1 λ 10 + a 2 λ 20 = a 1 + a 2 2 - a 1 = a 2 n = 1: f 1 = 1 = a 1 λ 11 + a 2 λ 21 1 = a 1 λ 1 + (2 - a 1 ) λ 2 1 = a 1 λ 1 + 2 λ 2 - a 1 λ 2 1 - 2 λ 2 = (λ 1 - λ 2 ) a 1 a 1 = (1 - 2 λ 2 )/ (λ 1 - λ 2 ) a 1 = 1 ⇒ a 2 = 2 - 1 = 1 ⇒ fn = 1λ 1 n^ + 1λ 2 n^ = ((1+√5)/2)n^ + ((1-√5)/2)n

3

Solve xn = xn-1 + 2xn-2 x 0 = 1, x 1 = 1 Step 1: Find Roots xn = xn-1 + 2xn- xn - xn-1 - 2xn-2 = 0 λ^2 - λ - 2 = 0 (1±√(1^2 - 41(-2)))/(2*1) = (1±√9)/ ⇒ λ 1 = (1+√9)/2 = 2, λ 2 = (1-√9)/2 = - Step 2: Find General Solution xn = a 1 λ 1 n^ + a 2 λ 2 n substitute in initial conditions and solve

4

n = 0: x 0 = 1 = a 1 λ 10 + a 2 λ 20 1 = a 1 + a 2 1 - a 1 = a 2 n = 1: x 1 = 1 = a 1 λ 11 + a 2 λ 21 1 = a 1 λ 1 + (1 - a 1 )λ 2 1 = a 1 λ 1 + λ 2 - a 1 λ 2 1 - λ 2 = (λ 1 - λ 2 ) a 1 a 1 = (1 - λ 2 )/ (λ 1 - λ 2 ) a 1 = (1 - (-1))/(2 - (-1)) = 2/ ⇒ a 2 = 1 - 2/3 = 1/ ⇒ xn = 2/3 λ 1 n^ + 1/3 λ 2 n^ = 2/3(2)n^ + 1/3(-1)n

7

Forcing Functions

Equations of the form: xn = ∑ cixn-i + g(n) where g(n) is the forcing function

n i=

Forcing function

Homogeneous part

Output of equation Output will look like either the homogeneous solution or the forcing function, which ever is larger

8

Solve: xn = 3xn-1 + 5 x 0 = xn = hn + vn hn = 3hn- vn = 3vn-1 + 5 Step 1: Find Roots hn = 3hn- hn - 3hn-1 = 0 λ - 3 = 0 λ = 3 ⇒ hn = a 13 n

9

Step 2: Find Particular Solution vn = 3vn-1 + 5 Guess vn = general equation of same form as forcing function GUESS: vn = c where c = constant Solve for variables by substituting in guess vn = 3vn-1 + 5 c = 3c + 5 -2c = 5 c = -5/ Substitute results into the guess equation ⇒ vn = -5/

10

Step 3: Find General Solution hn = a 13 n xn = hn + vn xn = a 13 n^ - 5/ substitute in initial conditions and solve n = 0: x 0 = 1 = a 130 - 5/ 1 = a 1 - 5/ 7/2 = a 1 ⇒ xn = 7/2 * 3n^ - 5/

13

c 1 n + c 0 = 3c 1 n - 3c 1 + 3c 0 + 2n - 4 pull out terms by their power n: c 1 n = 3c 1 n + 2n c 1 = 3c 1 + 2 -2 = 2 c 1 c 1 = - 1: c 0 = - 3c 1 + 3c 0 - 4 c 0 = - 3(-1) + 3c 0 - 4 //sub in answer c 0 = 3 + 3c 0 - 4 -2 c 0 = - 1 c 0 = 1/ ⇒ vn = c 1 n + c 0 = -1n + 1/2 = -n + 1/

Equation from last slide:

14

if ax^3 +bx^2 + cx + d = ex^3 + fx^2 + gx + h this means that they = 0 for the same values of n. Therefore, 0 = ax^3 + bx^2 + cx + d 0 = ex^3 + fx^2 + gx + h this means that a = e, b = f, c = g, and d = h otherwise the polynomials wouldn’t be equal

Why Can Break Up By Powers

15

Step 3: Find General Solution hn = a 13 n xn = hn + vn xn = a 13 n^ - n + 1/ substitute in initial conditions and solve n = 0: x 0 = 1 = a 130 - 0 + 1/ 1 = a 1 + 1/ 1/2 = a 1 ⇒ xn = 1/2 * 3n^ - n + 1/

16

Solve xn = 3xn-1 + 2n^ x 0 = 1

xn = hn + vn hn = 3hn- vn = 3vn-1 + 2n

Step 1: Find Roots hn = 3hn- hn - 3hn-1 = 0 λ - 3 = 0 λ = 3 ⇒ hn = a 13 n