*/
/*
- * GiNaC Copyright (C) 1999-2009 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
} else {
// choose the faster algorithm
if (cln::abs(cln::realpart(x)) > 0.75) {
- return -Li2_do_sum(1-x) - cln::log(x) * cln::log(1-x) + cln::zeta(2);
+ if ( x == 1 ) {
+ return cln::zeta(2);
+ } else {
+ return -Li2_do_sum(1-x) - cln::log(x) * cln::log(1-x) + cln::zeta(2);
+ }
} else {
return -Li2_do_sum_Xn(1-x) - cln::log(x) * cln::log(1-x) + cln::zeta(2);
}
return Lin_do_sum_Xn(n, x);
}
} else {
- cln::cl_N result = -cln::expt(cln::log(x), n-1) * cln::log(1-x) / cln::factorial(n-1);
+ cln::cl_N result = 0;
+ if ( x != 1 ) result = -cln::expt(cln::log(x), n-1) * cln::log(1-x) / cln::factorial(n-1);
for (int j=0; j<n-1; j++) {
result = result + (S_num(n-j-1, 1, 1) - S_num(1, n-j-1, 1-x))
* cln::expt(cln::log(x), j) / cln::factorial(j);
s.push_back(1);
}
const cln::cl_N xi = ex_to<numeric>(*itx).to_cl_N();
- newx.push_back(factor/xi);
factor = factor/xi;
- s.push_back(1);
+ newx.push_back(factor);
+ if ( !instanceof(factor, cln::cl_R_ring) && imagpart(factor) < 0 ) {
+ s.push_back(-1);
+ }
+ else {
+ s.push_back(1);
+ }
}
return numeric(cln::cl_N(1 & m.nops() ? - 1 : 1)*G_numeric(newx, s, cln::cl_N(1)));
}
} else {
x = lst(x_);
}
- c.s << "\\mbox{Li}_{";
+ c.s << "\\mathrm{Li}_{";
lst::const_iterator itm = m.begin();
(*itm).print(c);
itm++;
static void S_print_latex(const ex& n, const ex& p, const ex& x, const print_context& c)
{
- c.s << "\\mbox{S}_{";
+ c.s << "\\mathrm{S}_{";
n.print(c);
c.s << ",";
p.print(c);
ex addzeta = convert_H_to_zeta(newparameter);
return e.subs(h == (addzeta-H(newparameter, h.op(1)).hold())).expand();
} else {
- return e * (-H(lst(0),1/arg).hold());
+ return e * (-H(lst(ex(0)),1/arg).hold());
}
}
newparameter.prepend(1);
return e.subs(h == H(newparameter, h.op(1)).hold());
} else {
- return e * H(lst(1),1-arg).hold();
+ return e * H(lst(ex(1)),1-arg).hold();
}
}
ex addzeta = convert_H_to_zeta(newparameter);
return e.subs(h == (addzeta-H(newparameter, h.op(1)).hold())).expand();
} else {
- ex addzeta = convert_H_to_zeta(lst(-1));
- return (e * (addzeta - H(lst(-1),1/arg).hold())).expand();
+ ex addzeta = convert_H_to_zeta(lst(ex(-1)));
+ return (e * (addzeta - H(lst(ex(-1)),1/arg).hold())).expand();
}
}
newparameter.prepend(-1);
return e.subs(h == H(newparameter, h.op(1)).hold()).expand();
} else {
- return (e * H(lst(-1),(1-arg)/(1+arg)).hold()).expand();
+ return (e * H(lst(ex(-1)),(1-arg)/(1+arg)).hold()).expand();
}
}
newparameter.prepend(1);
return e.subs(h == H(newparameter, h.op(1)).hold()).expand();
} else {
- return (e * H(lst(1),(1-arg)/(1+arg)).hold()).expand();
+ return (e * H(lst(ex(1)),(1-arg)/(1+arg)).hold()).expand();
}
}
// leading one
map_trafo_H_1mx recursion;
map_trafo_H_mult unify;
- ex res = H(lst(1), arg).hold() * H(newparameter, arg).hold();
+ ex res = H(lst(ex(1)), arg).hold() * H(newparameter, arg).hold();
std::size_t firstzero = 0;
while (parameter.op(firstzero) == 1) {
firstzero++;
}
if (allthesame) {
map_trafo_H_mult unify;
- return unify((pow(H(lst(-1),1/arg).hold() - H(lst(0),1/arg).hold(), parameter.nops())
+ return unify((pow(H(lst(ex(-1)),1/arg).hold() - H(lst(ex(0)),1/arg).hold(), parameter.nops())
/ factorial(parameter.nops())).expand());
}
} else {
}
if (allthesame) {
map_trafo_H_mult unify;
- return unify((pow(H(lst(1),1/arg).hold() + H(lst(0),1/arg).hold() + H_polesign, parameter.nops())
+ return unify((pow(H(lst(ex(1)),1/arg).hold() + H(lst(ex(0)),1/arg).hold() + H_polesign, parameter.nops())
/ factorial(parameter.nops())).expand());
}
}
// leading one
map_trafo_H_1overx recursion;
map_trafo_H_mult unify;
- ex res = H(lst(1), arg).hold() * H(newparameter, arg).hold();
+ ex res = H(lst(ex(1)), arg).hold() * H(newparameter, arg).hold();
std::size_t firstzero = 0;
while (parameter.op(firstzero) == 1) {
firstzero++;
}
if (allthesame) {
map_trafo_H_mult unify;
- return unify((pow(-H(lst(1),(1-arg)/(1+arg)).hold() - H(lst(-1),(1-arg)/(1+arg)).hold(), parameter.nops())
+ return unify((pow(-H(lst(ex(1)),(1-arg)/(1+arg)).hold() - H(lst(ex(-1)),(1-arg)/(1+arg)).hold(), parameter.nops())
/ factorial(parameter.nops())).expand());
}
} else if (parameter.op(0) == -1) {
}
if (allthesame) {
map_trafo_H_mult unify;
- return unify((pow(log(2) - H(lst(-1),(1-arg)/(1+arg)).hold(), parameter.nops())
+ return unify((pow(log(2) - H(lst(ex(-1)),(1-arg)/(1+arg)).hold(), parameter.nops())
/ factorial(parameter.nops())).expand());
}
} else {
}
if (allthesame) {
map_trafo_H_mult unify;
- return unify((pow(-log(2) - H(lst(0),(1-arg)/(1+arg)).hold() + H(lst(-1),(1-arg)/(1+arg)).hold(), parameter.nops())
+ return unify((pow(-log(2) - H(lst(ex(0)),(1-arg)/(1+arg)).hold() + H(lst(ex(-1)),(1-arg)/(1+arg)).hold(), parameter.nops())
/ factorial(parameter.nops())).expand());
}
}
// leading one
map_trafo_H_1mxt1px recursion;
map_trafo_H_mult unify;
- ex res = H(lst(1), arg).hold() * H(newparameter, arg).hold();
+ ex res = H(lst(ex(1)), arg).hold() * H(newparameter, arg).hold();
std::size_t firstzero = 0;
while (parameter.op(firstzero) == 1) {
firstzero++;
} else {
m = lst(m_);
}
- c.s << "\\mbox{H}_{";
+ c.s << "\\mathrm{H}_{";
lst::const_iterator itm = m.begin();
(*itm).print(c);
itm++;