Notes on Difference Equations (1)

(This part mainly discusses dynamics of first-order difference equations)

1.1 Introduction

x(n+1) = f(x(n)) \tag{1.1.1}

(Time-invariant) difference equations and discrete dynamical systems represents two sides of the same coin.

1.2 Linear First-Order Difference Equations

Homogeneous FOE:
x(n+1) = a(n) x(n) \tag{1.2.1}
Non-homogeneous FOE:
x(n+1) = a(n) x(n) + g(n) \tag{1.2.2}
Important Cases
y(n+1) = ay(n) + g(n), \quad y(0) = y_0 \tag{1.2.3}
The solution is given by
y(n) = a^n y_0 + b[\frac{a^n-1}{a-1}], \quad if \quad a\neq1 \tag{1.2.4}
Notice that the solution of nonhomogeneous differential equation
\frac{dy}{dt} = ay(t) + g(t), \quad y(0) = y_0 \tag{1.2.5}
is given by
y(t) = e^{at} y_0 + \int_0^t e^{a(t-s)}g(s) ds \tag{1.2.6}

1.3 Equilibrium Points

What is the equilibrium point?

Definition 1: (Equilibrium Points) A point x^{*} in the domain of f is said to be an equilibrium point if it is a fixed point of f, i.e., f(x^*) = x^*.

Definition 2: (Eventually Equilibrium Points) Let x be a point in the domain of f. If there exists a positive integer r and an equilibrium point x^{*}, such that f^r(x) = x^{*}, f^{r-1}(x) \neq x^{*}, then x is an eventually equilibrium (fixed) point.

Stability of the equilibrium point

Definition 3

(a) The EP x^{*} is stable if given \varepsilon > 0 there exists \delta > 0 such that |x_0 - x^*| < \delta implies |f^n(x_0) - x^*| < \varepsilon for all n > 0.

(b) The point x^* is said to be attracting if there exists \eta > 0 such that

|x(0) - x^*| < \eta implies \lim_{n \to \infty}(x_n) = x^{*}.

If \eta = \infty, x^* is called global attractor.

(c) The point x^{*} is an asymptotically stable equilibrium point if it is stable and attracting.

If \eta = \infty, x^* is said to be globally asymptotically stable.

To determine the stability of an EP from these definitions may prove to be a mission impossible in many cases. This is due to the fact that we may not be able to find the solution in a closed form for most equations.

The simplest bur most powerful tools are graph techniques.

1.4 Criterion for the Asymptotic Stability of Equilibrium Points

Theorem 1: Let x^{*} be an EP of the difference equation
x(n+1) = f(x(n)) \tag{1.4.1}
where f is continuously differentiable at x^{*}. The following statements then hold true:

(i) If |f'(x^*)| < 1, then x^* is asymptotically stable.

(ii) If |f'(x^*)| > 1, then x^* is unstable.

Theorem 2: Suppose f'(x^*) = 1. The following statements then hold:

(i) If f''(x^*) \neq 0, then x^* is unstable.

(ii) If f''(x^*) = 0 and f'''(x^*) > 0, then x^* is unstable.

(iii) If f''(x^*) = 0 and f'''(x^*) < 0, then x^* is asymptotically stable.

1.5 Periodic Points and Cycles

Definition 4: Let b in the domain of f. Then:

(i) b is called a periodic point of f if for some positive integer k, f^k(b) = b. Hence a point is k-periodic if it is a fixed point of f^k, that is, if it is an EP of the difference equation
x(n+1) = g(x(n)) \tag{1.5.1}
where g = f^k.

The periodic orbit of b, O(b) = \{b, f(b), f^2(b), ...,f^{k-1}(b)\} is called a k-cycle.

(ii) b is called eventually k-periodic if for some positive integer m, f^m(b) is a k-periodic point. In other words, b is eventually k-periodic if
f^{m+k}(b) = f^m(b)
Stability of Periodic Points

Definition 1.20 Let b be a k-period point of f. Then b is:

(i) stable if it is a stable fixed point of f^k

(ii) asymptotically stable if it is an asymptotically stable fixed point of f^k

(iii) unstable if it is an unstable fixed point of f^k

REFERENCE

Elaydi S N. An Introduction to Difference Equations[M]. 2011.


