2026a
# polygamma
polygamma函数
函数库: TyMath
# 语法
Y = polygamma(k,x)
# 说明
Y = polygamma(k,x) 计算 x 的 polygamma 函数,计算的值是在 x 处的 digamma 函数的 k 阶导数。因此,polygamma(0,x) 是 digamma 函数,polygamma(1,x) 是 trigamma 函数,polygamma(2,x) 是 tetragamma 函数,以此类推。 示例
# 示例
计算trigamma函数
计算trigamma函数
using TyMath
Y1 = polygamma(1,2)
Y1 = 0.6449340668482265
检查结果是否等于
Y2 = pi^2/6 - 1
Y2 = 0.6449340668482264
绘制digamma和polygamma函数
定义域
using TyMath
using TyPlot
X = 0:0.05:5
计算digamma函数和三个 polygamma 函数
Y = zeros(4,101)
for i = 0:3
Y[i+1,:] = polygamma.(i,X)
end
绘制digamma函数 和 三个 polygamma 函数
hold("on")
for i = 1:4
plot(X,Y[i,:])
end
axis([0 5 -10 10])
grid("on")
legend([raw"digamma(x)",raw"$polygamma_1(x)$",raw"$polygamma_2(x)$",raw"$polygamma_3(x)$"])
title("digamma函数和三个polygamma函数")
xlabel("x")
ylabel(raw"polygamma_k(x)")
hold("off")
# 输入参数
x-输入标量 | 向量 | 矩阵 | 多维数组
输入,指定为标量、向量、矩阵或多维数组
数据类型: Int64 | Int32 | Int16 | Int128 | Float64 | Float32 | Float16 | UInt8 | UInt16 | UInt32 | UInt64 | UInt128 | Complex
k-导数的阶非负整数标量
导数的阶,指定为非负整数标量。
数据类型: Int64 | Int32 | Int16 | Int128 | UInt
# 详细信息
polygamma函数
k 阶的 polygamma 函数是 gamma 函数的对数的 (k + 1) 阶导数:
# 参考
[1] Abramowitz, M. and I. A. Stegun, Handbook of Mathematical Functions, Dover Publications, 1965, Sections 6.3 and 6.4.