mathjs icon indicating copy to clipboard operation
mathjs copied to clipboard

feat: Digamma function

Open bartekleon opened this issue 2 years ago • 2 comments

fixes: #2361

feat: adds digamma function

bartekleon avatar Mar 16 '22 22:03 bartekleon

@josdejong finally i managed to make something... For some reason array and matrix checks don't work (because approximation is not good enough [last digit] so if you could help fix it somehow(?) or tell what im supposed to do - improve approximation / degrade tests / remove these tests.

It still needs some tests most likely though, very open for ideas @ticucubot and @josdejong

bartekleon avatar Mar 16 '22 22:03 bartekleon

@kmdrGroch thanks for the contribution, digamma will fill a nice gap in mathjs. And some good news, you can eliminate the portion of digamma applying elementwise to matrices; mathjs is phasing that out (see #2465) for functions like exp, gamma, and digamma that also have a separate meaning on square matrices, since the elementwise behavior is so easy to recover with math.map(M, gamma) for example.

If you believe that your implementation is mathematically adequate and really just varying from a test value in the 14th or 15th digit, you can use the "approx" module in testing, with a small epsilon. You should easily find other mocha tests that use it.

In all, this PR needs:

  • [ ] All tests to pass
  • [ ] embedded docs for digamma
  • [ ] math.derivative() to be extended to operate on gamma courtesy of digamma (that's one big point of having digamma).
  • [ ] Also please verify that (regular web) docs are successfully being generated for digamma.

Thanks so much!

gwhitney avatar Mar 17 '22 23:03 gwhitney