]> www.ginac.de Git - ginac.git/commitdiff
- a little bit more consistent evaluation of zeta(x)
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Fri, 19 Nov 1999 21:43:46 +0000 (21:43 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Fri, 19 Nov 1999 21:43:46 +0000 (21:43 +0000)
ginac/inifcns_zeta.cpp

index d4890f2863c28205e64931f50e7f2b5074f8239d..8dbe5d2da58da0e7f263859acf3b3e087c3ec0fc 100644 (file)
@@ -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::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 {
             } 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();
             }
         }
     }
     return zeta(x).hold();
-}    
+}
     
 static ex zeta_evalf(ex const & x)
 {
     
 static ex zeta_evalf(ex const & x)
 {