]> www.ginac.de Git - ginac.git/blob - ginac/inifcns.h
Various bug-fixes and enhancements (new moebius transformation).
[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 /** Polylogarithm and multiple polylogarithm. */
117 DECLARE_FUNCTION_2P(Li)
118
119 /** Nielsen's generalized polylogarithm. */
120 DECLARE_FUNCTION_3P(S)
121
122 /** Harmonic polylogarithm. */
123 DECLARE_FUNCTION_2P(H)
124
125 /** Gamma-function. */
126 DECLARE_FUNCTION_1P(lgamma)
127 DECLARE_FUNCTION_1P(tgamma)
128
129 /** Beta-function. */
130 DECLARE_FUNCTION_2P(beta)
131
132 // overloading at work: we cannot use the macros here
133 /** Psi-function (aka digamma-function). */
134 class psi1_SERIAL { public: static unsigned serial; };
135 template<typename T1>
136 inline function psi(const T1 & p1) {
137         return function(psi1_SERIAL::serial, ex(p1));
138 }
139 /** Derivatives of Psi-function (aka polygamma-functions). */
140 class psi2_SERIAL { public: static unsigned serial; };
141 template<typename T1, typename T2>
142 inline function psi(const T1 & p1, const T2 & p2) {
143         return function(psi2_SERIAL::serial, ex(p1), ex(p2));
144 }
145 class psi_SERIAL;
146 template<> inline bool is_the_function<class psi_SERIAL>(const ex & x)
147 {
148         return is_the_function<psi1_SERIAL>(x) || is_the_function<psi2_SERIAL>(x);
149 }
150         
151 /** Factorial function. */
152 DECLARE_FUNCTION_1P(factorial)
153
154 /** Binomial function. */
155 DECLARE_FUNCTION_2P(binomial)
156
157 /** Order term function (for truncated power series). */
158 DECLARE_FUNCTION_1P(Order)
159
160 ex lsolve(const ex &eqns, const ex &symbols, unsigned options = solve_algo::automatic);
161
162 /** Check whether a function is the Order (O(n)) function. */
163 inline bool is_order_function(const ex & e)
164 {
165         return is_ex_the_function(e, Order);
166 }
167
168 /** Converts a given list containing parameters for H in Remiddi/Vermaseren notation into
169  *  the corresponding GiNaC functions.
170  */
171 ex convert_H_to_Li(const ex& parameterlst, const ex& arg);
172
173 } // namespace GiNaC
174
175 #endif // ndef __GINAC_INIFCNS_H__