- EulerGamma -> gamma.
- beta() -> Beta().
- Version -> 0.6.0 in order to make it clear there were *real* changes.
This file records noteworthy changes.
+0.6.0 (...)
+* Important interface changes:
+ gamma() -> Gamma()
+ EulerGamma -> gamma
+ beta() -> Beta()
+
0.5.4 (15 March 2000)
* Some algorithms in class matrix (notably determinant) were replaced by
less brain-dead ones and should now have much better performance.
unsigned result = 0;
ex e;
- e = gamma(ex(1));
+ e = Gamma(ex(1));
for (int i=2; i<8; ++i)
- e += gamma(ex(i));
+ e += Gamma(ex(i));
if (e != numeric(874)) {
- clog << "gamma(1)+...+gamma(7) erroneously returned "
+ clog << "Gamma(1)+...+Gamma(7) erroneously returned "
<< e << " instead of 874" << endl;
++result;
}
- e = gamma(ex(1));
+ e = Gamma(ex(1));
for (int i=2; i<8; ++i)
- e *= gamma(ex(i));
+ e *= Gamma(ex(i));
if (e != numeric(24883200)) {
- clog << "gamma(1)*...*gamma(7) erroneously returned "
+ clog << "Gamma(1)*...*Gamma(7) erroneously returned "
<< e << " instead of 24883200" << endl;
++result;
}
- e = gamma(ex(numeric(5, 2)))*gamma(ex(numeric(9, 2)))*64;
+ e = Gamma(ex(numeric(5, 2)))*Gamma(ex(numeric(9, 2)))*64;
if (e != 315*Pi) {
- clog << "64*gamma(5/2)*gamma(9/2) erroneously returned "
+ clog << "64*Gamma(5/2)*Gamma(9/2) erroneously returned "
<< e << " instead of 315*Pi" << endl;
++result;
}
- e = gamma(ex(numeric(-13, 2)));
+ e = Gamma(ex(numeric(-13, 2)));
for (int i=-13; i<7; i=i+2)
- e += gamma(ex(numeric(i, 2)));
- e = (e*gamma(ex(numeric(15, 2)))*numeric(512));
+ e += Gamma(ex(numeric(i, 2)));
+ e = (e*Gamma(ex(numeric(15, 2)))*numeric(512));
if (e != numeric(633935)*Pi) {
- clog << "512*(gamma(-13/2)+...+gamma(5/2))*gamma(15/2) erroneously returned "
+ clog << "512*(Gamma(-13/2)+...+Gamma(5/2))*Gamma(15/2) erroneously returned "
<< e << " instead of 633935*Pi" << endl;
++result;
}
ex e, f;
// We check psi(1) and psi(1/2) implicitly by calculating the curious
- // little identity gamma(1)'/gamma(1) - gamma(1/2)'/gamma(1/2) == 2*log(2).
- e += (gamma(x).diff(x)/gamma(x)).subs(x==numeric(1));
- e -= (gamma(x).diff(x)/gamma(x)).subs(x==numeric(1,2));
+ // little identity Gamma(1)'/Gamma(1) - Gamma(1/2)'/Gamma(1/2) == 2*log(2).
+ e += (Gamma(x).diff(x)/Gamma(x)).subs(x==numeric(1));
+ e -= (Gamma(x).diff(x)/Gamma(x)).subs(x==numeric(1,2));
if (e!=2*log(2)) {
- clog << "gamma(1)'/gamma(1) - gamma(1/2)'/gamma(1/2) erroneously returned "
+ clog << "Gamma(1)'/Gamma(1) - Gamma(1/2)'/Gamma(1/2) erroneously returned "
<< e << " instead of 2*log(2)" << endl;
++result;
}
unsigned result = 0;
ex e, d;
- // gamma(-1):
- e = gamma(2*x);
+ // Gamma(-1):
+ e = Gamma(2*x);
d = pow(x+1,-1)*numeric(1,4) +
pow(x+1,0)*(numeric(3,4) -
- numeric(1,2)*EulerGamma) +
+ numeric(1,2)*gamma) +
pow(x+1,1)*(numeric(7,4) -
- numeric(3,2)*EulerGamma +
- numeric(1,2)*pow(EulerGamma,2) +
+ numeric(3,2)*gamma +
+ numeric(1,2)*pow(gamma,2) +
numeric(1,12)*pow(Pi,2)) +
pow(x+1,2)*(numeric(15,4) -
- numeric(7,2)*EulerGamma -
- numeric(1,3)*pow(EulerGamma,3) +
+ numeric(7,2)*gamma -
+ numeric(1,3)*pow(gamma,3) +
numeric(1,4)*pow(Pi,2) +
- numeric(3,2)*pow(EulerGamma,2) -
- numeric(1,6)*pow(Pi,2)*EulerGamma -
+ numeric(3,2)*pow(gamma,2) -
+ numeric(1,6)*pow(Pi,2)*gamma -
numeric(2,3)*zeta(3)) +
- pow(x+1,3)*(numeric(31,4) - pow(EulerGamma,3) -
- numeric(15,2)*EulerGamma +
- numeric(1,6)*pow(EulerGamma,4) +
- numeric(7,2)*pow(EulerGamma,2) +
+ pow(x+1,3)*(numeric(31,4) - pow(gamma,3) -
+ numeric(15,2)*gamma +
+ numeric(1,6)*pow(gamma,4) +
+ numeric(7,2)*pow(gamma,2) +
numeric(7,12)*pow(Pi,2) -
- numeric(1,2)*pow(Pi,2)*EulerGamma -
+ numeric(1,2)*pow(Pi,2)*gamma -
numeric(2)*zeta(3) +
- numeric(1,6)*pow(EulerGamma,2)*pow(Pi,2) +
+ numeric(1,6)*pow(gamma,2)*pow(Pi,2) +
numeric(1,40)*pow(Pi,4) +
- numeric(4,3)*zeta(3)*EulerGamma) +
+ numeric(4,3)*zeta(3)*gamma) +
Order(pow(x+1,4));
result += check_series(e, -1, d, 4);
/** @file time_gammaseries.cpp
*
- * Some timings on series expansion of the gamma function around a pole. */
+ * Some timings on series expansion of the Gamma function around a pole. */
/*
* GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
#include "times.h"
-unsigned gammaseries(unsigned order)
+unsigned Gammaseries(unsigned order)
{
unsigned result = 0;
symbol x;
- ex myseries = series(gamma(x),x,0,order);
+ ex myseries = series(Gamma(x),x,0,order);
// compute the last coefficient numerically:
ex last_coeff = myseries.coeff(x,order-1).evalf();
// compute a bound for that coefficient using a variation of the leading
ex bound = evalf(exp(ex(-.57721566490153286*(order-1)))/(order-1));
if (evalf(abs((last_coeff-pow(-1,order))/bound)) > numeric(1)) {
clog << "The " << order-1
- << "th order coefficient in the power series expansion of gamma(0) was erroneously found to be "
+ << "th order coefficient in the power series expansion of Gamma(0) was erroneously found to be "
<< last_coeff << ", violating a simple estimate." << endl;
++result;
}
{
unsigned result = 0;
- cout << "timing Laurent series expansion of gamma function" << flush;
- clog << "-------Laurent series expansion of gamma function:" << endl;
+ cout << "timing Laurent series expansion of Gamma function" << flush;
+ clog << "-------Laurent series expansion of Gamma function:" << endl;
vector<unsigned> sizes;
vector<double> times;
for (vector<unsigned>::iterator i=sizes.begin(); i!=sizes.end(); ++i) {
omega.start();
- result += gammaseries(*i);
+ result += Gammaseries(*i);
times.push_back(omega.read());
cout << '.' << flush;
}
-------commutative expansion and substitution:
(no output)
--------Laurent series expansion of gamma function:
+-------Laurent series expansion of Gamma function:
(no output)
-------determinant of univariate symbolic Vandermonde matrices:
(no output)
GINACLIB_MAJOR_VERSION=0
-GINACLIB_MINOR_VERSION=5
-GINACLIB_MICRO_VERSION=4
-GINACLIB_INTERFACE_AGE=4
-GINACLIB_BINARY_AGE=4
+GINACLIB_MINOR_VERSION=6
+GINACLIB_MICRO_VERSION=0
+GINACLIB_INTERFACE_AGE=0
+GINACLIB_BINARY_AGE=0
GINACLIB_VERSION=$GINACLIB_MAJOR_VERSION.$GINACLIB_MINOR_VERSION.$GINACLIB_MICRO_VERSION
dnl (don't we all *love* M4?)...
GINACLIB_MAJOR_VERSION=0
-GINACLIB_MINOR_VERSION=5
-GINACLIB_MICRO_VERSION=4
-GINACLIB_INTERFACE_AGE=4
-GINACLIB_BINARY_AGE=4
+GINACLIB_MINOR_VERSION=6
+GINACLIB_MICRO_VERSION=0
+GINACLIB_INTERFACE_AGE=0
+GINACLIB_BINARY_AGE=0
GINACLIB_VERSION=$GINACLIB_MAJOR_VERSION.$GINACLIB_MINOR_VERSION.$GINACLIB_MICRO_VERSION
AC_SUBST(GINACLIB_MAJOR_VERSION)
x-1/6*x^3+Order(x^4)
> series(1/tan(x),x,0,4);
x^(-1)-1/3*x+Order(x^2)
-> series(gamma(x),x,0,3);
-x^(-1)-EulerGamma+(1/12*Pi^2+1/2*EulerGamma^2)*x
-+(-1/3*zeta(3)-1/12*Pi^2*EulerGamma-1/6*EulerGamma^3)*x^2+Order(x^3)
+> series(Gamma(x),x,0,3);
+x^(-1)-gamma+(1/12*Pi^2+1/2*gamma^2)*x+
+(-1/3*zeta(3)-1/12*Pi^2*gamma-1/6*gamma^3)*x^2+Order(x^3)
> evalf(");
x^(-1)-0.5772156649015328606+(0.9890559953279725555)*x
-(0.90747907608088628905)*x^2+Order(x^3)
-> series(gamma(2*sin(x)-2),x,Pi/2,6);
--(x-1/2*Pi)^(-2)+(-1/12*Pi^2-1/2*EulerGamma^2-1/240)*(x-1/2*Pi)^2
--EulerGamma-1/12+Order((x-1/2*Pi)^3)
+> series(Gamma(2*sin(x)-2),x,Pi/2,6);
+-(x-1/2*Pi)^(-2)+(-1/12*Pi^2-1/2*gamma^2-1/240)*(x-1/2*Pi)^2
+-gamma-1/12+Order((x-1/2*Pi)^3)
@end example
Here we have made use of the @command{ginsh}-command @code{"} to pop the
@cindex @code{Pi}
@cindex @code{Catalan}
-@cindex @code{EulerGamma}
+@cindex @code{gamma}
@cindex @code{evalf()}
Constants behave pretty much like symbols except that they return some
specific number when the method @code{.evalf()} is called.
@item @code{Catalan}
@tab Catalan's constant
@tab 0.91596559417721901505460351493238411
-@item @code{EulerGamma}
+@item @code{gamma}
@tab Euler's (or Euler-Mascheroni) constant
@tab 0.57721566490153286060651209008240243
@end multitable
symbol x("x"), y("y");
ex foo = x+y/2;
- cout << "gamma(" << foo << ") -> " << gamma(foo) << endl;
+ cout << "Gamma(" << foo << ") -> " << Gamma(foo) << endl;
ex bar = foo.subs(y==1);
- cout << "gamma(" << bar << ") -> " << gamma(bar) << endl;
+ cout << "Gamma(" << bar << ") -> " << Gamma(bar) << endl;
ex foobar = bar.subs(x==7);
- cout << "gamma(" << foobar << ") -> " << gamma(foobar) << endl;
+ cout << "Gamma(" << foobar << ") -> " << Gamma(foobar) << endl;
// ...
@}
@end example
expression that may be really useful:
@example
-gamma(x+(1/2)*y) -> gamma(x+(1/2)*y)
-gamma(x+1/2) -> gamma(x+1/2)
-gamma(15/2) -> (135135/128)*Pi^(1/2)
+Gamma(x+(1/2)*y) -> Gamma(x+(1/2)*y)
+Gamma(x+1/2) -> Gamma(x+1/2)
+Gamma(15/2) -> (135135/128)*Pi^(1/2)
@end example
@cindex branch cut
return Pi;
else if (s == Catalan.name)
return Catalan;
- else if (s == EulerGamma.name)
- return EulerGamma;
+ else if (s == gamma.name)
+ return gamma;
else
throw (std::runtime_error("unknown constant '" + s + "' in archive"));
} else
/** Pi. (3.14159...) Diverts straight into CLN for evalf(). */
const constant Pi("Pi", PiEvalf);
/** Catalan's constant. (0.91597...) Diverts straight into CLN for evalf(). */
-const constant EulerGamma("EulerGamma", EulerGammaEvalf);
+const constant gamma("gamma", gammaEvalf);
/** Euler's constant. (0.57721...) Sometimes called Euler-Mascheroni constant.
* Diverts straight into CLN for evalf(). */
const constant Catalan("Catalan", CatalanEvalf);
// extern const numeric I;
extern const constant Pi;
extern const constant Catalan;
-extern const constant EulerGamma;
+extern const constant gamma;
#ifndef NO_NAMESPACE_GINAC
} // namespace GiNaC
/** Force inclusion of functions from initcns_gamma and inifcns_zeta
* for static lib (so ginsh will see them). */
-unsigned force_include_gamma = function_index_gamma;
+unsigned force_include_gamma = function_index_Gamma;
unsigned force_include_zeta1 = function_index_zeta1;
#ifndef NO_NAMESPACE_GINAC
}
/** Gamma-function. */
-DECLARE_FUNCTION_1P(gamma)
+DECLARE_FUNCTION_1P(Gamma)
/** Beta-function. */
-DECLARE_FUNCTION_2P(beta)
+DECLARE_FUNCTION_2P(Beta)
// overloading at work: we cannot use the macros
/** Psi-function (aka digamma-function). */
// Gamma-function
//////////
-static ex gamma_evalf(const ex & x)
+static ex Gamma_evalf(const ex & x)
{
BEGIN_TYPECHECK
TYPECHECK(x,numeric)
- END_TYPECHECK(gamma(x))
+ END_TYPECHECK(Gamma(x))
- return gamma(ex_to_numeric(x));
+ return Gamma(ex_to_numeric(x));
}
-/** Evaluation of gamma(x). Knows about integer arguments, half-integer
+/** 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...
*
- * @exception std::domain_error("gamma_eval(): simple pole") */
-static ex gamma_eval(const ex & x)
+ * @exception std::domain_error("Gamma_eval(): simple pole") */
+static ex Gamma_eval(const ex & x)
{
if (x.info(info_flags::numeric)) {
// trap integer arguments:
if (x.info(info_flags::integer)) {
- // gamma(n+1) -> n! for postitive n
+ // Gamma(n+1) -> n! for postitive n
if (x.info(info_flags::posint)) {
return factorial(ex_to_numeric(x).sub(_num1()));
} else {
- throw (std::domain_error("gamma_eval(): simple pole"));
+ throw (std::domain_error("Gamma_eval(): simple pole"));
}
}
// trap half integer arguments:
if ((x*2).info(info_flags::integer)) {
// trap positive x==(n+1/2)
- // gamma(n+1/2) -> Pi^(1/2)*(1*3*..*(2*n-1))/(2^n)
+ // Gamma(n+1/2) -> Pi^(1/2)*(1*3*..*(2*n-1))/(2^n)
if ((x*_ex2()).info(info_flags::posint)) {
numeric n = ex_to_numeric(x).sub(_num1_2());
numeric coefficient = doublefactorial(n.mul(_num2()).sub(_num1()));
return coefficient * pow(Pi,_ex1_2());
} else {
// trap negative x==(-n+1/2)
- // gamma(-n+1/2) -> Pi^(1/2)*(-2)^n/(1*3*..*(2*n-1))
+ // Gamma(-n+1/2) -> Pi^(1/2)*(-2)^n/(1*3*..*(2*n-1))
numeric n = abs(ex_to_numeric(x).sub(_num1_2()));
numeric coefficient = pow(_num_2(), n);
coefficient = coefficient.div(doublefactorial(n.mul(_num2()).sub(_num1())));;
return coefficient*power(Pi,_ex1_2());
}
}
- // gamma_evalf should be called here once it becomes available
+ // Gamma_evalf should be called here once it becomes available
}
- return gamma(x).hold();
+ return Gamma(x).hold();
}
-static ex gamma_deriv(const ex & x, unsigned deriv_param)
+static ex Gamma_deriv(const ex & x, unsigned deriv_param)
{
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);
+ // 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)
+static ex Gamma_series(const ex & x, const symbol & s, const ex & pt, int order)
{
// method:
// Taylor series where there is no pole falls back to psi function
// evaluation.
// On a pole at -m use the recurrence relation
- // gamma(x) == gamma(x+1) / x
+ // Gamma(x) == Gamma(x+1) / x
// from which follows
- // series(gamma(x),x,-m,order) ==
- // series(gamma(x+m+1)/(x*(x+1)*...*(x+m)),x,-m,order+1);
+ // series(Gamma(x),x,-m,order) ==
+ // series(Gamma(x+m+1)/(x*(x+1)*...*(x+m)),x,-m,order+1);
const ex x_pt = x.subs(s==pt);
if (!x_pt.info(info_flags::integer) || x_pt.info(info_flags::positive))
throw do_taylor(); // caught by function::series()
ex ser_denom = _ex1();
for (numeric p; p<=m; ++p)
ser_denom *= x+p;
- return (gamma(x+m+_ex1())/ser_denom).series(s, pt, order+1);
+ return (Gamma(x+m+_ex1())/ser_denom).series(s, pt, order+1);
}
-REGISTER_FUNCTION(gamma, eval_func(gamma_eval).
- evalf_func(gamma_evalf).
- derivative_func(gamma_deriv).
- series_func(gamma_series));
+REGISTER_FUNCTION(Gamma, eval_func(Gamma_eval).
+ evalf_func(Gamma_evalf).
+ derivative_func(Gamma_deriv).
+ series_func(Gamma_series));
//////////
// Beta-function
//////////
-static ex beta_evalf(const ex & x, const ex & y)
+static ex Beta_evalf(const ex & x, const ex & y)
{
BEGIN_TYPECHECK
TYPECHECK(x,numeric)
TYPECHECK(y,numeric)
- END_TYPECHECK(beta(x,y))
+ 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)
+static ex Beta_eval(const ex & x, const ex & y)
{
if (x.info(info_flags::numeric) && y.info(info_flags::numeric)) {
- // treat all problematic x and y that may not be passed into gamma,
- // because they would throw there although beta(x,y) is well-defined
- // using the formula beta(x,y) == (-1)^y * beta(1-x-y, y)
+ // treat all problematic x and y that may not be passed into Gamma,
+ // because they would throw there although Beta(x,y) is well-defined
+ // using the formula Beta(x,y) == (-1)^y * Beta(1-x-y, y)
numeric nx(ex_to_numeric(x));
numeric ny(ex_to_numeric(y));
if (nx.is_real() && nx.is_integer() &&
ny.is_real() && ny.is_integer()) {
if (nx.is_negative()) {
if (nx<=-ny)
- return pow(_num_1(), ny)*beta(1-x-y, y);
+ return pow(_num_1(), ny)*Beta(1-x-y, y);
else
- throw (std::domain_error("beta_eval(): simple pole"));
+ throw (std::domain_error("Beta_eval(): simple pole"));
}
if (ny.is_negative()) {
if (ny<=-nx)
- return pow(_num_1(), nx)*beta(1-y-x, x);
+ return pow(_num_1(), nx)*Beta(1-y-x, x);
else
- throw (std::domain_error("beta_eval(): simple pole"));
+ throw (std::domain_error("Beta_eval(): simple pole"));
}
- return gamma(x)*gamma(y)/gamma(x+y);
+ return Gamma(x)*Gamma(y)/Gamma(x+y);
}
// no problem in numerator, but denominator has pole:
if ((nx+ny).is_real() &&
!(nx+ny).is_positive())
return _ex0();
// everything is ok:
- return gamma(x)*gamma(y)/gamma(x+y);
+ return Gamma(x)*Gamma(y)/Gamma(x+y);
}
- return beta(x,y).hold();
+ return Beta(x,y).hold();
}
-static ex beta_deriv(const ex & x, const ex & y, unsigned deriv_param)
+static ex Beta_deriv(const ex & x, const ex & y, unsigned deriv_param)
{
GINAC_ASSERT(deriv_param<2);
ex retval;
- // d/dx beta(x,y) -> (psi(x)-psi(x+y)) * beta(x,y)
+ // d/dx Beta(x,y) -> (psi(x)-psi(x+y)) * Beta(x,y)
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)
+ retval = (psi(x)-psi(x+y))*Beta(x,y);
+ // d/dy Beta(x,y) -> (psi(y)-psi(x+y)) * Beta(x,y)
if (deriv_param==1)
- retval = (psi(y)-psi(x+y))*beta(x,y);
+ 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)
+static ex Beta_series(const ex & x, const ex & y, const symbol & s, const ex & pt, int order)
{
// method:
- // Taylor series where there is no pole of one of the gamma functions
- // falls back to beta function evaluation. Otherwise, fall back to
- // gamma series directly.
+ // Taylor series where there is no pole of one of the Gamma functions
+ // falls back to Beta function evaluation. Otherwise, fall back to
+ // Gamma series directly.
// FIXME: this could need some testing, maybe it's wrong in some cases?
const ex x_pt = x.subs(s==pt);
const ex y_pt = y.subs(s==pt);
throw do_taylor(); // caught by function::series()
// trap the case where x is on a pole directly:
if (x.info(info_flags::integer) && !x.info(info_flags::positive))
- x_ser = gamma(x+s).series(s,pt,order);
+ x_ser = Gamma(x+s).series(s,pt,order);
else
- x_ser = gamma(x).series(s,pt,order);
+ x_ser = Gamma(x).series(s,pt,order);
// trap the case where y is on a pole directly:
if (y.info(info_flags::integer) && !y.info(info_flags::positive))
- y_ser = gamma(y+s).series(s,pt,order);
+ y_ser = Gamma(y+s).series(s,pt,order);
else
- y_ser = gamma(y).series(s,pt,order);
+ y_ser = Gamma(y).series(s,pt,order);
// trap the case where y is on a pole directly:
if ((x+y).info(info_flags::integer) && !(x+y).info(info_flags::positive))
- xy_ser = gamma(y+x+s).series(s,pt,order);
+ xy_ser = Gamma(y+x+s).series(s,pt,order);
else
- xy_ser = gamma(y+x).series(s,pt,order);
+ xy_ser = Gamma(y+x).series(s,pt,order);
// compose the result:
return (x_ser*y_ser/xy_ser).series(s,pt,order);
}
-REGISTER_FUNCTION(beta, eval_func(beta_eval).
- evalf_func(beta_evalf).
- derivative_func(beta_deriv).
- series_func(beta_series));
+REGISTER_FUNCTION(Beta, eval_func(Beta_eval).
+ evalf_func(Beta_evalf).
+ derivative_func(Beta_deriv).
+ series_func(Beta_series));
//////////
if (nx.is_integer()) {
// integer case
if (nx.is_positive()) {
- // psi(n) -> 1 + 1/2 +...+ 1/(n-1) - EulerGamma
+ // psi(n) -> 1 + 1/2 +...+ 1/(n-1) - gamma
numeric rat(0);
for (numeric i(nx+_num_1()); i.is_positive(); --i)
rat += i.inverse();
- return rat-EulerGamma;
+ return rat-gamma;
} else {
// for non-positive integers there is a pole:
throw (std::domain_error("psi_eval(): simple pole"));
if ((_num2()*nx).is_integer()) {
// half integer case
if (nx.is_positive()) {
- // psi((2m+1)/2) -> 2/(2m+1) + 2/2m +...+ 2/1 - EulerGamma - 2log(2)
+ // psi((2m+1)/2) -> 2/(2m+1) + 2/2m +...+ 2/1 - gamma - 2log(2)
numeric rat(0);
for (numeric i((nx+_num_1())*_num2()); i.is_positive(); i-=_num2())
rat += _num2()*i.inverse();
- return rat-EulerGamma-_ex2()*log(_ex2());
+ return rat-gamma-_ex2()*log(_ex2());
} else {
// use the recurrence relation
// psi(-m-1/2) == psi(-m-1/2+1) - 1 / (-m-1/2)
// psi(0,x) -> psi(x)
if (n.is_zero())
return psi(x);
- // psi(-1,x) -> log(gamma(x))
+ // psi(-1,x) -> log(Gamma(x))
if (n.is_equal(_ex_1()))
- return log(gamma(x));
+ return log(Gamma(x));
if (n.info(info_flags::numeric) && n.info(info_flags::posint) &&
x.info(info_flags::numeric)) {
numeric nn = ex_to_numeric(n);
}
-/** The gamma function.
+/** The Gamma function.
* This is only a stub! */
-const numeric gamma(const numeric & x)
+const numeric Gamma(const numeric & x)
{
- clog << "gamma(" << x
+ clog << "Gamma(" << x
<< "): Does anybody know good way to calculate this numerically?"
<< endl;
return numeric(0);
/** Floating point evaluation of Euler's constant Gamma. */
-ex EulerGammaEvalf(void)
+ex gammaEvalf(void)
{
return numeric(::cl_eulerconst(cl_default_float_format)); // -> CLN
}
const numeric acosh(const numeric & x);
const numeric atanh(const numeric & x);
const numeric zeta(const numeric & x);
-const numeric gamma(const numeric & x);
+const numeric Gamma(const numeric & x);
const numeric psi(const numeric & x);
const numeric psi(const numeric & n, const numeric & x);
const numeric factorial(const numeric & n);
// numeric evaluation functions for class constant objects:
ex PiEvalf(void);
-ex EulerGammaEvalf(void);
+ex gammaEvalf(void);
ex CatalanEvalf(void);
.B Catalan
Catalan's Constant
.TP
-.B EulerGamma
+.B gamma
Euler-Mascheroni Constant
.TP
.B I
/* special values */
Pi yylval = Pi; return T_LITERAL;
-EulerGamma yylval = EulerGamma; return T_LITERAL;
+gamma yylval = gamma; return T_LITERAL;
Catalan yylval = Catalan; return T_LITERAL;
FAIL yylval = *new fail(); return T_LITERAL;
I yylval = I; return T_NUMBER;
insert_fcn_help("atan", "inverse tangent function");
insert_fcn_help("atan2", "inverse tangent function with two arguments");
insert_fcn_help("atanh", "inverse hyperbolic tangent function");
- insert_fcn_help("beta", "beta function");
+ insert_fcn_help("Beta", "Beta function");
insert_fcn_help("binomial", "binomial function");
insert_fcn_help("cos", "cosine function");
insert_fcn_help("cosh", "hyperbolic cosine function");
insert_fcn_help("exp", "exponential function");
insert_fcn_help("factorial", "factorial function");
- insert_fcn_help("gamma", "gamma function");
+ insert_fcn_help("Gamma", "Gamma function");
insert_fcn_help("log", "natural logarithm");
insert_fcn_help("psi", "psi function\npsi(x) is the digamma function, psi(n,x) the nth polygamma function");
insert_fcn_help("sin", "sine function");