]> www.ginac.de Git - ginac.git/blobdiff - ginac/inifcns_gamma.cpp
- preparations for release 0.5.1
[ginac.git] / ginac / inifcns_gamma.cpp
index d20a27f24b72409ea8b403b982dd2add89b37bb2..9e96fda8ae83646c7e2f6b2799b819bd79f15246 100644 (file)
@@ -34,9 +34,9 @@
 #include "symbol.h"
 #include "utils.h"
 
-#ifndef NO_GINAC_NAMESPACE
+#ifndef NO_NAMESPACE_GINAC
 namespace GiNaC {
-#endif // ndef NO_GINAC_NAMESPACE
+#endif // ndef NO_NAMESPACE_GINAC
 
 //////////
 // Gamma-function
@@ -51,6 +51,7 @@ static ex gamma_evalf(const ex & x)
     return gamma(ex_to_numeric(x));
 }
 
+
 /** Evaluation of gamma(x). Knows about integer arguments, half-integer
  *  arguments and that's it. Somebody ought to provide some good numerical
  *  evaluation some day...
@@ -92,15 +93,17 @@ static ex gamma_eval(const ex & x)
     return gamma(x).hold();
 }    
 
-static ex gamma_diff(const ex & x, unsigned diff_param)
+
+static ex gamma_deriv(const ex & x, unsigned deriv_param)
 {
-    GINAC_ASSERT(diff_param==0);
+    GINAC_ASSERT(deriv_param==0);
     
     // d/dx  log(gamma(x)) -> psi(x)
     // d/dx  gamma(x) -> psi(x)*gamma(x)
     return psi(x)*gamma(x);
 }
 
+
 static ex gamma_series(const ex & x, const symbol & s, const ex & pt, int order)
 {
     // method:
@@ -116,14 +119,15 @@ static ex gamma_series(const ex & x, const symbol & s, const ex & pt, int order)
         throw do_taylor();  // caught by function::series()
     // if we got here we have to care for a simple pole at -m:
     numeric m = -ex_to_numeric(x_pt);
-    ex ser_numer = gamma(x+m+_ex1());
     ex ser_denom = _ex1();
     for (numeric p; p<=m; ++p)
         ser_denom *= x+p;
-    return (ser_numer/ser_denom).series(s, pt, order+1);
+    return (gamma(x+m+_ex1())/ser_denom).series(s, pt, order+1);
 }
 
-REGISTER_FUNCTION(gamma, gamma_eval, gamma_evalf, gamma_diff, gamma_series);
+
+REGISTER_FUNCTION(gamma, gamma_eval, gamma_evalf, gamma_deriv, gamma_series);
+
 
 //////////
 // Beta-function
@@ -136,10 +140,10 @@ static ex beta_evalf(const ex & x, const ex & y)
         TYPECHECK(y,numeric)
     END_TYPECHECK(beta(x,y))
     
-    return gamma(ex_to_numeric(x))*gamma(ex_to_numeric(y))
-        / gamma(ex_to_numeric(x+y));
+    return gamma(ex_to_numeric(x))*gamma(ex_to_numeric(y))/gamma(ex_to_numeric(x+y));
 }
 
+
 static ex beta_eval(const ex & x, const ex & y)
 {
     if (x.info(info_flags::numeric) && y.info(info_flags::numeric)) {
@@ -176,20 +180,22 @@ static ex beta_eval(const ex & x, const ex & y)
     return beta(x,y).hold();
 }
 
-static ex beta_diff(const ex & x, const ex & y, unsigned diff_param)
+
+static ex beta_deriv(const ex & x, const ex & y, unsigned deriv_param)
 {
-    GINAC_ASSERT(diff_param<2);
+    GINAC_ASSERT(deriv_param<2);
     ex retval;
     
     // d/dx beta(x,y) -> (psi(x)-psi(x+y)) * beta(x,y)
-    if (diff_param==0)
+    if (deriv_param==0)
         retval = (psi(x)-psi(x+y))*beta(x,y);
     // d/dy beta(x,y) -> (psi(y)-psi(x+y)) * beta(x,y)
-    if (diff_param==1)
+    if (deriv_param==1)
         retval = (psi(y)-psi(x+y))*beta(x,y);
     return retval;
 }
 
+
 static ex beta_series(const ex & x, const ex & y, const symbol & s, const ex & pt, int order)
 {
     // method:
@@ -222,7 +228,9 @@ static ex beta_series(const ex & x, const ex & y, const symbol & s, const ex & p
     return (x_ser*y_ser/xy_ser).series(s,pt,order);
 }
 
-REGISTER_FUNCTION(beta, beta_eval, beta_evalf, beta_diff, beta_series);
+
+REGISTER_FUNCTION(beta, beta_eval, beta_evalf, beta_deriv, beta_series);
+
 
 //////////
 // Psi-function (aka digamma-function)
@@ -282,9 +290,9 @@ static ex psi1_eval(const ex & x)
     return psi(x).hold();
 }
 
-static ex psi1_diff(const ex & x, unsigned diff_param)
+static ex psi1_deriv(const ex & x, unsigned deriv_param)
 {
-    GINAC_ASSERT(diff_param==0);
+    GINAC_ASSERT(deriv_param==0);
     
     // d/dx psi(x) -> psi(1,x)
     return psi(_ex1(), x);
@@ -311,7 +319,7 @@ static ex psi1_series(const ex & x, const symbol & s, const ex & pt, int order)
     return (psi(x+m+_ex1())-recur).series(s, pt, order);
 }
 
-const unsigned function_index_psi1 = function::register_new("psi", psi1_eval, psi1_evalf, psi1_diff, psi1_series);
+const unsigned function_index_psi1 = function::register_new("psi", psi1_eval, psi1_evalf, psi1_deriv, psi1_series);
 
 //////////
 // Psi-functions (aka polygamma-functions)  psi(0,x)==psi(x)
@@ -392,11 +400,11 @@ static ex psi2_eval(const ex & n, const ex & x)
     return psi(n, x).hold();
 }    
 
-static ex psi2_diff(const ex & n, const ex & x, unsigned diff_param)
+static ex psi2_deriv(const ex & n, const ex & x, unsigned deriv_param)
 {
-    GINAC_ASSERT(diff_param<2);
+    GINAC_ASSERT(deriv_param<2);
     
-    if (diff_param==0) {
+    if (deriv_param==0) {
         // d/dn psi(n,x)
         throw(std::logic_error("cannot diff psi(n,x) with respect to n"));
     }
@@ -427,8 +435,8 @@ static ex psi2_series(const ex & n, const ex & x, const symbol & s, const ex & p
     return (psi(n, x+m+_ex1())-recur).series(s, pt, order);
 }
 
-const unsigned function_index_psi2 = function::register_new("psi", psi2_eval, psi2_evalf, psi2_diff, psi2_series);
+const unsigned function_index_psi2 = function::register_new("psi", psi2_eval, psi2_evalf, psi2_deriv, psi2_series);
 
-#ifndef NO_GINAC_NAMESPACE
+#ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC
-#endif // ndef NO_GINAC_NAMESPACE
+#endif // ndef NO_NAMESPACE_GINAC