Jordan Lecture Note-6: The Solutions of Nonlinear Equation.
本文主要介绍几种用于解非线性方程$f(x)=0$的一些方法。
(1) Bisection Method.
算法:
step 1: 初始化$a,b(b>a)$,使$f(a),f(b)$异号。
step 2: while (停止条件不满足)
$p=a+\frac{b-a}{2}$;
若 $f(p)f(a)<0$,$b=p$;否则$a=p$。
end while
step 3: 返回的$p$为方程$f(x)=0$的解。
停止条件:
- \begin{equation}|p_N-p_{N-1}|<\epsilon\label{equ:bisection1}\end{equation} .
- \begin{equation}\frac{|p_N-p_{N-1}|}{|p_N|}<\epsilon\label{equ:bisection2}\end{equation}
- \begin{equation}|f(p_N)|<\epsilon\label{equ:bisection3}\end{equation}
若采用式子\ref{equ:bisection1}和\ref{equ:bisection2}作为停止的判断标准,会产生一种情况,即$\lim{n\to\infty}(p_n-p_{n-1})=0$,但序列$\{p_n\}$却发散。即算法可能会停止与$f(p_n)$不等与0处。如$p_n=\sum_{k=1}^n\frac{1}{k}$。若采用式子\ref{equ:bisection3}的判断标准,会产生一种情况,即$|f(p_n)|<\epsilon$,但$|p-p_n|$却很大。如$f(x)=(x-1)^10$,当$p_n=\frac{3}{2}$时$|f(p_n)|<10^{-3}$,但实际上正确解与$p_n$却相差$\frac{1}{2}$。
缺点:收敛太慢,为线性收敛。
(2) 固定点迭代(Fix-point iteration)。
定理:1)函数$g$的定义域为$[a,b]$,且对$\forall x\in[a,b], g(x)\in [a,b]$,那么$g$一定有fixed-point。
2)在$(a,b)$中$g^\prime(x)$存在,且存在$|g^\prime(x)|\leq k<1$,对$\forall x\in (a,b)$成立,那么在$[a,b]$内fixed-point唯一。
证明:1)如果$g(a)=a$或者$g(b)=b$,定理 1)成立。否则$g(a)>a,g(b)<b$,令$h(x)=g(x)-x, h(a)=g(a)-a, h(b)=g(b)-b<0$,根据中值定理,必然存在$p$使$h(p)=g(p)-p=0$。
2)假设$p,q$都是固定点,则$\exists\xi, \frac{g(p)-g(q)}{p-q}=g^\prime(\xi)$。因此:
$$|p-q|=|g(p)-g(q)|=|g^\prime(\xi)||p-q|\leq k|p-q|<|p-q|$$
于$k<1$矛盾,故$p=q$。
算法:
step 1: 初始化$p_0,\epsilon,N_0$;
step 2: for $i=1,...,N_0$
$p=g(p_0)$;
if $|p-p_0|<\epsilon$
break;
$p_0=p$;
end for
step 3: 输出解$p$.
例子:
如果要解决$f(x)=x^3+4x^2-10=0$这个方程,则可转化成$x=x+f(x)=x^3+4x^2+x-10$。
收敛分析:
满足在定义域$[a,b]$内$g(x)\in[a,b]$,并且$|g^\prime(x)|\leq k<1$,那么固定点算法一定收敛。
证明:$$|p_n-p|=|g(p_{n-1})-g(p)|=|g^\prime(\xi_n)||p_{n-1}-p|\leq k|p_{n-1}-p|$$
迭代$|p_n-p|\leq k^n(p_0-p)$,即$\lim_{n\to\infty}|p_n-p|\leq \lim_{n\to\infty}k^n|p_0-p|=0$
其中$k$的大小可以用来表示收敛的快慢,若$k$接近与1,则收敛的慢;若$k$接近于0则收敛的快。
(3)Newton-Raphson Method.
从Taylor展开式看:
$$f(x)=f(\bar{x})+(x-\bar{x})f^\prime(\bar{x})+\frac{(x-\bar{x})^2}{2}f^{\prime\prime}(\xi(x))$$
其中$\xi(x)$介于$x$与$\bar{x}$之间。所以:
$$f(p)=0=f(\bar{x})+(p-\bar{x})f^\prime(\bar{x})+\frac{(p-\bar{x})^2}{2}f^{\prime\prime}(\xi(x))$$
由于$|p-\bar{x}|$很小$\Longrightarrow$ $|p-\bar{x}|^2$更小 $\Longrightarrow$ 故可以近似成:
$$0\approx f(\bar{x})+(p-\bar{x})f^\prime(\bar{x})\Longrightarrow p=\bar{x}-\frac{f(\bar{x})}{f^\prime(\bar{x})}$$
从上式可以得到如下迭代式:
$$p_n=p_{n-1}-\frac{f(p_{n-1})}{f^\prime(p_{n-1})}$$
当$f^\prime(p_{n-1})=0$时就无法进行。有定理证明Newton-Raphson 方法在区间$[p-\delta,p+\delta]$内时一定会收敛到$p$,但并未给出如何寻找这样的$\delta$。
由于$f^\prime(x)$往往很难计算,故提供一种计算$f^\prime(x)$的近似方法。根据导数的定义:$f^\prime(p_{n-1})=\lim_{x\to p_{n-1}}\frac{f(x)-f(p_{n-1})}{x-p_{n-1}}$。
令$x=p_{n-2}$,得到$f^\prime(p_{n-1})=\frac{f(p_{n-2})-f(p_{n-1})}{p_{n-2}-p_{n-1}}$,故其对应的迭代式子:
$$p_n=p_{n-1}-\frac{f(p_{n-1})(p_{n-1}-p_{n-2})}{f(p_{n-1})-f(p_{n-2})}$$,
这种方法称为正割法(Secant method)。从直观上看:
根据Bisection方法的启示下可以得到一种新的迭代,称为试位法(False Position)。它的迭代式与Secant method一样,但在确定迭代式中的$p_0$与$p_1$时采用Bisection method中的方法,即保证新得到的点在$p_0$与$p_1$之间。
(4)关于收敛.
定义:假定$\{p_n\}_{n=0}^\infty$是一个收敛与$p$的序列,且$p_n\neq p$,如果存在正整数$\lambda$和$\alpha$,使$$\lim_{n\to\infty}\frac{|p_{n+1}-p_n|}{|p_n-p|^\alpha}=\lambda$$,那么$\{p_n\}_n^\infty$以order为$\alpha$收敛于$p$,$\lambda$为渐进错误。
当$\alpha=1$时为线性收敛;
当$\alpha=2$时为二次收敛。
理解:
假设$\{p_n\}_{n=0}^\infty$是线性收敛于0,$\lim_{n\to\infty}\frac{|p_{n+1}|}{|p_n|}=0.5$;若$\{p_n\}_{n=1}^\infty$是二次收敛于0,则$\lim_{n\to\infty}\frac{|p_{n+1}|}{|p_n|^2}=0.5$。很显然,二次收敛的速度要快于线性收敛。
Bisection method是线性收敛。Fixed-point iteration的收敛速度是根据函数$g(x)$而定,最优的情况下可以达到二次收敛。Newton-迭代在初始值选择合理的情况下可以达到二次收敛,但若初始值不合理,可能使Newton迭代发散,所以通常较好的做法是先用Bisection迭代一定次数得到的值作为Newton迭代的初始值。Secant Method的迭代order $\alpha=1.62$.
加速收敛:采用Aitken's $\Delta^2$ method加速收敛序列。
当$n$足够大时,对$\{p_n\}_{n=0}^\infty$有:
$$\frac{p_{n+1}-p}{p_n-p}\approx\frac{p_{n+2}-p}{p_{n+1}-p}\Longrightarrow (p_{n+1}-p)^2\approx(p_{n+2}-p)(p_n-p)$$,
所以$p_{n+1}^2-2p_{n+1}p+p^2\approx p_{n+2}p_n-(p_n+p_{n+2})p+p^2$
$$\Longrightarrow (p_{n+2}+p_n-2p_{n+1})p\approx p_{n+2}p_n-p_{n+1}^2$$
\begin{align*}\Longrightarrow p&\approx \frac{p_{n+2}p_n-p_{n+1}^2}{p_{n+2}-2p_{n+1}+p_n}\\&\approx \frac{p_{n+2}p_n-2p_{n+1}p_n+p_n^2+2p_{n+1}p_n-p_n^2-p_{n+1}^2}{p_{n+2}-2p_{n+1}+p_n}\\&\approx \frac{p_n(p_{n+2}-2p_{n+1}+p_n)-(p_n^2-2p_{n+1}p_n+p_{n+1}^2)}{p_{n+2}-2p_{n+1}+p_n}\\&\approx p_n-\frac{(p_n-p_{n+1})^2}{p_{n+2}-2p_{n+1}+p_n}\end{align*}
Aitken's $\Delta^2$ method 的迭代序列为:
\begin{equation}\tilde{p_n}=p_n-\frac{(p_{n+1}-p_n)^2}{p_{n+2}-2p_{n+1}+p_n}\label{equ:aitken}\end{equation}
大概的证明过程如下:
由$\lim_{n\to\infty}\frac{p_{n+1}-p}{p_n-p}=\lambda$且$\lim_{n\to\infty}\frac{\tilde{p_{n+1}}-p}{p_{n+1}-p}=0, \tilde{p_{n+1}}-p=\mathcal{O}(p_{n+1}-p)$
$$\Longrightarrow \lim_{n\to\infty}\frac{\tilde{p_{n+1}}-p}{\tilde{p_n}-p}=0\Longrightarrow \exists\alpha>0,\lambda, \lim_{n\to\infty}\frac{\tilde{p_{n+1}}-p}{(\tilde{p_n}-p)^\alpha}=\lambda$$
由于Aitken's $\Delta^2$ method 需要初始化三个值,故结合fixed-point method得到 Steffensen's method。初始化一个$p_0^{(0)}, p_1^{(1)}=g(p_0^{(0)}), p_2^{(0)}=g(p_1^{(0)})$, 用Aitken's $\Delta^2$ method迭代式计算$p_0^{(1)}$......
(5)Fisher Scoring迭代。
它是用于解决最大似然方程的一种迭代。由于Newton-Raphson迭代算法对初始值的要求很高,当初始值选的不合理时会产生震荡现象,导致算法无法收敛,而用Fisher Scoring迭代则解决了上诉问题。
使用Newton-Raphson求最大似然估计值,设log似然函数为$l(\theta)$,
其梯度向量:$\nabla l(\theta^t)=[\frac{\partial l}{\partial \theta}]_{\theta^t}$;
海森矩阵:$H(\theta^t)=[\frac{\partial^2l}{\partial\theta_i\partial\theta_j}]_\theta^t$
$l(\theta)$在$\theta^t$处的泰勒展开:
$$l(\theta)=l(\theta^t)+\nabla l(\theta^t)(\theta-\theta^t)+\frac{1}{2}H(\theta^t)(\theta-\theta^t)^2$$
求导:$\frac{\partial l}{\partial\theta}=\nabla l(\theta^t)+H(\theta^t)(\theta-\theta^t)=0$
$\Longrightarrow \theta^{t+1}=\theta^t-[H(\theta^t)]^{-1}\nabla l(\theta^t)$
上述方法的缺点:
- 计算量太大,主要是要计算嗨森矩阵。
- 当$H(\theta^t)$不可逆,或$|H(\theta^t)|\approx 0$时,会产生震荡现象。当$\theta^t$在$\theta^*$附近处$H(\theta^t)$很小,则$\theta^{t+1}=\theta^{t}-\frac{dl/d\theta}{H(\theta^t)}$会变化很大。
Jordan Lecture Note-6: The Solutions of Nonlinear Equation.的更多相关文章
- Jordan Lecture Note-1: Introduction
Jordan Lecture Note-1: Introduction 第一部分要整理的是Jordan的讲义,这份讲义是我刚进实验室时我们老师给我的第一个任务,要求我把讲义上的知识扩充出去,然后每周都 ...
- Jordan Lecture Note-3: 梯度投影法
Jordan Lecture Note-3:梯度投影法 在这一节,我们介绍如何用梯度投影法来解如下的优化问题: \begin{align} \mathop{\min}&\quad f(x)\n ...
- Colorful Lecture Note(手工栈)
题目1 : Colorful Lecture Note 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Little Hi is writing an algorithm ...
- HihoCoder - 1103 Colorful Lecture Note
Little Hi is writing an algorithm lecture note for Little Ho. To make the note more comprehensible, ...
- Colorful Lecture Note
Colorful Lecture Note 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Little Hi is writing an algorithm lectu ...
- hihocoder #1103 : Colorful Lecture Note微软苏州校招笔试 1月10日(字符串处理+栈)
#1103 : Colorful Lecture Note 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Little Hi is writing an algorit ...
- [lightoj P1306] Solutions to an Equation
[lightoj P1306] Solutions to an Equation You have to find the number of solutions of the following e ...
- Solutions to an Equation LightOJ - 1306
Solutions to an Equation LightOJ - 1306 一个基础的扩展欧几里得算法的应用. 解方程ax+by=c时,基本就是先记录下a和b的符号fla和flb(a为正则fla为 ...
- 1306 - Solutions to an Equation
1306 - Solutions to an Equation PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Lim ...
随机推荐
- LeetCode Summary Ranges (统计有序数列范围)
题意:给出个有序不重复数列(可能负数),用缩写法记录这个数列. 思路:找每个范围的起始和结束即可. class Solution { public: vector<string> summ ...
- 【转】【iOS】导航栏那些事儿
原文网址:http://www.jianshu.com/p/f797793d683f 参考文章 navigationItem UINavigationItem UINavigationBar UIBa ...
- JS中图片的放大缩小没反应
这段代码无反应: 代码如下: <script type="text/javascript"> onload = function () { document.getEl ...
- linux 查看用户所在组(groups指令的使用) 含实例
经常将某个文件夹的权限赋给某个用户的时候,也需要配置该用户所在的组,因此,我们需要查看该用户有哪些组,我们可以使用如上命令查看用户所在组 [oracle@gl ~]$ vi /etc/group ro ...
- longblogV1.0——我的静态博客发布系统
longblogV1.0——我的静态博客发布系统 环境依赖: python3-markdown 作者:IT小小龙个人主页:http://long_python.gitcafe.com/电子邮箱:lon ...
- bzoj 2588 Spoj 10628. Count on a tree(主席树)
Description 给定一棵N个节点的树,每个点有一个权值,对于M个询问(u,v,k),你需要回答u xor lastans和v这两个节点间第K小的点权.其中lastans是上一个询问的答案,初始 ...
- Tcp服务端判断客户端是否断开连接
今天搞tcp链接弄了一天,前面创建socket,绑定,监听等主要分清自己的参数,udp还是tcp的.好不容易调通了,然后就是一个需求,当客户端主动断开连接时,服务端也要断开连接,这样一下次客户端请求链 ...
- EasyUI + Spring MVC + hibernate实现增删改查导入导出
(这是一个故事--) 前言 作为一个JAVA开发工程师,我觉得最基本是需要懂前端.后台以及数据库. 练习的内容很基础,包括:基本增删改查.模糊查询.分页查询.树菜单.上传下载.tab页 主管发我一个已 ...
- 谷歌官方刷新组件SwipeRefreshLayout
今天开始使用谷歌的SwipeRefreshLayout,会记下一些坑 1.手动调用setRefreshing(true)不会出现刷新动画 原因是:SwipeRefreshLayout indicato ...
- jquery中 cache: true和false的区别
true:会读缓存,可能真的到服务器上. 假如上次访问了a.html,第二次的时候得到的是上次访问的a.html的结果,而不是重新到服务器获取. false:会在url后面加一个时间缀,让它跑到服务器 ...