]> www.ginac.de Git - ginac.git/blob - ginac/inifcns.h
removed "ginac" from includedir (as in ginac-config)
[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-2003 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 /** Absolute value. */
32 DECLARE_FUNCTION_1P(abs)
33         
34 /** Complex sign. */
35 DECLARE_FUNCTION_1P(csgn)
36
37 /** Eta function: log(a*b) == log(a) + log(b) + eta(a, b). */
38 DECLARE_FUNCTION_2P(eta)
39
40 /** Sine. */
41 DECLARE_FUNCTION_1P(sin)
42
43 /** Cosine. */
44 DECLARE_FUNCTION_1P(cos)
45
46 /** Tangent. */
47 DECLARE_FUNCTION_1P(tan)
48
49 /** Exponential function. */
50 DECLARE_FUNCTION_1P(exp)
51
52 /** Natural logarithm. */
53 DECLARE_FUNCTION_1P(log)
54
55 /** Inverse sine (arc sine). */
56 DECLARE_FUNCTION_1P(asin)
57
58 /** Inverse cosine (arc cosine). */
59 DECLARE_FUNCTION_1P(acos)
60
61 /** Inverse tangent (arc tangent). */
62 DECLARE_FUNCTION_1P(atan)
63
64 /** Inverse tangent with two arguments. */
65 DECLARE_FUNCTION_2P(atan2)
66
67 /** Hyperbolic Sine. */
68 DECLARE_FUNCTION_1P(sinh)
69
70 /** Hyperbolic Cosine. */
71 DECLARE_FUNCTION_1P(cosh)
72
73 /** Hyperbolic Tangent. */
74 DECLARE_FUNCTION_1P(tanh)
75
76 /** Inverse hyperbolic Sine (area hyperbolic sine). */
77 DECLARE_FUNCTION_1P(asinh)
78
79 /** Inverse hyperbolic Cosine (area hyperbolic cosine). */
80 DECLARE_FUNCTION_1P(acosh)
81
82 /** Inverse hyperbolic Tangent (area hyperbolic tangent). */
83 DECLARE_FUNCTION_1P(atanh)
84
85 /** Dilogarithm. */
86 DECLARE_FUNCTION_1P(Li2)
87
88 /** Trilogarithm. */
89 DECLARE_FUNCTION_1P(Li3)
90
91 /** Derivatives of Riemann's Zeta-function. */
92 DECLARE_FUNCTION_2P(zetaderiv)
93
94 // overloading at work: we cannot use the macros here
95 /** Multiple zeta value including Riemann's zeta-function. */
96 class zeta1_SERIAL { public: static unsigned serial; };
97 template<typename T1>
98 inline function zeta(const T1& p1) {
99         return function(zeta1_SERIAL::serial, ex(p1));
100 }
101 /** Alternating Euler sum or colored MZV. */
102 class zeta2_SERIAL { public: static unsigned serial; };
103 template<typename T1, typename T2>
104 inline function zeta(const T1& p1, const T2& p2) {
105         return function(zeta2_SERIAL::serial, ex(p1), ex(p2));
106 }
107 class zeta_SERIAL;
108 template<> inline bool is_the_function<class zeta_SERIAL>(const ex& x)
109 {
110         return is_the_function<zeta1_SERIAL>(x) || is_the_function<zeta2_SERIAL>(x);
111 }
112
113 /** Polylogarithm and multiple polylogarithm. */
114 DECLARE_FUNCTION_2P(Li)
115
116 /** Nielsen's generalized polylogarithm. */
117 DECLARE_FUNCTION_3P(S)
118
119 // overloading at work: we cannot use the macros here
120 /** Harmonic polylogarithm with only positive parameters. */
121 class H2_SERIAL { public: static unsigned serial; };
122 template<typename T1, typename T2>
123 inline function H(const T1& p1, const T2& p2) {
124         return function(H2_SERIAL::serial, ex(p1), ex(p2));
125 }
126 /** Harmonic polylogarithm with signed parameters. */
127 class H3_SERIAL { public: static unsigned serial; };
128 template<typename T1, typename T2, typename T3>
129 inline function H(const T1& p1, const T2& p2, const T3& p3) {
130         return function(H3_SERIAL::serial, ex(p1), ex(p2), ex(p3));
131 }
132 class H_SERIAL;
133 template<> inline bool is_the_function<class H_SERIAL>(const ex& x)
134 {
135         return is_the_function<H2_SERIAL>(x) || is_the_function<H3_SERIAL>(x);
136 }
137
138 /** Gamma-function. */
139 DECLARE_FUNCTION_1P(lgamma)
140 DECLARE_FUNCTION_1P(tgamma)
141
142 /** Beta-function. */
143 DECLARE_FUNCTION_2P(beta)
144
145 // overloading at work: we cannot use the macros here
146 /** Psi-function (aka digamma-function). */
147 class psi1_SERIAL { public: static unsigned serial; };
148 template<typename T1>
149 inline function psi(const T1 & p1) {
150         return function(psi1_SERIAL::serial, ex(p1));
151 }
152 /** Derivatives of Psi-function (aka polygamma-functions). */
153 class psi2_SERIAL { public: static unsigned serial; };
154 template<typename T1, typename T2>
155 inline function psi(const T1 & p1, const T2 & p2) {
156         return function(psi2_SERIAL::serial, ex(p1), ex(p2));
157 }
158 class psi_SERIAL;
159 template<> inline bool is_the_function<class psi_SERIAL>(const ex & x)
160 {
161         return is_the_function<psi1_SERIAL>(x) || is_the_function<psi2_SERIAL>(x);
162 }
163         
164 /** Factorial function. */
165 DECLARE_FUNCTION_1P(factorial)
166
167 /** Binomial function. */
168 DECLARE_FUNCTION_2P(binomial)
169
170 /** Order term function (for truncated power series). */
171 DECLARE_FUNCTION_1P(Order)
172
173 ex lsolve(const ex &eqns, const ex &symbols, unsigned options = solve_algo::automatic);
174
175 /** Check whether a function is the Order (O(n)) function. */
176 inline bool is_order_function(const ex & e)
177 {
178         return is_ex_the_function(e, Order);
179 }
180
181 /** Converts a given list containing parameters for H in Remiddi/Vermaseren notation into
182  *  the corresponding GiNaC functions.
183  */
184 ex convert_H_notation(const ex& parameterlst, const ex& arg);
185
186 } // namespace GiNaC
187
188 #endif // ndef __GINAC_INIFCNS_H__