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)-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)
+> series(tgamma(x),x==0,3);
+x^(-1)-Euler+(1/12*Pi^2+1/2*Euler^2)*x+
+(-1/3*zeta(3)-1/12*Pi^2*Euler-1/6*Euler^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*gamma^2-1/240)*(x-1/2*Pi)^2
--gamma-1/12+Order((x-1/2*Pi)^3)
+> series(tgamma(2*sin(x)-2),x==Pi/2,6);
+-(x-1/2*Pi)^(-2)+(-1/12*Pi^2-1/2*Euler^2-1/240)*(x-1/2*Pi)^2
+-Euler-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{gamma}
+@cindex @code{Euler}
@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{gamma}
+@item @code{Euler}
@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 << "tgamma(" << foo << ") -> " << tgamma(foo) << endl;
ex bar = foo.subs(y==1);
- cout << "Gamma(" << bar << ") -> " << Gamma(bar) << endl;
+ cout << "tgamma(" << bar << ") -> " << tgamma(bar) << endl;
ex foobar = bar.subs(x==7);
- cout << "Gamma(" << foobar << ") -> " << Gamma(foobar) << endl;
+ cout << "tgamma(" << foobar << ") -> " << tgamma(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)
+tgamma(x+(1/2)*y) -> tgamma(x+(1/2)*y)
+tgamma(x+1/2) -> tgamma(x+1/2)
+tgamma(15/2) -> (135135/128)*Pi^(1/2)
@end example
@cindex branch cut
which is correct if there are no poles involved as is the case for the
@code{cos} function. The way GiNaC handles poles in case there are any
is best understood by studying one of the examples, like the Gamma
-function for instance. (In essence the function first checks if there
-is a pole at the evaluation point and falls back to Taylor expansion if
-there isn't. Then, the pole is regularized by some suitable
-transformation.) Also, the new function needs to be declared somewhere.
-This may also be done by a convenient preprocessor macro:
+(@code{tgamma}) function for instance. (In essence the function first
+checks if there is a pole at the evaluation point and falls back to
+Taylor expansion if there isn't. Then, the pole is regularized by some
+suitable transformation.) Also, the new function needs to be declared
+somewhere. This may also be done by a convenient preprocessor macro:
@example
DECLARE_FUNCTION_1P(cos)