#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
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...
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:
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
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)) {
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:
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)
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);
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)
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"));
}
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