3 * Interface to GiNaC's initially known functions. */
6 * GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef __GINAC_INIFCNS_H__
24 #define __GINAC_INIFCNS_H__
31 /** Complex conjugate. */
32 DECLARE_FUNCTION_1P(conjugate_function)
34 /** Absolute value. */
35 DECLARE_FUNCTION_1P(abs)
38 DECLARE_FUNCTION_1P(csgn)
40 /** Eta function: log(a*b) == log(a) + log(b) + eta(a, b). */
41 DECLARE_FUNCTION_2P(eta)
44 DECLARE_FUNCTION_1P(sin)
47 DECLARE_FUNCTION_1P(cos)
50 DECLARE_FUNCTION_1P(tan)
52 /** Exponential function. */
53 DECLARE_FUNCTION_1P(exp)
55 /** Natural logarithm. */
56 DECLARE_FUNCTION_1P(log)
58 /** Inverse sine (arc sine). */
59 DECLARE_FUNCTION_1P(asin)
61 /** Inverse cosine (arc cosine). */
62 DECLARE_FUNCTION_1P(acos)
64 /** Inverse tangent (arc tangent). */
65 DECLARE_FUNCTION_1P(atan)
67 /** Inverse tangent with two arguments. */
68 DECLARE_FUNCTION_2P(atan2)
70 /** Hyperbolic Sine. */
71 DECLARE_FUNCTION_1P(sinh)
73 /** Hyperbolic Cosine. */
74 DECLARE_FUNCTION_1P(cosh)
76 /** Hyperbolic Tangent. */
77 DECLARE_FUNCTION_1P(tanh)
79 /** Inverse hyperbolic Sine (area hyperbolic sine). */
80 DECLARE_FUNCTION_1P(asinh)
82 /** Inverse hyperbolic Cosine (area hyperbolic cosine). */
83 DECLARE_FUNCTION_1P(acosh)
85 /** Inverse hyperbolic Tangent (area hyperbolic tangent). */
86 DECLARE_FUNCTION_1P(atanh)
89 DECLARE_FUNCTION_1P(Li2)
92 DECLARE_FUNCTION_1P(Li3)
94 /** Derivatives of Riemann's Zeta-function. */
95 DECLARE_FUNCTION_2P(zetaderiv)
97 // overloading at work: we cannot use the macros here
98 /** Multiple zeta value including Riemann's zeta-function. */
99 class zeta1_SERIAL { public: static unsigned serial; };
100 template<typename T1>
101 inline function zeta(const T1& p1) {
102 return function(zeta1_SERIAL::serial, ex(p1));
104 /** Alternating Euler sum or colored MZV. */
105 class zeta2_SERIAL { public: static unsigned serial; };
106 template<typename T1, typename T2>
107 inline function zeta(const T1& p1, const T2& p2) {
108 return function(zeta2_SERIAL::serial, ex(p1), ex(p2));
111 template<> inline bool is_the_function<class zeta_SERIAL>(const ex& x)
113 return is_the_function<zeta1_SERIAL>(x) || is_the_function<zeta2_SERIAL>(x);
116 // overloading at work: we cannot use the macros here
117 /** Generalized multiple polylogarithm. */
118 class G2_SERIAL { public: static unsigned serial; };
119 template<typename T1, typename T2>
120 inline function G(const T1& x, const T2& y) {
121 return function(G2_SERIAL::serial, ex(x), ex(y));
123 /** Generalized multiple polylogarithm with explicit imaginary parts. */
124 class G3_SERIAL { public: static unsigned serial; };
125 template<typename T1, typename T2, typename T3>
126 inline function G(const T1& x, const T2& s, const T3& y) {
127 return function(G3_SERIAL::serial, ex(x), ex(s), ex(y));
130 template<> inline bool is_the_function<class G_SERIAL>(const ex& x)
132 return is_the_function<G2_SERIAL>(x) || is_the_function<G3_SERIAL>(x);
135 /** Polylogarithm and multiple polylogarithm. */
136 DECLARE_FUNCTION_2P(Li)
138 /** Nielsen's generalized polylogarithm. */
139 DECLARE_FUNCTION_3P(S)
141 /** Harmonic polylogarithm. */
142 DECLARE_FUNCTION_2P(H)
144 /** Gamma-function. */
145 DECLARE_FUNCTION_1P(lgamma)
146 DECLARE_FUNCTION_1P(tgamma)
148 /** Beta-function. */
149 DECLARE_FUNCTION_2P(beta)
151 // overloading at work: we cannot use the macros here
152 /** Psi-function (aka digamma-function). */
153 class psi1_SERIAL { public: static unsigned serial; };
154 template<typename T1>
155 inline function psi(const T1 & p1) {
156 return function(psi1_SERIAL::serial, ex(p1));
158 /** Derivatives of Psi-function (aka polygamma-functions). */
159 class psi2_SERIAL { public: static unsigned serial; };
160 template<typename T1, typename T2>
161 inline function psi(const T1 & p1, const T2 & p2) {
162 return function(psi2_SERIAL::serial, ex(p1), ex(p2));
165 template<> inline bool is_the_function<class psi_SERIAL>(const ex & x)
167 return is_the_function<psi1_SERIAL>(x) || is_the_function<psi2_SERIAL>(x);
170 /** Factorial function. */
171 DECLARE_FUNCTION_1P(factorial)
173 /** Binomial function. */
174 DECLARE_FUNCTION_2P(binomial)
176 /** Order term function (for truncated power series). */
177 DECLARE_FUNCTION_1P(Order)
179 ex lsolve(const ex &eqns, const ex &symbols, unsigned options = solve_algo::automatic);
181 /** Check whether a function is the Order (O(n)) function. */
182 inline bool is_order_function(const ex & e)
184 return is_ex_the_function(e, Order);
187 /** Converts a given list containing parameters for H in Remiddi/Vermaseren notation into
188 * the corresponding GiNaC functions.
190 ex convert_H_to_Li(const ex& parameterlst, const ex& arg);
194 #endif // ndef __GINAC_INIFCNS_H__