120 for (
numeric i1=1; i1<=n; i1++) {
121 if (
irem(n,i1) == 0 ) {
148 ex conductor =
abs(a);
151 if ( conductor == 1 ) {
182 ex res = coefficient_a0(k,a,b);
184 for (
numeric i1=1; i1<N; i1++) {
185 res += divisor_function(i1,a,b,k) *
pow(q,i1);
198 int N_order_int = N_order.to_int();
200 ex res = eisenstein_series(k,
pow(q,K),a,b,
iquo(N_order,K));
202 res += Order(
pow(q,N_order_int));
203 res = res.series(q,N_order_int);
216 int N_order_int = N_order.to_int();
218 ex res = eisenstein_series(2,q,1,1,N_order) - K*eisenstein_series(2,
pow(q,K),1,1,
iquo(N_order,K));
220 res += Order(
pow(q,N_order_int));
221 res = res.series(q,N_order_int);
233 subs_q_expansion(
const ex & arg_qbar,
int arg_order) : qbar(arg_qbar), order(arg_order)
236 ex operator()(
const ex & e)
269 ex get_symbolic_value(
int n,
const ex & x_val);
270 ex get_numerical_value(
int n,
const ex & x_val);
274 static std::vector<ex> cache_vec;
279Li_negative::Li_negative() {}
281ex Li_negative::get_symbolic_value(
int n,
const ex & x_val)
283 int n_cache = cache_vec.size();
285 if ( n >= n_cache ) {
286 for (
int j=n_cache; j<=n; j++) {
294 cache_vec.push_back( f );
298 return cache_vec[n].subs(x==x_val);
301ex Li_negative::get_numerical_value(
int n,
const ex & x_val)
303 symbol x_symb(
"x_symb");
305 ex f = this->get_symbolic_value(n,x_symb);
307 ex res = f.subs(x_symb==x_val).evalf();
313std::vector<ex> Li_negative::cache_vec;
314symbol Li_negative::x = symbol(
"x");
330 if ( !n.
is_pos_integer() )
throw (std::runtime_error(
"ifactor(): argument not a positive integer"));
339 while (
irem(n_temp, p) == 0 ) {
348 if ( n_temp == 1 )
break;
351 if ( n_temp != 1 )
throw (std::runtime_error(
"ifactor(): probabilistic primality test failed"));
353 lst res = {p_lst,exp_lst};
381 size_t n_primes = p_lst.
nops();
383 if ( n_primes > 0 ) {
388 if ( e_lst.
op(n_primes-1) != 1 ) {
393 if (
mod(p,4) == 3 ) {
400 if ( (n==-4) || (n==-8) || (n==8) || (n==-32) || (n==32) || (n==-64) || (n==128) ) {
428 if ( (a == 1) || (a == -1) ) {
443 ex res = kronecker_symbol_prime(a,unit);
452 res *=
pow(kronecker_symbol_prime(a,2),alpha);
459 for (
auto it_p = prime_lst.
begin(), it_e = expo_lst.
begin(); it_p != prime_lst.
end(); it_p++, it_e++) {
496 if (
gcd(n,N) == 1 ) {
525 for (
numeric i1=1; i1<=conductor; i1++) {
561integration_kernel::integration_kernel() : inherited(), cache_step_size(100), series_vec()
565int integration_kernel::compare_same_type(
const basic &other)
const
572 if ( r.
rhs() != 0 ) {
573 throw (std::runtime_error(
"integration_kernel::series: non-zero expansion point not implemented"));
627 for (
int j=n_vec; j<N; j++) {
632 for (
int j=n_vec; j<N; j++) {
666 for (
int n=-1; n<order; n++) {
669 res += Order(
pow(x,order));
670 res = res.
series(x,order);
739 cln::cl_F one = cln::cl_float(1, cln::float_format(
Digits));
745 if ( N_trunc == 0 ) {
747 bool flag_accidental_zero =
false;
756 res += pre_cln * subexpr * cln::expt(lambda_cln,N-1+shift);
758 flag_accidental_zero = cln::zerop(subexpr);
761 }
while ( (res != resbuf) || flag_accidental_zero );
765 for (
int N=0; N<N_trunc; N++) {
768 res += pre_cln * subexpr * cln::expt(lambda_cln,N-1+shift);
777 c.
s <<
"integration_kernel()";
786basic_log_kernel::basic_log_kernel() : inherited()
790int basic_log_kernel::compare_same_type(
const basic &other)
const
806 c.
s <<
"basic_log_kernel()";
838 throw(std::range_error(
"multiple_polylog_kernel::op(): out of range"));
849 throw(std::range_error(
"multiple_polylog_kernel::let_op(): out of range"));
871 c.
s <<
"multiple_polylog_kernel(";
905 cmpval =
x.compare(o.
x);
910 return y.compare(o.
y);
930 throw (std::out_of_range(
"ELi_kernel::op() out of range"));
948 throw (std::out_of_range(
"ELi_kernel::let_op() out of range"));
969 cln::cl_N res_cln = 0;
971 for (
int j=1; j<=i; j++) {
972 if ( (i % j) == 0 ) {
975 res_cln += cln::expt(x_cln,j)/cln::expt(cln::cl_I(j),n_int) * cln::expt(y_cln,k)/cln::expt(cln::cl_I(k),m_int);
994 c.
s <<
"ELi_kernel(";
1034 cmpval =
x.compare(o.
x);
1039 return y.compare(o.
y);
1059 throw (std::out_of_range(
"Ebar_kernel::op() out of range"));
1077 throw (std::out_of_range(
"Ebar_kernel::let_op() out of range"));
1098 cln::cl_N res_cln = 0;
1100 for (
int j=1; j<=i; j++) {
1101 if ( (i % j) == 0 ) {
1104 res_cln += (cln::expt(x_cln,j)*cln::expt(y_cln,k)-cln::expt(cln::cl_I(-1),n_int+m_int)*cln::expt(x_cln,-j)*cln::expt(y_cln,-k))/cln::expt(cln::cl_I(j),n_int)/cln::expt(cln::cl_I(k),m_int);
1123 c.
s <<
"Ebar_kernel(";
1163 cmpval =
K.compare(o.
K);
1188 throw (std::out_of_range(
"Kronecker_dtau_kernel::op() out of range"));
1206 throw (std::out_of_range(
"Kronecker_dtau_kernel::let_op() out of range"));
1218 int n_int = n_num.
to_int();
1248 if ( (i % K_int) != 0 ) {
1251 int i_local = i/K_int;
1255 cln::cl_N res_cln = 0;
1256 for (
int j=1; j<=i_local; j++) {
1257 if ( (i_local % j) == 0 ) {
1258 res_cln += (cln::expt(w_cln,j)+cln::expt(cln::cl_I(-1),n_int)*cln::expt(w_cln,-j)) * cln::expt(cln::cl_I(i_local/j),n_int-1);
1294 c.
s <<
"Kronecker_dtau_kernel(";
1334 cmpval =
tau.compare(o.
tau);
1339 cmpval =
K.compare(o.
K);
1366 throw (std::out_of_range(
"Kronecker_dz_kernel::op() out of range"));
1386 throw (std::out_of_range(
"Kronecker_dz_kernel::let_op() out of range"));
1424 else if ( i == 1 ) {
1445 Li_negative my_Li_negative;
1509 c.
s <<
"Kronecker_dz_kernel(";
1532Eisenstein_kernel::Eisenstein_kernel(
const ex & arg_k,
const ex & arg_N,
const ex & arg_a,
const ex & arg_b,
const ex & arg_K,
const ex & arg_C_norm) : inherited(),
k(arg_k),
N(arg_N),
a(arg_a),
b(arg_b),
K(arg_K),
C_norm(arg_C_norm)
1551 cmpval =
a.compare(o.
a);
1556 cmpval =
b.compare(o.
b);
1561 cmpval =
K.compare(o.
K);
1579 if ( r.
rhs() != 0 ) {
1580 throw (std::runtime_error(
"integration_kernel::series: non-zero expansion point not implemented"));
1585 res = res.
series(qbar,order);
1611 throw (std::out_of_range(
"Eisenstein_kernel::op() out of range"));
1633 throw (std::out_of_range(
"Eisenstein_kernel::let_op() out of range"));
1645 res = res.
series(x,order);
1675 if ( (
k==2) && (
a==1) && (
b==1) ) {
1676 return B_eisenstein_series(q, N_num, K_num, order);
1679 return E_eisenstein_series(q, k_num, N_num, a_num, b_num, K_num, order);
1684 c.
s <<
"Eisenstein_kernel(";
1728 cmpval =
r.compare(o.
r);
1733 cmpval =
s.compare(o.
s);
1751 if (
r.rhs() != 0 ) {
1752 throw (std::runtime_error(
"integration_kernel::series: non-zero expansion point not implemented"));
1757 res = res.
series(qbar,order);
1781 throw (std::out_of_range(
"Eisenstein_h_kernel::op() out of range"));
1801 throw (std::out_of_range(
"Eisenstein_h_kernel::let_op() out of range"));
1813 res = res.
series(x,order);
1867 for (
numeric m=1; m<=n; m++) {
1868 if (
irem(n,m) == 0 ) {
1890 for (
numeric i1=1; i1<N_order_num; i1++) {
1894 res += Order(
pow(q,N_order));
1895 res = res.
series(q,N_order);
1902 c.
s <<
"Eisenstein_h_kernel(";
1955 if ( r.
rhs() != 0 ) {
1956 throw (std::runtime_error(
"integration_kernel::series: non-zero expansion point not implemented"));
1961 subs_q_expansion do_subs_q_expansion(qbar, order);
1963 ex res = do_subs_q_expansion(
P).series(qbar,order);
1964 res += Order(
pow(qbar,order));
1965 res = res.
series(qbar,order);
1985 throw (std::out_of_range(
"modular_form_kernel::op() out of range"));
2001 throw (std::out_of_range(
"modular_form_kernel::let_op() out of range"));
2022 res = res.
series(qbar,order);
2045 return this->
series(q==0,N_order);
2050 c.
s <<
"modular_form_kernel(";
2099 throw (std::out_of_range(
"user_defined_kernel::op() out of range"));
2113 throw (std::out_of_range(
"user_defined_kernel::let_op() out of range"));
2125 ex res =
f.series(
x,order).subs(
x==x_up);
2137 c.
s <<
"user_defined_kernel(";
Interface to GiNaC's sums of expressions.
#define GINAC_BIND_UNARCHIVER(classname)
ex & let_op(size_t i) override
Return modifiable operand/member at position i.
void do_print(const print_context &c, unsigned level) const
bool is_numeric(void) const override
This routine returns true, if the integration kernel can be evaluated numerically.
ELi_kernel(const ex &n, const ex &m, const ex &x, const ex &y)
size_t nops() const override
Number of operands/members.
ex op(size_t i) const override
Return operand/member at position i.
cln::cl_N series_coeff_impl(int i) const override
For only the coefficient of is non-zero.
ex get_numerical_value(const ex &qbar, int N_trunc=0) const override
Returns the value of ELi_{n,m}(x,y,qbar).
size_t nops() const override
Number of operands/members.
void do_print(const print_context &c, unsigned level) const
bool is_numeric(void) const override
This routine returns true, if the integration kernel can be evaluated numerically.
ex op(size_t i) const override
Return operand/member at position i.
Ebar_kernel(const ex &n, const ex &m, const ex &x, const ex &y)
ex & let_op(size_t i) override
Return modifiable operand/member at position i.
cln::cl_N series_coeff_impl(int i) const override
For only the coefficient of is non-zero.
ex get_numerical_value(const ex &qbar, int N_trunc=0) const override
Returns the value of Ebar_{n,m}(x,y,qbar).
The kernel corresponding to the Eisenstein series .
ex get_numerical_value(const ex &qbar, int N_trunc=0) const override
Returns the value of the modular form.
bool is_numeric(void) const override
This routine returns true, if the integration kernel can be evaluated numerically.
Eisenstein_h_kernel(const ex &k, const ex &N, const ex &r, const ex &s, const ex &C_norm=numeric(1))
size_t nops() const override
Number of operands/members.
ex op(size_t i) const override
Return operand/member at position i.
void do_print(const print_context &c, unsigned level) const
ex q_expansion_modular_form(const ex &q, int order) const
ex coefficient_an(const numeric &n, const numeric &k, const numeric &r, const numeric &s, const numeric &N) const
The higher coefficients in the Fourier expansion.
ex coefficient_a0(const numeric &k, const numeric &r, const numeric &s, const numeric &N) const
The constant coefficient in the Fourier expansion.
ex Laurent_series(const ex &x, int order) const override
Returns the Laurent series, starting possibly with the pole term.
ex & let_op(size_t i) override
Return modifiable operand/member at position i.
bool uses_Laurent_series() const override
Returns true, if the coefficients are computed from the Laurent series (in which case the method Laur...
ex series(const relational &r, int order, unsigned options=0) const override
The series method for this class returns the qbar-expansion of the modular form, without an additiona...
The kernel corresponding to the Eisenstein series .
ex get_numerical_value(const ex &qbar, int N_trunc=0) const override
Returns the value of the modular form.
ex Laurent_series(const ex &x, int order) const override
Returns the Laurent series, starting possibly with the pole term.
void do_print(const print_context &c, unsigned level) const
ex op(size_t i) const override
Return operand/member at position i.
ex q_expansion_modular_form(const ex &q, int order) const
ex & let_op(size_t i) override
Return modifiable operand/member at position i.
Eisenstein_kernel(const ex &k, const ex &N, const ex &a, const ex &b, const ex &K, const ex &C_norm=numeric(1))
size_t nops() const override
Number of operands/members.
bool uses_Laurent_series() const override
Returns true, if the coefficients are computed from the Laurent series (in which case the method Laur...
ex series(const relational &r, int order, unsigned options=0) const override
The series method for this class returns the qbar-expansion of the modular form, without an additiona...
bool is_numeric(void) const override
This routine returns true, if the integration kernel can be evaluated numerically.
The kernel corresponding to integrating the Kronecker coefficient function in (or equivalently in )...
size_t nops() const override
Number of operands/members.
Kronecker_dtau_kernel(const ex &n, const ex &z, const ex &K=numeric(1), const ex &C_norm=numeric(1))
ex op(size_t i) const override
Return operand/member at position i.
ex get_numerical_value(const ex &qbar, int N_trunc=0) const override
Returns the value of the g^(n)(z,K*tau), where tau is given by qbar.
void do_print(const print_context &c, unsigned level) const
cln::cl_N series_coeff_impl(int i) const override
For only the coefficient of is non-zero.
bool is_numeric(void) const override
This routine returns true, if the integration kernel can be evaluated numerically.
ex & let_op(size_t i) override
Return modifiable operand/member at position i.
The kernel corresponding to integrating the Kronecker coefficient function in .
Kronecker_dz_kernel(const ex &n, const ex &z_j, const ex &tau, const ex &K=numeric(1), const ex &C_norm=numeric(1))
bool is_numeric(void) const override
This routine returns true, if the integration kernel can be evaluated numerically.
size_t nops() const override
Number of operands/members.
void do_print(const print_context &c, unsigned level) const
cln::cl_N series_coeff_impl(int i) const override
For only the coefficient of is non-zero.
ex op(size_t i) const override
Return operand/member at position i.
ex get_numerical_value(const ex &z, int N_trunc=0) const override
Returns the value of the g^(n-1)(z-z_j,K*tau).
ex & let_op(size_t i) override
Return modifiable operand/member at position i.
The basic integration kernel with a logarithmic singularity at the origin.
void do_print(const print_context &c, unsigned level) const
cln::cl_N series_coeff_impl(int i) const override
For only the coefficient of is non-zero.
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
void ensure_if_modifiable() const
Ensure the object may be modified without hurting others, throws if this is not the case.
virtual int compare_same_type(const basic &other) const
Returns order relation between two objects of same type.
virtual ex evalf() const
Evaluate object numerically.
const_iterator end() const
const_iterator begin() const
size_t nops() const override
Number of operands/members.
ex op(size_t i) const override
Return operand/member at position i.
container & append(const ex &b)
Add element at back.
Lightweight wrapper for GiNaC's symbolic objects.
ex series(const ex &r, int order, unsigned options=0) const
Compute the truncated series expansion of an expression.
ex subs(const exmap &m, unsigned options=0) const
bool info(unsigned inf) const
int compare(const ex &other) const
ex coeff(const ex &s, int n=1) const
The base class for integration kernels for iterated integrals.
ex get_series_coeff(int i) const
Wrapper around series_coeff(i), converts cl_N to numeric.
size_t get_cache_size(void) const
Returns the current size of the cache.
virtual bool is_numeric(void) const
This routine returns true, if the integration kernel can be evaluated numerically.
virtual ex get_numerical_value(const ex &lambda, int N_trunc=0) const
Evaluates the integrand at lambda.
cln::cl_N series_coeff(int i) const
Subclasses have either to implement series_coeff_impl or the two methods Laurent_series and uses_Laur...
void do_print(const print_context &c, unsigned level) const
std::vector< cln::cl_N > series_vec
ex series(const relational &r, int order, unsigned options=0) const override
Default implementation of ex::series().
ex get_numerical_value_impl(const ex &lambda, const ex &pre, int shift, int N_trunc) const
The actual implementation for computing a numerical value for the integrand.
virtual cln::cl_N series_coeff_impl(int i) const
For only the coefficient of is non-zero.
void set_cache_step(int cache_steps) const
Sets the step size by which the cache is increased.
virtual bool has_trailing_zero(void) const
This routine returns true, if the integration kernel has a trailing zero.
virtual ex Laurent_series(const ex &x, int order) const
Returns the Laurent series, starting possibly with the pole term.
virtual bool uses_Laurent_series() const
Returns true, if the coefficients are computed from the Laurent series (in which case the method Laur...
The integration kernel for multiple polylogarithms.
cln::cl_N series_coeff_impl(int i) const override
For only the coefficient of is non-zero.
ex & let_op(size_t i) override
Return modifiable operand/member at position i.
size_t nops() const override
Number of operands/members.
void do_print(const print_context &c, unsigned level) const
multiple_polylog_kernel(const ex &z)
ex op(size_t i) const override
Return operand/member at position i.
bool is_numeric(void) const override
This routine returns true, if the integration kernel can be evaluated numerically.
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
bool is_pos_integer() const
True if object is an exact integer greater than zero.
bool is_odd() const
True if object is an exact odd integer.
cln::cl_N to_cl_N() const
Returns a new CLN object of type cl_N, representing the value of *this.
bool is_even() const
True if object is an exact even integer.
int to_int() const
Converts numeric types to machine's int.
Base class for print_contexts.
std::ostream & s
stream to output to
This class holds a relation consisting of two expressions and a logical relation between them.
A user-defined integration kernel.
user_defined_kernel(const ex &f, const ex &x)
ex Laurent_series(const ex &x, int order) const override
Returns the Laurent series, starting possibly with the pole term.
bool is_numeric(void) const override
This routine returns true, if the integration kernel can be evaluated numerically.
ex op(size_t i) const override
Return operand/member at position i.
bool uses_Laurent_series() const override
Returns true, if the coefficients are computed from the Laurent series (in which case the method Laur...
void do_print(const print_context &c, unsigned level) const
ex & let_op(size_t i) override
Return modifiable operand/member at position i.
size_t nops() const override
Number of operands/members.
Interface to GiNaC's constant types and some special constants.
Interface to class of symbolic functions.
Interface to GiNaC's initially known functions.
Interface to GiNaC's integration kernels for iterated integrals.
Interface to GiNaC's products of expressions.
const numeric I
Imaginary unit.
const numeric pow(const numeric &x, const numeric &y)
bool is_discriminant_of_quadratic_number_field(const numeric &n)
Returns true if the integer n is either one or the discriminant of a quadratic number field.
container< std::list > lst
const numeric bernoulli(const numeric &nn)
Bernoulli number.
const numeric mod(const numeric &a, const numeric &b)
Modulus (in positive representation).
const numeric abs(const numeric &x)
Absolute value.
ex gcd(const ex &a, const ex &b, ex *ca, ex *cb, bool check_args, unsigned options)
Compute GCD (Greatest Common Divisor) of multivariate polynomials a(X) and b(X) in Z[X].
ex series_to_poly(const ex &e)
Convert the pseries object embedded in an expression to an ordinary polynomial in the expansion varia...
attribute_pure const T & ex_to(const ex &e)
Return a reference to the basic-derived class T object embedded in an expression.
GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T(lst, basic, print_func< print_context >(&lst::do_print). print_func< print_tree >(&lst::do_print_tree)) template<> bool ls GINAC_BIND_UNARCHIVER)(lst)
Specialization of container::info() for lst.
const numeric irem(const numeric &a, const numeric &b)
Numeric integer remainder.
numeric dirichlet_character(const numeric &n, const numeric &a, const numeric &N)
Defines a Dirichlet character through the Kronecker symbol.
ex diff(const ex &thisex, const symbol &s, unsigned nth=1)
const numeric exp(const numeric &x)
Exponential function.
numeric kronecker_symbol(const numeric &a, const numeric &n)
Returns the Kronecker symbol a: integer n: integer.
ex Bernoulli_polynomial(const numeric &k, const ex &x)
The Bernoulli polynomials.
const numeric factorial(const numeric &n)
Factorial combinatorial function.
const numeric cos(const numeric &x)
Numeric cosine (trigonometric function).
bool is_even(const numeric &x)
const numeric smod(const numeric &a_, const numeric &b_)
Modulus (in symmetric representation).
const constant Pi("Pi", PiEvalf, "\\pi", domain::positive)
Pi.
print_func< print_context >(&varidx::do_print). print_func< print_latex >(&varidx
const numeric iquo(const numeric &a, const numeric &b)
Numeric integer quotient.
bool is_a(const basic &obj)
Check if obj is a T, including base classes.
_numeric_digits Digits
Accuracy in decimal digits.
const numeric sin(const numeric &x)
Numeric sine (trigonometric function).
ex normal(const ex &thisex)
numeric primitive_dirichlet_character(const numeric &n, const numeric &a)
Defines a primitive Dirichlet character through the Kronecker symbol.
ex ifactor(const numeric &n)
Returns the decomposition of the positive integer n into prime numbers in the form lst( lst(p1,...
numeric generalised_Bernoulli_number(const numeric &k, const numeric &b)
The generalised Bernoulli number.
Makes the interface to the underlying bignum package available.
Interface to GiNaC's overloaded operators.
Interface to GiNaC's symbolic exponentiation (basis^exponent).
Interface to class for extended truncated power series.
#define GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(classname, supername, options)
Macro for inclusion in the implementation of each registered class.
Interface to relations between expressions.
Function object for map().
Interface to GiNaC's symbolic objects.
Interface to several small and furry utilities needed within GiNaC but not of any interest to the use...