- Press green flag to change the value of z. - Press the button located at the top-left side to toggle digamma/trigamma If you're looking for Gamma Function: Many people have already made it: https://scratch.mit.edu/projects/678008127/ Work in progress:Polygamma function (hard!)
I have a deal: If this project gets 10 likes or favorites, l will actually going to make a extension of this... which is polygamma function... and more! No one ever made these functions in Scratch so I'm the first one! Please understand that this project is high effort as I tried to understand the formulas, make it accurate while code being compact and decently fast to make it portable. Please show some support by favoriting and liking this project, Thank you! Explanation to digamma and trigamma function: (You need mathematical knowledge for this) Digamma function of z is equivalent to the derivative of the logarithm of the gamma function of x. Trigamma function of z is equivalent to the derivative of Digamma function of z. It is also equal to the derivative of the derivative of the logarithm of the gamma function of x. The script for digamma and trigamma function (which you saw inside) uses recurrence to push the z above 10 for faster convergence, and then digamma uses ln() as Ψ(z) ≈ ln(z), z large, then it uses asymptotic expansion for 15 digit accuracy. Note that while the Taylor series of these formulas do exist, they are extremely impractical for coding due to slow convergence. And while you can use finite difference to get trigamma function from the digamma function, it is innacurate and it does NOT fit for the hook being ' (Full precision!)' So the formula is: ψ₀(z) = Γ'(z) / Γ(z) = d/dx ln(Γ(z)) ψ₁(z) =ψ₀'(z) = d/dx d/dx ln(Γ(z)) where Γ(z) = (z - 1)! copy to Desmos (digamma): \psi_{0}\left(x\right)=\frac{\frac{d}{dx}\left(x-1\right)!}{\left(x-1\right)!} copy to Desmos (trigamma): \psi_{1}\left(x\right)=\psi_{0}'\left(x\right) or \psi_{1}\left(x\right)=\frac{d}{dx}\frac{\frac{d}{dx}\left(x-1\right)!}{\left(x-1\right)!} Note that Ψ(1) = - γ And note that H(n) = Ψ(n+1) + γ where the traditional formula of n H(n) = Σ 1 / k k=1