]> www.ginac.de Git - ginac.git/blob - ginac/inifcns.h
cb42c859a81e087398c31f6bf37f129b9d5a10f7
[ginac.git] / ginac / inifcns.h
1 /** @file inifcns.h
2  *
3  *  Interface to GiNaC's initially known functions. */
4
5 /*
6  *  GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany
7  *
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.
12  *
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.
17  *
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
21  */
22
23 #ifndef __GINAC_INIFCNS_H__
24 #define __GINAC_INIFCNS_H__
25
26 #include "function.h"
27 #include "ex.h"
28
29 namespace GiNaC {
30
31 /** Complex conjugate. */
32 DECLARE_FUNCTION_1P(conjugate_function)
33         
34 /** Absolute value. */
35 DECLARE_FUNCTION_1P(abs)
36         
37 /** Complex sign. */
38 DECLARE_FUNCTION_1P(csgn)
39
40 /** Eta function: log(a*b) == log(a) + log(b) + eta(a, b). */
41 DECLARE_FUNCTION_2P(eta)
42
43 /** Sine. */
44 DECLARE_FUNCTION_1P(sin)
45
46 /** Cosine. */
47 DECLARE_FUNCTION_1P(cos)
48
49 /** Tangent. */
50 DECLARE_FUNCTION_1P(tan)
51
52 /** Exponential function. */
53 DECLARE_FUNCTION_1P(exp)
54
55 /** Natural logarithm. */
56 DECLARE_FUNCTION_1P(log)
57
58 /** Inverse sine (arc sine). */
59 DECLARE_FUNCTION_1P(asin)
60
61 /** Inverse cosine (arc cosine). */
62 DECLARE_FUNCTION_1P(acos)
63
64 /** Inverse tangent (arc tangent). */
65 DECLARE_FUNCTION_1P(atan)
66
67 /** Inverse tangent with two arguments. */
68 DECLARE_FUNCTION_2P(atan2)
69
70 /** Hyperbolic Sine. */
71 DECLARE_FUNCTION_1P(sinh)
72
73 /** Hyperbolic Cosine. */
74 DECLARE_FUNCTION_1P(cosh)
75
76 /** Hyperbolic Tangent. */
77 DECLARE_FUNCTION_1P(tanh)
78
79 /** Inverse hyperbolic Sine (area hyperbolic sine). */
80 DECLARE_FUNCTION_1P(asinh)
81
82 /** Inverse hyperbolic Cosine (area hyperbolic cosine). */
83 DECLARE_FUNCTION_1P(acosh)
84
85 /** Inverse hyperbolic Tangent (area hyperbolic tangent). */
86 DECLARE_FUNCTION_1P(atanh)
87
88 /** Dilogarithm. */
89 DECLARE_FUNCTION_1P(Li2)
90
91 /** Trilogarithm. */
92 DECLARE_FUNCTION_1P(Li3)
93
94 /** Derivatives of Riemann's Zeta-function. */
95 DECLARE_FUNCTION_2P(zetaderiv)
96
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));
103 }
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));
109 }
110 class zeta_SERIAL;
111 template<> inline bool is_the_function<class zeta_SERIAL>(const ex& x)
112 {
113         return is_the_function<zeta1_SERIAL>(x) || is_the_function<zeta2_SERIAL>(x);
114 }
115
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));
122 }
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));
128 }
129 class G_SERIAL;
130 template<> inline bool is_the_function<class G_SERIAL>(const ex& x)
131 {
132         return is_the_function<G2_SERIAL>(x) || is_the_function<G3_SERIAL>(x);
133 }
134
135 /** Polylogarithm and multiple polylogarithm. */
136 DECLARE_FUNCTION_2P(Li)
137
138 /** Nielsen's generalized polylogarithm. */
139 DECLARE_FUNCTION_3P(S)
140
141 /** Harmonic polylogarithm. */
142 DECLARE_FUNCTION_2P(H)
143
144 /** Gamma-function. */
145 DECLARE_FUNCTION_1P(lgamma)
146 DECLARE_FUNCTION_1P(tgamma)
147
148 /** Beta-function. */
149 DECLARE_FUNCTION_2P(beta)
150
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));
157 }
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));
163 }
164 class psi_SERIAL;
165 template<> inline bool is_the_function<class psi_SERIAL>(const ex & x)
166 {
167         return is_the_function<psi1_SERIAL>(x) || is_the_function<psi2_SERIAL>(x);
168 }
169         
170 /** Factorial function. */
171 DECLARE_FUNCTION_1P(factorial)
172
173 /** Binomial function. */
174 DECLARE_FUNCTION_2P(binomial)
175
176 /** Order term function (for truncated power series). */
177 DECLARE_FUNCTION_1P(Order)
178
179 ex lsolve(const ex &eqns, const ex &symbols, unsigned options = solve_algo::automatic);
180
181 /** Check whether a function is the Order (O(n)) function. */
182 inline bool is_order_function(const ex & e)
183 {
184         return is_ex_the_function(e, Order);
185 }
186
187 /** Converts a given list containing parameters for H in Remiddi/Vermaseren notation into
188  *  the corresponding GiNaC functions.
189  */
190 ex convert_H_to_Li(const ex& parameterlst, const ex& arg);
191
192 } // namespace GiNaC
193
194 #endif // ndef __GINAC_INIFCNS_H__