From 2ea7c0da53f0f9ec8ac2936cf36c3f6ef5934bf7 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Mon, 24 Jan 2000 22:19:37 +0000 Subject: [PATCH 1/1] - removed superfluous ex ser_numer; in gamma_series() --- ginac/inifcns_gamma.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ginac/inifcns_gamma.cpp b/ginac/inifcns_gamma.cpp index d20a27f2..3a956a92 100644 --- a/ginac/inifcns_gamma.cpp +++ b/ginac/inifcns_gamma.cpp @@ -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,6 +93,7 @@ static ex gamma_eval(const ex & x) return gamma(x).hold(); } + static ex gamma_diff(const ex & x, unsigned diff_param) { GINAC_ASSERT(diff_param==0); @@ -101,6 +103,7 @@ static ex gamma_diff(const ex & x, unsigned diff_param) return psi(x)*gamma(x); } + static ex gamma_series(const ex & x, const symbol & s, const ex & pt, int order) { // method: @@ -116,15 +119,16 @@ 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); + ////////// // 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,6 +180,7 @@ 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) { GINAC_ASSERT(diff_param<2); @@ -190,6 +195,7 @@ static ex beta_diff(const ex & x, const ex & y, unsigned diff_param) return retval; } + static ex beta_series(const ex & x, const ex & y, const symbol & s, const ex & pt, int order) { // method: @@ -222,8 +228,10 @@ 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); + ////////// // Psi-function (aka digamma-function) ////////// -- 2.44.0