Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

psi

digamma 和 polygamma 函数

说明

示例

Y = psi(X) 为数组 X 的每个元素计算 digamma 函数,各元素必须为非负实数。

示例

Y = psi(k,X) 计算 Xpolygamma 函数,计算的值是在 X 处的 digamma 函数的 k 阶导数。因此,psi(0,X) 是 digamma 函数,psi(1,X) 是 trigamma 函数,psi(2,X) 是 tetragamma 函数,以此类推。

示例

全部折叠

使用 psi 函数计算 Euler-Mascheroni 常量 γ,也称为欧拉常量。

format long
Y = -psi(1)
Y = 
   0.577215664901532

计算 2 的 trigamma 函数。

format long
Y1 = psi(1,2)
Y1 = 
   0.644934066848226

检查结果是否等于 π2/6-1

Y2 = pi^2/6 - 1
Y2 = 
   0.644934066848226

isequal(Y1,Y2)
ans = logical
   1

定义域。

X = 0:0.05:5;

计算 digamma 和接下来的三个 polygamma 函数。

Y = zeros(4,101);
for i = 0:3
    Y(i+1,:) = psi(i,X);
end

绘制 digamma 和接下来的三个 polygamma 函数。

plot(X,Y)
axis([0 5 -10 10])
legend('\psi','\psi_1','\psi_2','\psi_3','Location','Best')
title('Digamma and The Next Three Polygamma Functions','interpreter','latex')
xlabel('$x$','interpreter','latex')
ylabel('$\psi_k(x)$','interpreter','latex')

Figure contains an axes object. The axes object with title Digamma and The Next Three Polygamma Functions, xlabel $x$, ylabel psi indexOf k baseline leftParenthesis x rightParenthesis contains 4 objects of type line. These objects represent \psi, \psi_1, \psi_2, \psi_3.

输入参数

全部折叠

输入,指定为标量、向量、矩阵或非负实数的多维数组。X 不能为稀疏矩阵。

数据类型: single | double

导数的阶,指定为非负整数标量。k 必须小于 231-1

数据类型: single | double

详细信息

全部折叠

digamma 函数

digamma 函数是 gamma 函数的对数的一阶导数:

ψ(x)=ddxlnΓ(x)=Γ(x)Γ(x).

polygamma 函数

k 阶的 polygamma 函数是 gamma 函数的对数的 (k + 1) 阶导数:

ψ(k)(x)=dk+1dxk+1lnΓ(x)=dkdxkψ(x).

参考

[1] Abramowitz, M. and I. A. Stegun, Handbook of Mathematical Functions, Dover Publications, 1965, Sections 6.3 and 6.4.

扩展功能

版本历史记录

在 R2006a 之前推出

另请参阅

| |