For a fit I need a fit function utilizing the digamma function. Unfortunately, gnuplot does not
know the digamma function, so I tried to implement my own definition of a digamma function using a (known) approximation:
It's possible, and even obvious. The solution is that you've been trying too hard. Almost all of those temporary variables are just not needed. Just write down the formula as you most likely found it in your source (formatted for legibitliy here):
For a fit I need a fit function utilizing the digamma function. Unfortunately, gnuplot does not
know the digamma function, so I tried to implement my own definition of a digamma function using a (known) approximation:
In python my self-defined function and the built-in function correlate nicely:
But the values I retrieve from my self-defined gnuplot function are not very presice:
for example:
self-defined digamma(1) gnuplot: -0.503242515779268151
self-defined digam(1) python: -0.5772156649542977
built-in digamma pyton: -0.5772156649015329
My question: Is is possible to tell gnuplot to be more accurate in calculations?
Many thanks in advance
German
Last edit: German 2018-11-30
It's possible, and even obvious. The solution is that you've been trying too hard. Almost all of those temporary variables are just not needed. Just write down the formula as you most likely found it in your source (formatted for legibitliy here):
The primary key to maintain sufficient precision is to avoid writing integer exponents as floating-point numbers. :-)