From fc86859d22eb864d43e9b2446d7077836acbe6b4 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Fri, 19 Nov 1999 21:43:46 +0000 Subject: [PATCH] - a little bit more consistent evaluation of zeta(x) --- ginac/inifcns_zeta.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/ginac/inifcns_zeta.cpp b/ginac/inifcns_zeta.cpp index d4890f28..8dbe5d2d 100644 --- a/ginac/inifcns_zeta.cpp +++ b/ginac/inifcns_zeta.cpp @@ -40,16 +40,28 @@ static ex zeta_eval(ex const & x) { if (x.info(info_flags::numeric)) { // trap integer arguments: - if ( x.info(info_flags::integer) ) { - if ( x.info(info_flags::posint) ) { - return numZERO(); // FIXME + if (x.info(info_flags::integer)) { + if (x.is_zero()) + return -exHALF(); + if (!x.compare(exONE())) + throw(std::domain_error("zeta(1): infinity")); + if (x.info(info_flags::posint)) { + if (x.info(info_flags::odd)) + return zeta(x).hold(); + else + // return bernoulli(ex_to_numeric(x))*pow(Pi,x)*numTWO().power(ex_to_numeric(x))/factorial(x); + throw (std::domain_error("you found a missing feature")); } else { - return numZERO(); // FIXME + if (x.info(info_flags::odd)) + // return -bernoulli(1-ex_to_numeric(x))/(1-ex_to_numeric(x)) + throw (std::domain_error("you found a missing feature")); + else + return numZERO(); } } } return zeta(x).hold(); -} +} static ex zeta_evalf(ex const & x) { -- 2.44.0