3

例如C=0

solve('psi(x)=0')

ans =
-226.83295306016122662496413158295

psi(ans)

???Error using ==> psi
Input must be single or double.

我无法得到正确答案

4

1 回答 1

1

有趣...这对我来说似乎是一个错误solve...无论我尝试解决什么值,我总是得到一个奇怪的值 around -227。即使我试图通过给出 digamma 的近似值来欺骗 MATLAB,我也会得到相同的结果或更糟:

>> solve('(gamma(x+0.01)-gamma(x))/0.01/gamma(x)=0')
ans = 
    matrix([[-226.83790783643886637282996154237]])

>> solve('(gammaln(x+0.01)-gammaln(x-0.01))/0.02 = 0')
??? Error using ==> mupadmex
Error in MuPAD command: cannot differentiate equation [numeric::fsolve]

以下数值方法有效:

%// value of the digamma to solve for
Y = -10; 

%// Solve using numerical scheme 
X = fsolve(@(x)psi(max(0,x)) - Y, exp(Y))

%// Check solution: psi(X) ≈ Y
psi(X)
于 2013-12-18T10:28:44.590 回答