http://mathworld.wolfram.com/Erf.html

 

Erf

DOWNLOAD Mathematica Notebook EXPLORE THIS TOPIC IN the MathWorld Classroom Erf

erf(z) is the "error function" encountered in integrating the normal distribution (which is a normalized form of the Gaussian function). It is an entire function defined by

 erf(z)=2/(sqrt(pi))int_0^ze^(-t^2)dt.
(1)

Note that some authors (e.g., Whittaker and Watson 1990, p. 341) define erf(z) without the leading factor of 2/sqrt(pi).

Erf is implemented in Mathematica as Erf[z]. A two-argument form giving erf(z_1)-erf(z_0) is also implemented as Erf[z0, z1].

Erf satisfies the identities

erf(z)=1-erfc(z)
(2)
=(2z)/(sqrt(pi))_1F_1(1/2;3/2;-z^2)
(3)
=(2ze^(-z^2))/(sqrt(pi))_1F_1(1;3/2;z^2),
(4)

where erfc(z) is erfc, the complementary error function, and _1F_1(a;b;z) is a confluent hypergeometric function of the first kind. For z>0,

 erf(z)=pi^(-1/2)gamma(1/2,z^2),
(5)

where gamma(a,x) is the incomplete gamma function.

Erf can also be defined as a Maclaurin series

erf(z)=2/(sqrt(pi))sum_(n=0)^(infty)((-1)^nz^(2n+1))/(n!(2n+1))
(6)
=2/(sqrt(pi))(z-1/3z^3+1/(10)z^5-1/(42)z^7+1/(216)z^9+...)
(7)

(Sloane's A007680). Similarly,

 erf^2(z)=4/pi(z^2-2/3z^4+(14)/(45)z^6-4/(35)z^8+(166)/(4725)z^(10)+...)
(8)

(Sloane's A103979 and A103980).

For x<<1, erf(x) may be computed from

erf(x)=1/(sqrt(pi))e^(-x^2)sum_(n=0)^(infty)((2x)^(2n+1))/((2n+1)!!)
(9)
=2/(sqrt(pi))e^(-x^2)[x+(2x^3)/(1·3)+(4x^5)/(1·3·5)+...]
(10)

(Sloane's A000079 and A001147; Acton 1990).

For x>>1,

erf(x)=2/(sqrt(pi))(int_0^inftye^(-t^2)dt-int_x^inftye^(-t^2)dt)
(11)
=1-2/(sqrt(pi))int_x^inftye^(-t^2)dt.
(12)

Using integration by parts gives

int_x^inftye^(-t^2)dt=-1/2int_x^infty1/td(e^(-t^2))
(13)
=-1/2[(e^(-t^2))/t]_x^infty-1/2int_x^infty(e^(-t^2)dt)/(t^2)
(14)
=(e^(-x^2))/(2x)+1/4int_x^infty1/(t^3)d(e^(-t^2))
(15)
=(e^(-x^2))/(2x)-(e^(-x^2))/(4x^3)-...,
(16)

so

 erf(x)=1-(e^(-x^2))/(sqrt(pi)x)(1-1/(2x^2)-...)
(17)

and continuing the procedure gives the asymptotic series

erf(x)∼1-(e^(-x^2))/(sqrt(pi))sum_(n=0)^(infty)((-1)^n(2n-1)!!)/(2^n)x^(-(2n+1))
(18)
∼1-(e^(-x^2))/(sqrt(pi))(x^(-1)-1/2x^(-3)+3/4x^(-5)-(15)/8x^(-7)
(19)
 +(105)/(16)x^(-9)+...)
(20)

(Sloane's A001147 and A000079).

Erf has the values

erf(0)=0
(21)
erf(infty)=1.
(22)

It is an odd function

 erf(-z)=-erf(z),
(23)

and satisfies

 erf(z)+erfc(z)=1.
(24)

Erf may be expressed in terms of a confluent hypergeometric function of the first kind M as

erf(z)=(2z)/(sqrt(pi))M(1/2,3/2,-z^2)
(25)
=(2z)/(sqrt(pi))e^(-z^2)M(1,3/2,z^2).
(26)

Its derivative is

 (d^n)/(dz^n)erf(z)=(-1)^(n-1)2/(sqrt(pi))H_(n-1)(z)e^(-z^2),
(27)

where H_n is a Hermite polynomial. The first derivative is

 d/(dz)erf(z)=2/(sqrt(pi))e^(-z^2),
(28)

and the integral is

 interf(z)dz=zerf(z)+(e^(-z^2))/(sqrt(pi)).
(29)
ErfReImAbs
 
 Min Max  
 Re  
 Im Powered by webMathematica 

Erf can also be extended to the complex plane, as illustrated above.

A simple integral involving erf that Mathematica 5.1 cannot do is given by

 int_0^pe^(-x^2)erf(p-x)dx=1/2sqrt(pi)[erf(1/2sqrt(2)p)]^2
(30)

(M. R. D'Orsogna, pers. comm., May 9, 2004). More complicated integrals include

 int_0^infty(e^(-(p+x)y))/(pi(p+x))sin(asqrt(x))dx=-sinh(asqrt(p)) 
 +(e^(-asqrt(p)))/2erf(a/(2sqrt(y))-sqrt(py))+(e^(asqrt(p)))/2erf(a/(2sqrt(y))+sqrt(py)) 
int_0^infty(sqrt(x)e^(-(p+x)y))/(pi(p+x))cos(asqrt(x))dx=(e^(-[py+a^2/(4y)]))/(sqrt(piy))+sqrt(p)[-cosh(asqrt(p))-(e^(-asqrt(p)))/2erf(a/(2sqrt(y))-sqrt(py))+(e^(asqrt(p)))/2erf(a/(2sqrt(y))+sqrt(py))]
(31)

(M. R. D'Orsogna, pers. comm., Dec. 15, 2005).

Erf has the continued fraction

int_0^xe^(-t^2)dt=1/2sqrt(pi)erf(x)
(32)
=1/2sqrt(pi)-(1/2e^(-x^2))/(x+1/(2x+2/(x+3/(2x+4/(x+...)))))
(33)

(Wall 1948, p. 357), first stated by Laplace in 1805 and Legendre in 1826 (Olds 1963, p. 139), proved by Jacobi, and rediscovered by Ramanujan (Watson 1928; Hardy 1999, pp. 8-9).

Definite integrals involving erf(x) include Definite integrals involving erf(x) include

int_0^inftye^(-px^2)erf(ax)erf(bx)dx=1/(sqrt(pip))tan^(-1)((ab)/(sqrt(p(a^2+b^2+p))))
(34)
int_0^inftyxe^(-px^2)erf(ax)erf(bx)erf(cx)dx=1/(pip)[a/(sqrt(a^2+p))tan^(-1)((bc)/(sqrt((a^2+b^2+c^2+p)(a^2+p))))+b/(sqrt(b^2+p))tan^(-1)((ac)/(sqrt((a^2+b^2+c^2+p)(b^2+p))))+c/(sqrt(c^2+p))tan^(-1)((ab)/(sqrt((a^2+b^2+c^2+p)(c^2+p))))]
(35)
int_0^inftye^(-x)erf(sqrt(x))dx=1/2sqrt(2)
(36)
int_0^inftye^(-x)erf^2(sqrt(x))dx=(2sqrt(2)cot^(-1)(sqrt(2)))/pi
(37)
int_0^inftye^(-x)erf^3(sqrt(x))dx=(3sqrt(2)cot^(-1)(2sqrt(2)))/pi.
(38)

The first two of these appear in Prudnikov et al. (1990, p. 123, eqns. 2.8.19.8 and 2.8.19.11), with R[p]>0, |arg(a)|,|argb|,|argc|<pi/4.

A complex generalization of erf(x) is defined as

w(z)=e^(-z^2)erfc(-iz)
(39)
=e^(-z^2)(1+(2i)/(sqrt(pi))int_0^ze^(t^2)dt).
(40)

Integral representations valid only in the upper half-plane I[z]>0 are given by

w(z)=i/piint_(-infty)^infty(e^(-t^2))/(z-t)dt
(41)
=(2iz)/piint_0^infty(e^(-t^2))/(z^2-t^2)dt.
(42)
盒维数的matlab实现可以使用以下代码: ```matlab function [D, S] = boxcount(X, varargin) % Compute the box-counting dimension of an image or a point cloud. % % D = boxcount(X) computes the box-counting dimension of the binary image % X using boxes of sizes 2^0, 2^1, ..., 2^floor(log2(N/2)), where N is the % maximum dimension of X. D is the slope of the linear regression of the % log-log plot of the number of occupied boxes versus the box size. % % D = boxcount(X, n) computes the box-counting dimension using boxes of % sizes n(1), n(2), ..., n(end). % % [D, S] = boxcount(...) also returns the estimated number of occupied % boxes S. % % Notes: % - X can be a 2D or 3D binary array or a 2D or 3D point cloud. % - When X is a point cloud, it is first rasterized into a binary image. % - The box-counting algorithm is performed separately along each % dimension of X, and the results are averaged to obtain D. % - If X has less than two occupied pixels (or points) no boxes can be % placed and D is NaN. % % Example: % % Compute the box-counting dimension of the Sierpinski carpet fractal % X = sierpinski_carpet(7); % binary image % D = boxcount(X); % D is approximately 1.8928 % % % Compute the box-counting dimension of a point cloud % X = randn(1000, 3); % point cloud % D = boxcount(X); % D is approximately 2.0322 % % References: % - http://mathworld.wolfram.com/Box-CountingDimension.html % - http://www.fractalus.com/carlo/boxcount/boxcount.htm % % Author: Nicolas Boumal, UCLouvain, 2015. % Adapted from code by Daniel Eaton (fileexchange 13932). % Parse input arguments if nargin < 2 n = []; else n = varargin{1}; assert(isvector(n) && all(n > 0) && all(round(n) == n), ... 'n must be a positive integer vector'); end % Compute box-counting dimension if ismatrix(X) % 2D image or point cloud X = double(X > 0); if isempty(n) n = 2.^(0:floor(log2(max(size(X))))-1); end S = zeros(size(n)); for i = 1:length(n) S(i) = count_boxes(X, n(i)); end D = polyfit(log(n(:)), log(S(:)), 1); D = -D(1); else % 3D image or point cloud Ds = zeros(3, 1); for d = 1:3 Xi = squeeze(X(:,:,d)); Xi = double(Xi > 0); if isempty(n) n = 2.^(0:floor(log2(max(size(Xi))))-1); end S = zeros(size(n)); for i = 1:length(n) S(i) = count_boxes(Xi, n(i)); end Ds(d) = polyfit(log(n(:)), log(S(:)), 1); Ds(d) = -Ds(d); end D = mean(Ds); end end function S = count_boxes(X, n) % Count the number of occupied boxes in an image or a point cloud. % % S = count_boxes(X, n) counts the number of boxes of size n that contain % at least one occupied pixel (or point) in the binary image (or point % cloud) X. if n >= min(size(X)) S = nnz(X); else S = 0; s = n-1; while s < min(size(X)) for i = 1:s+1:size(X,1) for j = 1:s+1:size(X,2) if any(X(i:i+s,j:j+s)) S = S+1; end end end s = s*2; end end end ``` 使用方法: 1. 对于二维图片,直接调用`D = boxcount(X);`即可计算盒维数。 2. 对于三维图片或点云,调用`D = boxcount(X);`即可计算盒维数的平均值。 3. 可以通过传入`n`参数,来指定盒子的大小,例如`D = boxcount(X, [2 4 8 16 32]);`表示使用这些不同的盒子大小计算盒维数。 注意,在计算盒维数时,输入数据必须是二值化的。如果输入的是点云,则需要先将其转换为二值化的图像。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值