Newton-Raphson Method估算函数的根
Newton-Raphson Method 曲线f(x)有根c,取曲线上一点(x1,f(x1)),过此点的切线交x轴x2,过曲线上(x2,f(x2))的切线交x轴x3,如此反复得到一个序列x1,x2,...,xn逼近c值,过(xn,f(xn))的切线方程为y-f(xn) = f'(xn)(x-xn),假设此方程与x轴的交点为xn+1,即有0 - f(xn) = f'(xn)(xn+1 -...
View Article用中值定理求根
翻看了以前写的使用Newton-Raphson Method求一个数的开方,想到其实也可以用中值定理来实现。 中值定理:f(x)是一个连续性的函数,在[u,v]区间内,当c的值位于f(u)和f(v)之间时,至少存在一个点,满足f(x) = c 当f(u)和f(v)一正一负时,那么在[u,v]之间至少有一个根的存在,这个定理本来就是拿来证明根的存在的,但是其实也可以用来求解根。...
View Article用Taylor公式估计函数值
最近在看微积分,刚看到Taylor theorem,本科用的是阉割版的农科教材,竟然没讲这么个超级经典的方法。 efv <- function(f, value,variable="x", a=0, eps=0.001) { #estimate function value using Taylor theorem assign(eval(variable), a) fv.old <-...
View Articleuse Maxima之初等代数篇
准备写个maxima的小教程。maxima是一个计算机代数系统(Computer Algebra System),用于公式推导、符号计算、数值计算等,Maxima的前身是Macsyma,Macsyma由MIT在60年代末所开发,用LISP实现。Maxima应该是开源CAS里最广为人知的,不过它的功能不是最强的。最强大的是IBM的Axiom, 此外还有SINGULAR和Yacas等其它几个CAS。...
View ArticleRoot finding
Numerical root finding methods use iteration, producing a sequence of numbers that hopefully converge towards a limits which is a root. In this post, only focus four basic algorithm on root finding,...
View Articleone-dimensional integrals
The foundamental idea of numerical integration is to estimate the area of the region in the xy-plane bounded by the graph of function f(x). The integral was esimated by divide x to small intervals,...
View ArticleSingle variable optimization
Optimization means to seek minima or maxima of a funtion within a given defined domain. If a function reach its maxima or minima, the derivative at that point is approaching to 0. If we apply...
View ArticleMC积分
Monte Carlo方法由冯·诺伊曼于二战时提出,1777年法国人布丰用此思路估计pi值被认为是Monte Carlo的起源,这个方法简单又快速,通过产生随机数,将数值计算问题变成随机变量的某些特征值(比如期望值)。 积分运算,和估计pi值一样,用hit and miss法估计。 hit_miss hit and miss方法收敛太慢,效率并不高,通常所说的MC积分是指下面这个方法。...
View Article
More Pages to Explore .....