要对经济动力系统进行研究,就离不开对差分方程问题的讨论。特别是经济中所出现的经济周期等现象,更有可能与差分方程系统的性质有着密切联系,因此,我选择Elaydi (2011)进行阅读与研究,为差分方程方面的技术打基础。

上面是对Elaydi (2011) 第一章的简要总结,当然还有关于周期解的稳定性的讨论以及虫口模型的内容还没有加入进来,因为定理的内容比较复杂,所以等以后有时间再加入整理也好。关于一阶差分方程,这一章讨论的主要问题就是不动点(Equilibrium Point)与周期性,而周期性问题又可以拆解为不动点问题。学了这一章之后,大概了解了:

  • 差分方程的定义
  • 一阶差分方程与微分方程之间的联系
  • 不动点的定义
  • 不动点的稳定性
  • 差分方程的周期性
  • 周期点的稳定性

为了更直观的了解差分方程的性质,我们可以利用程序模拟差分方程的解。

import numpy as np
import matplotlib.pyplot as plt

首先,我们定义差分方程函数,这个函数应当给定其函数形式与初始值之后,可以生成orbits.

# Basic Blocks of Difference Equations
def iter_func(var):
    """ Define the iterative function in difference equations.
        Given args of the function, it returns the value of the calculus.
    """
    if 0 <= var <= (1/2):
        return 2 * var
    elif (1/2) < var <= 1:
        return 2 * (1 - var)
def diff_eq(iter_func, init_val=0,  num=100):
    """ Define difference equations.
        Given the function form and initial value of the equation,
        it returns sereis of solutions of the equation.
        Length of the series is controled by num.
    """
    orb = list(range(num))
    orb[0] = init_val
    for i in range(1, num):
        orb[i] = iter_func(orb[i-1])
    return orb

我们定义一个函数来绘制我们所生成的orbits

def draw_series(series):
    """ Draw the series of orbits
    """
    n = range(len(series))
    fig = plt.figure(1)
    ax = plt.subplot(1,1,1)
    ax.plot(n, series)
    plt.xlabel('n')
    plt.ylabel('x(n)')
    plt.show()
x = diff_eq(iter_eq, 0.2)
draw_series(x)

可以看出,这个差分方程在给定初始值0.2的情况下,经过不断地震荡,最终收敛到0.

output_6_0.png

下面我们通过一个函数绘制图像,帮我们找到一个差分方程的不动点。

#Find Equilibrium Point
def find_EP(iter_eq):
    """ Given the form of the equation,
    it helps to find EP by the graph.
    """
    x = np.linspace(0,1,100)
    viter_eq = np.vectorize(iter_eq)
    y = viter_eq(x)
    
    fig = plt.figure(1)
    ax = plt.subplot(1,1,1)
    ax.plot(x,x)
    ax.plot(x,y)
    plt.show()
find_EP(iter_eq)

通过图像可以看出,不动点有两个,一个是0,另一个在0.6到0.8之间(2/3)。

output_9_0.png

下面我们通过图像来进行相图分析,来观察不动点的稳定性。

# Stair-step Analysis
def stair_step(iter_func):
    """ Presenting the stair step diagram of the
    difference equation.
    """
    x = np.linspace(0,1,100)
    viter_eq = np.vectorize(iter_func)
    y = viter_eq(x)
    
    ssd = diff_eq(iter_func, 0.2)
    h = np.zeros(2 * len(ssd) - 1)
    v = np.zeros(2 * len(ssd) - 1)
    v[0] = 0
    for i in range(0, len(h)-1):
        h[i] = ssd[i // 2]
    for i in range(1, len(v)-1):
        v[i] = ssd[(i+1) // 2]
        
    fig = plt.figure(1)
    ax = plt.subplot(1,1,1)
    ax.plot(h, v, '^--')
    ax.plot(x,x)
    ax.plot(x,y)
    plt.show()
        
stair_step(iter_eq)
output_12_0.png

可以看出,当x 靠近0.5的时候很容易被发散到1,进而导致迭代值为0,这与我们之前的直觉也是一致的。

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,911评论 5 460
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 82,014评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 142,129评论 0 320
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,283评论 1 264
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,159评论 4 357
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,161评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,565评论 3 382
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,251评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,531评论 1 292
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,619评论 2 310
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,383评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,255评论 3 313
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,624评论 3 299
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,916评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,199评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,553评论 2 342
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,756评论 2 335

推荐阅读更多精彩内容