]> www.ginac.de Git - ginac.git/blob - ginac/inifcns_polylog.h
* _function suffix only for cmath functions and conjugate().
[ginac.git] / ginac / inifcns_polylog.h
1 /** @file inifcns_polylog.h
2  *
3  *  Interface to GiNaC's initially known polylogarithmic functions. */
4
5 /*
6  *  GiNaC Copyright (C) 1999-2006 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22
23 #ifndef __GINAC_INIFCNS_POLYLOG_H__
24 #define __GINAC_INIFCNS_POLYLOG_H__
25
26 #include "numeric.h"
27 #include "function.h"
28 #include "ex.h"
29 #include "inifcns.h"
30
31 namespace GiNaC {
32
33 /** Generalized multiple polylogarithm. */
34 class G_function : public function
35 {
36         GINAC_DECLARE_FUNCTION(G_function)
37 public:
38         /** Generalized multiple polylogarithm. */
39         G_function(const ex& x) : inherited(&G_function::tinfo_static, x) { }
40         /** Generalized multiple polylogarithm with explicit imaginary parts. */
41         G_function(const ex& x, const ex& y) : inherited(&G_function::tinfo_static, x, y) { }
42         /** Generalized multiple polylogarithm with explicit imaginary parts. */
43         G_function(const ex& x, const ex& s, const ex& y) : inherited(&G_function::tinfo_static, x, s, y) { }
44 public:
45         virtual ex eval(int level = 0) const;
46         virtual ex evalf(int level = 0) const;
47 };
48
49 template<typename T1> inline G_function G(const T1& x1) { return G_function(x1); }
50 template<typename T1, typename T2> inline G_function G(const T1& x1, const T2& x2) { return G_function(x1, x2); }
51 template<typename T1, typename T2, typename T3> inline G_function G(const T1& x1, const T2& x2, const T3& x3) { return G_function(x1, x2, x3); }
52
53 /** Polylogarithm and multiple polylogarithm. */
54 class Li_function : public function
55 {
56         GINAC_DECLARE_FUNCTION_2P(Li_function)
57 public:
58         virtual ex eval(int level = 0) const;
59         virtual ex evalf(int level = 0) const;
60         virtual ex pderivative(unsigned deriv_param) const;
61         virtual ex series(const relational& r, int order, unsigned options = 0) const;
62 protected:
63         void do_print_latex(const print_context& c, unsigned level) const;
64 };
65
66 template<typename T1, typename T2> inline Li_function Li(const T1& x1, const T2& x2) { return Li_function(x1, x2); }
67
68 /** Nielsen's generalized polylogarithm. */
69 class S_function : public function
70 {
71         GINAC_DECLARE_FUNCTION_3P(S_function)
72 public:
73         virtual ex eval(int level = 0) const;
74         virtual ex evalf(int level = 0) const;
75         virtual ex pderivative(unsigned deriv_param) const;
76         virtual ex series(const relational& r, int order, unsigned options = 0) const;
77 protected:
78         void do_print_latex(const print_context& c, unsigned level) const;
79 };
80
81 template<typename T1, typename T2, typename T3> inline S_function S(const T1& x1, const T2& x2, const T3& x3) { return S_function(x1, x2, x3); }
82
83 /** Harmonic polylogarithm. */
84 class H_function : public function
85 {
86         GINAC_DECLARE_FUNCTION_2P(H_function)
87 public:
88         virtual ex eval(int level = 0) const;
89         virtual ex evalf(int level = 0) const;
90         virtual ex pderivative(unsigned deriv_param) const;
91         virtual ex series(const relational& r, int order, unsigned options = 0) const;
92         static bool do_eval;
93 protected:
94         void do_print_latex(const print_context& c, unsigned level) const;
95 };
96
97 template<typename T1, typename T2> inline H_function H(const T1& x1, const T2& x2) { return H_function(x1, x2); }
98
99 /** Multiple zeta value including Riemann's zeta-function. */
100 class zeta_function : public function
101 {
102         GINAC_DECLARE_FUNCTION(zeta_function)
103 public:
104         /** Multiple zeta value including Riemann's zeta-function. */
105         zeta_function(const ex& x) : inherited(&zeta_function::tinfo_static, x) { }
106         /** Alternating Euler sum or colored MZV. */
107         zeta_function(const ex& x, const ex& s) : inherited(&zeta_function::tinfo_static, x, s) { }
108 public:
109         virtual ex eval(int level = 0) const;
110         virtual ex evalf(int level = 0) const;
111         virtual ex pderivative(unsigned deriv_param) const;
112 public:
113         static numeric calc(const numeric& x);
114 protected:
115         void do_print_latex(const print_context& c, unsigned level) const;
116 };
117
118 template<typename T1> inline zeta_function zeta(const T1& x1) { return zeta_function(x1); }
119 //inline zeta_function zeta(const ex& x1) { return zeta_function(x1); }
120 template<typename T1, typename T2> inline zeta_function zeta(const T1& x1, const T2& x2) { return zeta_function(x1, x2); }
121
122 /** Converts a given list containing parameters for H in Remiddi/Vermaseren notation into
123  *  the corresponding GiNaC functions.
124  */
125 ex convert_H_to_Li(const ex& parameterlst, const ex& arg);
126
127 /** Dilogarithm. */
128 template<typename T1> inline Li_function Li2(const T1& x1) { return Li_function(2, x1); }
129
130 /** Trilogarithm. */
131 template<typename T1> inline Li_function Li3(const T1& x1) { return Li_function(3, x1); }
132
133 /** Derivatives of Riemann's Zeta-function. */
134 class zetaderiv_function : public function
135 {
136         GINAC_DECLARE_FUNCTION_2P(zetaderiv_function)
137 public:
138         virtual ex eval(int level = 0) const;
139         virtual ex pderivative(unsigned deriv_param) const;
140 protected:
141         void do_print_latex(const print_context& c, unsigned level) const;
142 };
143
144 template<typename T1, typename T2> inline zetaderiv_function zetaderiv(const T1& x1, const T2& x2) { return zetaderiv_function(x1, x2); }
145
146 } // namespace GiNaC
147
148 #endif // ndef __GINAC_INIFCNS_H__