X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Finifcns_consist.cpp;h=650d69bbcc4fe16c22d90ebf893b23f6296d800e;hp=024dad79917382849d191f334fca34c00b9f0ebb;hb=8a3a0aad0fe18304062335fdc934757855abd887;hpb=afdd7fa8c6c0a587f7c80789198551383e8beb7b diff --git a/check/inifcns_consist.cpp b/check/inifcns_consist.cpp index 024dad79..650d69bb 100644 --- a/check/inifcns_consist.cpp +++ b/check/inifcns_consist.cpp @@ -169,8 +169,8 @@ static unsigned inifcns_consist_trans(void) return result; } -/* Simple tests on the Gamma combinatorial function. We stuff in arguments - * where the result exists in closed form and check if it's ok. */ +/* Simple tests on the Gamma function. We stuff in arguments where the results + * exists in closed form and check if it's ok. */ static unsigned inifcns_consist_gamma(void) { unsigned result = 0; @@ -214,6 +214,27 @@ static unsigned inifcns_consist_gamma(void) return result; } +/* Simple tests on the Psi-function (aka polygamma-function). We stuff in + arguments where the result exists in closed form and check if it's ok. */ +static unsigned inifcns_consist_psi(void) +{ + unsigned result = 0; + symbol x; + ex e, f; + + // We check psi(1) and psi(1/2) implicitly by calculating the curious + // little identity gamma(1)'/gamma(1) - gamma(1/2)'/gamma(1/2) == 2*log(2). + e += (gamma(x).diff(x)/gamma(x)).subs(x==numeric(1)); + e -= (gamma(x).diff(x)/gamma(x)).subs(x==numeric(1,2)); + if (e!=2*log(2)) { + clog << "gamma(1)'/gamma(1) - gamma(1/2)'/gamma(1/2) erroneously returned " + << e << " instead of 2*log(2)" << endl; + ++result; + } + + return result; +} + /* Simple tests on the Riemann Zeta function. We stuff in arguments where the * result exists in closed form and check if it's ok. Of course, this checks * the Bernoulli numbers as a side effect. */ @@ -253,9 +274,10 @@ unsigned inifcns_consist(void) result += inifcns_consist_cos(); result += inifcns_consist_trans(); result += inifcns_consist_gamma(); + result += inifcns_consist_psi(); result += inifcns_consist_zeta(); - if ( !result ) { + if (!result) { cout << " passed "; clog << "(no output)" << endl; } else {