📄 trigamma.m
字号:
%This calculates the second derivative of the log Gamma function.%%A hack written with Carl Rasmussen.%%Matthew J. Beal GCNU 06/02/01function res=trigamma(input);krange = [1:7]';coef= [-1/12 1/120 -1/252 1/240 -1/132 691/32760 -1/12];for item = 1:size(input,2);x = input(item);if x<=0 disp(['Error: non-positive argument ' num2str(x) ' in trigamma']);else if x>=6 logx=log(x); res(item) = 1/x +.5/x^2 -2/x*coef.*krange'*exp(-2*krange*logx); else res(item) = trigamma(x+1)+1/x^2;end, endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -