106std::vector<std::vector<cln::cl_N>> Xn;
108const int xninitsizestep = 26;
109int xninitsize = xninitsizestep;
127 std::vector<cln::cl_N> buf(xninitsize);
128 auto it = buf.begin();
130 *it = -(cln::expt(cln::cl_I(2),
n+1) - 1) / cln::expt(cln::cl_I(2),
n+1);
132 for (
int i=2; i<=xninitsize; i++) {
136 result = Xn[0][i/2-1];
138 for (
int k=1;
k<i-1;
k++) {
139 if ( !(((i-
k) & 1) && ((i-
k) > 1)) ) {
144 result = result + Xn[
n-1][i-1] / (i+1);
152 std::vector<cln::cl_N> buf(xninitsize);
153 auto it = buf.begin();
155 *it = cln::cl_I(-3)/cln::cl_I(4);
157 *it = cln::cl_I(17)/cln::cl_I(36);
159 for (
int i=3; i<=xninitsize; i++) {
161 result = -Xn[0][(i-3)/2]/2;
165 result = Xn[0][i/2-1] + Xn[0][i/2-1]/(i+1);
166 for (
int k=1;
k<i/2;
k++) {
176 std::vector<cln::cl_N> buf(xninitsize/2);
177 auto it = buf.begin();
178 for (
int i=1; i<=xninitsize/2; i++) {
191 const int pos0 = xninitsize / 2;
193 for (
int i=1; i<=xninitsizestep/2; ++i) {
194 Xn[0].push_back(
bernoulli((i+pos0)*2).to_cl_N());
197 int xend = xninitsize + xninitsizestep;
200 for (
int i=xninitsize+1; i<=xend; ++i) {
202 result = -Xn[0][(i-3)/2]/2;
205 result = Xn[0][i/2-1] + Xn[0][i/2-1]/(i+1);
206 for (
int k=1;
k<i/2;
k++) {
209 Xn[1].push_back(result);
213 for (
size_t n=2;
n<Xn.size(); ++
n) {
214 for (
int i=xninitsize+1; i<=xend; ++i) {
218 result = Xn[0][i/2-1];
220 for (
int k=1;
k<i-1; ++
k) {
221 if ( !(((i-
k) & 1) && ((i-
k) > 1)) ) {
226 result = result + Xn[
n-1][i-1] / (i+1);
227 Xn[
n].push_back(result);
231 xninitsize += xninitsizestep;
236cln::cl_N Li2_do_sum(
const cln::cl_N&
x)
240 cln::cl_N num =
x * cln::cl_float(1, cln::float_format(
Digits));
248 res = res + num / den;
249 }
while (res != resbuf);
255cln::cl_N Li2_do_sum_Xn(
const cln::cl_N&
x)
257 std::vector<cln::cl_N>::const_iterator it = Xn[0].
begin();
258 std::vector<cln::cl_N>::const_iterator xend = Xn[0].end();
260 cln::cl_N
factor = u * cln::cl_float(1, cln::float_format(
Digits));
261 cln::cl_N uu = cln::square(u);
262 cln::cl_N res = u - uu/4;
268 res = res + (*it) *
factor;
272 it = Xn[0].begin() + (i-1);
275 }
while (res != resbuf);
281cln::cl_N Lin_do_sum(
int n,
const cln::cl_N&
x)
283 cln::cl_N
factor =
x * cln::cl_float(1, cln::float_format(
Digits));
290 res = res +
factor / cln::expt(cln::cl_I(i),
n);
292 }
while (res != resbuf);
298cln::cl_N Lin_do_sum_Xn(
int n,
const cln::cl_N&
x)
300 std::vector<cln::cl_N>::const_iterator it = Xn[
n-2].begin();
301 std::vector<cln::cl_N>::const_iterator xend = Xn[
n-2].end();
303 cln::cl_N
factor = u * cln::cl_float(1, cln::float_format(
Digits));
310 res = res + (*it) *
factor;
314 it = Xn[
n-2].begin() + (i-2);
315 xend = Xn[
n-2].end();
317 }
while (res != resbuf);
323const cln::cl_N S_num(
int n,
int p,
const cln::cl_N&
x);
327cln::cl_N Li_projection(
int n,
const cln::cl_N&
x,
const cln::float_format_t& prec)
336 if (cln::realpart(
x) < 0.5) {
342 return Li2_do_sum(
x);
345 return Li2_do_sum_Xn(
x);
362 for (
int i=xnsize; i<
n-1; i++) {
367 if (cln::realpart(
x) < 0.5) {
371 return Lin_do_sum(
n,
x);
374 return Lin_do_sum_Xn(
n,
x);
377 cln::cl_N result = 0;
379 for (
int j=0; j<
n-1; j++) {
380 result = result + (S_num(
n-j-1, 1, 1) - S_num(1,
n-j-1, 1-
x))
389const cln::cl_N Lin_numeric(
const int n,
const cln::cl_N&
x)
404 return -(1-cln::expt(cln::cl_I(2),1-
n)) *
cln::zeta(
n);
408 for (
int j=0; j<
n-1; j++) {
409 result = result + (S_num(
n-j-1, 1, 1) - S_num(1,
n-j-1, 1-
x))
417 cln::float_format_t prec = cln::default_float_format;
418 const cln::cl_N
value =
x;
420 if (!instanceof(realpart(
x), cln::cl_RA_ring))
421 prec = cln::float_format(cln::the<cln::cl_F>(cln::realpart(
value)));
422 else if (!instanceof(imagpart(
x), cln::cl_RA_ring))
423 prec = cln::float_format(cln::the<cln::cl_F>(cln::imagpart(
value)));
429 if (cln::zerop(cln::imagpart(
value))) {
431 result = result +
conjugate(Li_projection(
n, cln::recip(
value), prec));
434 result = result -
conjugate(Li_projection(
n, cln::recip(
value), prec));
439 result = result + Li_projection(
n, cln::recip(
value), prec);
442 result = result - Li_projection(
n, cln::recip(
value), prec);
446 for (
int j=0; j<
n-1; j++) {
447 add = add + (1+cln::expt(cln::cl_I(-1),
n-j)) * (1-cln::expt(cln::cl_I(2),1-
n+j))
450 result = result - add;
454 return Li_projection(
n,
value, prec);
476cln::cl_N multipleLi_do_sum(
const std::vector<int>& s,
const std::vector<cln::cl_N>&
x)
479 for (
const auto & it :
x) {
480 if (it == 0)
return cln::cl_float(0, cln::float_format(
Digits));
483 const int j = s.size();
484 bool flag_accidental_zero =
false;
486 std::vector<cln::cl_N> t(j);
487 cln::cl_F
one = cln::cl_float(1, cln::float_format(
Digits));
494 t[j-1] = t[j-1] + cln::expt(
x[j-1], q) / cln::expt(cln::cl_I(q),s[j-1]) *
one;
495 for (
int k=j-2;
k>=0;
k--) {
496 t[
k] = t[
k] + t[
k+1] * cln::expt(
x[
k], q+j-1-
k) / cln::expt(cln::cl_I(q+j-1-
k), s[
k]);
499 t[j-1] = t[j-1] + cln::expt(
x[j-1], q) / cln::expt(cln::cl_I(q),s[j-1]) *
one;
500 for (
int k=j-2;
k>=0;
k--) {
501 flag_accidental_zero = cln::zerop(t[
k+1]);
502 t[
k] = t[
k] + t[
k+1] * cln::expt(
x[
k], q+j-1-
k) / cln::expt(cln::cl_I(q+j-1-
k), s[
k]);
504 }
while ( (t[0] != t0buf) || cln::zerop(t[0]) || flag_accidental_zero );
511lst convert_parameter_Li_to_H(
const lst&
m,
const lst&
x, ex& pf);
515typedef std::vector<int> Gparameter;
519ex G_eval1(
int a,
int scale,
const exvector& gsyms)
522 const ex& scs = gsyms[
std::abs(scale)];
525 return -
log(1 - scs/as);
536ex G_eval(
const Gparameter& a,
int scale,
const exvector& gsyms)
541 bool all_zero =
true;
542 bool all_ones =
true;
544 for (
const auto & it : a) {
562 if (newa.nops() > 1 && newa.op(0) == sc && !all_ones && a.front()!=0) {
564 Gparameter short_a(a.begin()+1, a.end());
565 ex result = G_eval1(a.front(), scale, gsyms) * G_eval(short_a, scale, gsyms);
567 auto it = short_a.begin();
568 advance(it, count_ones-1);
569 for (; it != short_a.end(); ++it) {
571 Gparameter newa(short_a.begin(), it);
573 newa.push_back(a[0]);
574 newa.insert(newa.end(), it+1, short_a.end());
575 result -= G_eval(newa, scale, gsyms);
577 return result / count_ones;
581 if (all_ones && a.size() > 1) {
582 return pow(G_eval1(a.front(),scale, gsyms), count_ones) /
factorial(count_ones);
595 for (
const auto & it : a) {
597 const ex& sym = gsyms[
std::abs(it)];
598 x.append(argbuf / sym);
610ex G_eval_to_G(
const Gparameter& a,
int scale,
const exvector& gsyms)
614 for (
const auto & it : a) {
632Gparameter convert_pending_integrals_G(
const Gparameter& pending_integrals)
636 if (pending_integrals.size() > 0) {
638 Gparameter new_a(pending_integrals.begin()+1, pending_integrals.end());
653Gparameter::const_iterator check_parameter_G(
const Gparameter& a,
int scale,
654 bool& convergent,
int& depth,
int& trailing_zeros, Gparameter::const_iterator& min_it)
660 auto lastnonzero = a.end();
661 for (
auto it = a.begin(); it != a.end(); ++it) {
676 if (lastnonzero == a.end())
678 return ++lastnonzero;
683Gparameter prepare_pending_integrals(
const Gparameter& pending_integrals,
int scale)
687 if (pending_integrals.size() > 0) {
688 return pending_integrals;
690 Gparameter new_pending_integrals;
691 new_pending_integrals.push_back(scale);
692 return new_pending_integrals;
698ex trailing_zeros_G(
const Gparameter& a,
int scale,
const exvector& gsyms)
701 int depth, trailing_zeros;
702 Gparameter::const_iterator
last, dummyit;
703 last = check_parameter_G(a, scale, convergent, depth, trailing_zeros, dummyit);
707 if ((trailing_zeros > 0) && (depth > 0)) {
709 Gparameter new_a(a.begin(), a.end()-1);
710 result += G_eval1(0, scale, gsyms) * trailing_zeros_G(new_a, scale, gsyms);
711 for (
auto it = a.begin(); it !=
last; ++it) {
712 Gparameter new_a(a.begin(), it);
714 new_a.insert(new_a.end(), it, a.end()-1);
715 result -= trailing_zeros_G(new_a, scale, gsyms);
718 return result / trailing_zeros;
720 return G_eval(a, scale, gsyms);
726ex depth_one_trafo_G(
const Gparameter& pending_integrals,
const Gparameter& a,
int scale,
const exvector& gsyms)
739 Gparameter new_pending_integrals = prepare_pending_integrals(pending_integrals,
std::abs(a.back()));
740 const int psize = pending_integrals.size();
748 result +=
log(gsyms[ex_to<numeric>(scale).
to_int()]);
750 new_pending_integrals.push_back(-scale);
753 new_pending_integrals.push_back(scale);
757 result *= trailing_zeros_G(convert_pending_integrals_G(pending_integrals),
758 pending_integrals.front(),
763 result += trailing_zeros_G(convert_pending_integrals_G(new_pending_integrals),
764 new_pending_integrals.front(),
768 new_pending_integrals.back() = 0;
769 result -= trailing_zeros_G(convert_pending_integrals_G(new_pending_integrals),
770 new_pending_integrals.front(),
781 result -=
zeta(a.size());
783 result *= trailing_zeros_G(convert_pending_integrals_G(pending_integrals),
784 pending_integrals.front(),
790 Gparameter new_a(a.begin()+1, a.end());
791 new_pending_integrals.push_back(0);
792 result -= depth_one_trafo_G(new_pending_integrals, new_a, scale, gsyms);
796 Gparameter new_pending_integrals_2;
797 new_pending_integrals_2.push_back(scale);
798 new_pending_integrals_2.push_back(0);
800 result += trailing_zeros_G(convert_pending_integrals_G(pending_integrals),
801 pending_integrals.front(),
803 * depth_one_trafo_G(new_pending_integrals_2, new_a, scale, gsyms);
805 result += depth_one_trafo_G(new_pending_integrals_2, new_a, scale, gsyms);
813ex shuffle_G(
const Gparameter & a0,
const Gparameter & a1,
const Gparameter & a2,
814 const Gparameter& pendint,
const Gparameter& a_old,
int scale,
815 const exvector& gsyms,
bool flag_trailing_zeros_only);
819ex G_transform(
const Gparameter& pendint,
const Gparameter& a,
int scale,
820 const exvector& gsyms,
bool flag_trailing_zeros_only)
833 int depth, trailing_zeros;
834 Gparameter::const_iterator min_it;
835 auto firstzero = check_parameter_G(a, scale, convergent, depth, trailing_zeros, min_it);
836 int min_it_pos = distance(a.begin(), min_it);
845 result = G_eval(a, scale, gsyms);
847 if (pendint.size() > 0) {
848 result *= trailing_zeros_G(convert_pending_integrals_G(pendint),
856 if (trailing_zeros > 0) {
858 Gparameter new_a(a.begin(), a.end()-1);
859 result += G_eval1(0, scale, gsyms) * G_transform(pendint, new_a, scale, gsyms, flag_trailing_zeros_only);
860 for (
auto it = a.begin(); it != firstzero; ++it) {
861 Gparameter new_a(a.begin(), it);
863 new_a.insert(new_a.end(), it, a.end()-1);
864 result -= G_transform(pendint, new_a, scale, gsyms, flag_trailing_zeros_only);
866 return result / trailing_zeros;
870 if (flag_trailing_zeros_only)
871 return G_eval_to_G(a, scale, gsyms);
875 if (pendint.size() > 0) {
876 return G_eval(convert_pending_integrals_G(pendint),
877 pendint.front(), gsyms) *
878 G_eval(a, scale, gsyms);
880 return G_eval(a, scale, gsyms);
886 return depth_one_trafo_G(pendint, a, scale, gsyms);
895 if (min_it + 1 == a.end()) {
896 do { --min_it; }
while (*min_it == 0);
898 Gparameter a1(a.begin(),min_it+1);
899 Gparameter a2(min_it+1,a.end());
901 ex result = G_transform(pendint, a2, scale, gsyms, flag_trailing_zeros_only)*
902 G_transform(empty, a1, scale, gsyms, flag_trailing_zeros_only);
904 result -= shuffle_G(empty, a1, a2, pendint, a, scale, gsyms, flag_trailing_zeros_only);
909 Gparameter::iterator changeit;
912 Gparameter new_pendint = prepare_pending_integrals(pendint, a[min_it_pos]);
913 Gparameter new_a = a;
914 new_a[min_it_pos] = 0;
915 ex result = G_transform(empty, new_a, scale, gsyms, flag_trailing_zeros_only);
916 if (pendint.size() > 0) {
917 result *= trailing_zeros_G(convert_pending_integrals_G(pendint),
918 pendint.front(), gsyms);
922 changeit = new_a.begin() + min_it_pos;
923 changeit = new_a.erase(changeit);
924 if (changeit != new_a.begin()) {
926 new_pendint.push_back(*changeit);
927 result -= trailing_zeros_G(convert_pending_integrals_G(new_pendint),
928 new_pendint.front(), gsyms)*
929 G_transform(empty, new_a, scale, gsyms, flag_trailing_zeros_only);
930 int buffer = *changeit;
932 result += G_transform(new_pendint, new_a, scale, gsyms, flag_trailing_zeros_only);
934 new_pendint.pop_back();
936 new_pendint.push_back(*changeit);
937 result += trailing_zeros_G(convert_pending_integrals_G(new_pendint),
938 new_pendint.front(), gsyms)*
939 G_transform(empty, new_a, scale, gsyms, flag_trailing_zeros_only);
941 result -= G_transform(new_pendint, new_a, scale, gsyms, flag_trailing_zeros_only);
944 new_pendint.push_back(scale);
945 result += trailing_zeros_G(convert_pending_integrals_G(new_pendint),
946 new_pendint.front(), gsyms)*
947 G_transform(empty, new_a, scale, gsyms, flag_trailing_zeros_only);
948 new_pendint.back() = *changeit;
949 result -= trailing_zeros_G(convert_pending_integrals_G(new_pendint),
950 new_pendint.front(), gsyms)*
951 G_transform(empty, new_a, scale, gsyms, flag_trailing_zeros_only);
953 result += G_transform(new_pendint, new_a, scale, gsyms, flag_trailing_zeros_only);
961ex shuffle_G(
const Gparameter & a0,
const Gparameter & a1,
const Gparameter & a2,
962 const Gparameter& pendint,
const Gparameter& a_old,
int scale,
963 const exvector& gsyms,
bool flag_trailing_zeros_only)
965 if (a1.size()==0 && a2.size()==0) {
967 if ( a0 == a_old )
return 0;
969 return G_transform(pendint, a0, scale, gsyms, flag_trailing_zeros_only);
975 aa0.insert(aa0.end(),a1.begin(),a1.end());
976 return shuffle_G(aa0, empty, empty, pendint, a_old, scale, gsyms, flag_trailing_zeros_only);
982 aa0.insert(aa0.end(),a2.begin(),a2.end());
983 return shuffle_G(aa0, empty, empty, pendint, a_old, scale, gsyms, flag_trailing_zeros_only);
986 Gparameter a1_removed(a1.begin()+1,a1.end());
987 Gparameter a2_removed(a2.begin()+1,a2.end());
992 a01.push_back( a1[0] );
993 a02.push_back( a2[0] );
995 return shuffle_G(a01, a1_removed, a2, pendint, a_old, scale, gsyms, flag_trailing_zeros_only)
996 + shuffle_G(a02, a1, a2_removed, pendint, a_old, scale, gsyms, flag_trailing_zeros_only);
1002G_numeric(
const std::vector<cln::cl_N>&
x,
const std::vector<int>& s,
1003 const cln::cl_N& y);
1008G_do_hoelder(std::vector<cln::cl_N>
x,
1009 const std::vector<int>& s,
const cln::cl_N& y)
1012 const std::size_t size =
x.size();
1013 for (std::size_t i = 0; i < size; ++i)
1021 for (std::size_t i = 0; i < size; ++i) {
1024 if (cln::zerop(
x[i] - cln::cl_RA(1)/p) ) {
1025 p = p/2 + cln::cl_RA(3)/2;
1031 cln::cl_RA q = p/(p-1);
1033 for (std::size_t
r = 0;
r <= size; ++
r) {
1034 cln::cl_N buffer(1 &
r ? -1 : 1);
1035 std::vector<cln::cl_N> qlstx;
1036 std::vector<int> qlsts;
1037 for (std::size_t j =
r; j >= 1; --j) {
1038 qlstx.push_back(cln::cl_N(1) -
x[j-1]);
1039 if (imagpart(
x[j-1])==0 && realpart(
x[j-1]) >= 1) {
1042 qlsts.push_back(-s[j-1]);
1045 if (qlstx.size() > 0) {
1046 buffer = buffer*G_numeric(qlstx, qlsts, 1/q);
1048 std::vector<cln::cl_N> plstx;
1049 std::vector<int> plsts;
1050 for (std::size_t j =
r+1; j <= size; ++j) {
1051 plstx.push_back(
x[j-1]);
1052 plsts.push_back(s[j-1]);
1054 if (plstx.size() > 0) {
1055 buffer = buffer*G_numeric(plstx, plsts, 1/p);
1057 result = result + buffer;
1062class less_object_for_cl_N
1065 bool operator() (
const cln::cl_N & a,
const cln::cl_N & b)
const
1069 return (
abs(a) <
abs(b)) ? true :
false;
1072 if (phase(a) != phase(b))
1073 return (phase(a) < phase(b)) ? true :
false;
1084G_do_trafo(
const std::vector<cln::cl_N>&
x,
const std::vector<int>& s,
1085 const cln::cl_N& y,
bool flag_trailing_zeros_only)
1088 typedef std::multimap<cln::cl_N, std::size_t, less_object_for_cl_N> sortmap_t;
1090 std::size_t size = 0;
1091 for (std::size_t i = 0; i <
x.size(); ++i) {
1093 sortmap.insert(std::make_pair(
x[i], i));
1098 sortmap.insert(std::make_pair(y,
x.size()));
1104 gsyms.push_back(symbol(
"GSYMS_ERROR"));
1105 cln::cl_N lastentry(0);
1106 for (sortmap_t::const_iterator it = sortmap.begin(); it != sortmap.end(); ++it) {
1107 if (it != sortmap.begin()) {
1108 if (it->second <
x.size()) {
1109 if (
x[it->second] == lastentry) {
1110 gsyms.push_back(gsyms.back());
1114 if (y == lastentry) {
1115 gsyms.push_back(gsyms.back());
1120 std::ostringstream os;
1122 gsyms.push_back(symbol(os.str()));
1124 if (it->second <
x.size()) {
1125 lastentry =
x[it->second];
1132 Gparameter a(
x.size());
1134 std::size_t pos = 1;
1136 for (sortmap_t::const_iterator it = sortmap.begin(); it != sortmap.end(); ++it) {
1137 if (it->second <
x.size()) {
1138 if (s[it->second] > 0) {
1139 a[it->second] = pos;
1141 a[it->second] = -int(pos);
1143 subslst[gsyms[pos]] = numeric(
x[it->second]);
1146 subslst[gsyms[pos]] = numeric(y);
1153 ex result = G_transform(pendint, a, scale, gsyms, flag_trailing_zeros_only);
1155 result = result.expand();
1156 result = result.subs(subslst).evalf();
1157 if (!is_a<numeric>(result))
1158 throw std::logic_error(
"G_do_trafo: G_transform returned non-numeric result");
1160 cln::cl_N ret = ex_to<numeric>(result).to_cl_N();
1167G_numeric(
const std::vector<cln::cl_N>&
x,
const std::vector<int>& s,
1171 bool need_trafo =
false;
1172 bool need_hoelder =
false;
1173 bool have_trailing_zero =
false;
1174 std::size_t depth = 0;
1175 for (
auto & xi :
x) {
1178 const cln::cl_N x_y =
abs(xi) - y;
1179 if (instanceof(x_y, cln::cl_R_ring) &&
1180 realpart(x_y) < cln::least_negative_float(cln::float_format(
Digits - 2)))
1183 if (
abs(
abs(xi/y) - 1) < 0.01)
1184 need_hoelder =
true;
1187 if (zerop(
x.back())) {
1188 have_trailing_zero =
true;
1192 if (depth == 1 &&
x.size() == 2 && !need_trafo)
1193 return - Li_projection(2, y/
x[1], cln::float_format(
Digits));
1196 if (need_hoelder && !have_trailing_zero)
1197 return G_do_hoelder(
x, s, y);
1201 return G_do_trafo(
x, s, y, have_trailing_zero);
1204 std::vector<cln::cl_N> newx;
1205 newx.reserve(
x.size());
1207 m.reserve(
x.size());
1211 for (
auto & xi :
x) {
1215 newx.push_back(
factor/xi);
1217 m.push_back(mcount);
1223 return sign*multipleLi_do_sum(
m, newx);
1227ex mLi_numeric(
const lst&
m,
const lst&
x)
1230 std::vector<cln::cl_N> newx;
1231 newx.reserve(
x.
nops());
1233 s.reserve(
x.
nops());
1235 for (
auto itm =
m.begin(), itx =
x.
begin(); itm !=
m.end(); ++itm, ++itx) {
1236 for (
int i = 1; i < *itm; ++i) {
1237 newx.push_back(cln::cl_N(0));
1240 const cln::cl_N xi = ex_to<numeric>(*itx).to_cl_N();
1243 if ( !instanceof(
factor, cln::cl_R_ring) && imagpart(
factor) < 0 ) {
1250 return numeric(cln::cl_N(1 &
m.nops() ? - 1 : 1)*G_numeric(newx, s, cln::cl_N(1)));
1269 return G(x_, y).
hold();
1271 lst x = is_a<lst>(x_) ? ex_to<lst>(x_) :
lst{x_};
1272 if (
x.
nops() == 0) {
1276 return G(x_, y).
hold();
1279 s.reserve(
x.
nops());
1280 bool all_zero =
true;
1281 for (
const auto & it :
x) {
1283 return G(x_, y).
hold();
1288 if ( !ex_to<numeric>(it).
is_real() && ex_to<numeric>(it).
imag() < 0 ) {
1298 std::vector<cln::cl_N> xv;
1299 xv.reserve(
x.
nops());
1300 for (
const auto & it :
x)
1301 xv.push_back(ex_to<numeric>(it).to_cl_N());
1302 cln::cl_N result = G_numeric(xv, s, ex_to<numeric>(y).to_cl_N());
1312 return G(x_, y).
hold();
1314 lst x = is_a<lst>(x_) ? ex_to<lst>(x_) :
lst{x_};
1315 if (
x.
nops() == 0) {
1319 return G(x_, y).
hold();
1322 s.reserve(
x.
nops());
1323 bool all_zero =
true;
1324 bool crational =
true;
1325 for (
const auto & it :
x) {
1327 return G(x_, y).
hold();
1335 if ( !ex_to<numeric>(it).
is_real() && ex_to<numeric>(it).
imag() < 0 ) {
1349 return G(x_, y).
hold();
1351 std::vector<cln::cl_N> xv;
1352 xv.reserve(
x.
nops());
1353 for (
const auto & it :
x)
1354 xv.push_back(ex_to<numeric>(it).to_cl_N());
1355 cln::cl_N result = G_numeric(xv, s, ex_to<numeric>(y).to_cl_N());
1373 return G(x_, s_, y).
hold();
1375 lst x = is_a<lst>(x_) ? ex_to<lst>(x_) :
lst{x_};
1376 lst s = is_a<lst>(s_) ? ex_to<lst>(s_) :
lst{s_};
1378 return G(x_, s_, y).
hold();
1380 if (
x.
nops() == 0) {
1384 return G(x_, s_, y).
hold();
1386 std::vector<int> sn;
1387 sn.reserve(s.
nops());
1388 bool all_zero =
true;
1389 for (
auto itx =
x.
begin(), its = s.
begin(); itx !=
x.
end(); ++itx, ++its) {
1391 return G(x_, y).
hold();
1394 return G(x_, y).
hold();
1399 if ( ex_to<numeric>(*itx).is_real() ) {
1400 if ( ex_to<numeric>(*itx).is_positive() ) {
1412 if ( ex_to<numeric>(*itx).imag() > 0 ) {
1423 std::vector<cln::cl_N> xn;
1424 xn.reserve(
x.
nops());
1425 for (
const auto & it :
x)
1426 xn.push_back(ex_to<numeric>(it).to_cl_N());
1427 cln::cl_N result = G_numeric(xn, sn, ex_to<numeric>(y).to_cl_N());
1437 return G(x_, s_, y).
hold();
1439 lst x = is_a<lst>(x_) ? ex_to<lst>(x_) :
lst{x_};
1440 lst s = is_a<lst>(s_) ? ex_to<lst>(s_) :
lst{s_};
1442 return G(x_, s_, y).
hold();
1444 if (
x.
nops() == 0) {
1448 return G(x_, s_, y).
hold();
1450 std::vector<int> sn;
1451 sn.reserve(s.
nops());
1452 bool all_zero =
true;
1453 bool crational =
true;
1454 for (
auto itx =
x.
begin(), its = s.
begin(); itx !=
x.
end(); ++itx, ++its) {
1456 return G(x_, s_, y).
hold();
1459 return G(x_, s_, y).
hold();
1467 if ( ex_to<numeric>(*itx).is_real() ) {
1468 if ( ex_to<numeric>(*itx).is_positive() ) {
1480 if ( ex_to<numeric>(*itx).imag() > 0 ) {
1495 return G(x_, s_, y).
hold();
1497 std::vector<cln::cl_N> xn;
1498 xn.reserve(
x.
nops());
1499 for (
const auto & it :
x)
1500 xn.push_back(ex_to<numeric>(it).to_cl_N());
1501 cln::cl_N result = G_numeric(xn, sn, ex_to<numeric>(y).to_cl_N());
1532 int m__ = ex_to<numeric>(m_).to_int();
1533 const cln::cl_N x__ = ex_to<numeric>(x_).to_cl_N();
1534 const cln::cl_N result = Lin_numeric(m__, x__);
1540 int m__ = ex_to<numeric>(m_).to_int();
1541 const cln::cl_N x__ = ex_to<numeric>(x_val).to_cl_N();
1542 const cln::cl_N result = Lin_numeric(m__, x__);
1548 if (is_a<lst>(m_) && is_a<lst>(x_)) {
1550 const lst&
m = ex_to<lst>(m_);
1551 const lst&
x = ex_to<lst>(x_);
1552 if (
m.nops() !=
x.
nops()) {
1553 return Li(m_,x_).hold();
1555 if (
x.
nops() == 0) {
1559 return Li(m_,x_).hold();
1562 for (
auto itm =
m.begin(), itx =
x.
begin(); itm !=
m.end(); ++itm, ++itx) {
1564 return Li(m_, x_).hold();
1567 return Li(m_, x_).hold();
1574 return mLi_numeric(
m,
x);
1577 return Li(m_,x_).hold();
1583 if (is_a<lst>(m_)) {
1584 if (is_a<lst>(x_)) {
1586 const lst&
m = ex_to<lst>(m_);
1587 const lst&
x = ex_to<lst>(x_);
1588 if (
m.nops() !=
x.
nops()) {
1589 return Li(m_,x_).hold();
1591 if (
x.
nops() == 0) {
1595 bool is_zeta =
true;
1596 bool do_evalf =
true;
1597 bool crational =
true;
1598 for (
auto itm =
m.begin(), itx =
x.
begin(); itm !=
m.end(); ++itm, ++itx) {
1600 return Li(m_,x_).hold();
1602 if ((*itx !=
_ex1) && (*itx !=
_ex_1)) {
1620 for (
const auto & itx :
x) {
1629 return zeta(m_, newx);
1633 lst newm = convert_parameter_Li_to_H(
m,
x, prefactor);
1634 return prefactor * H(newm,
x[0]);
1636 if (do_evalf && !crational) {
1637 return mLi_numeric(
m,
x);
1640 return Li(m_, x_).hold();
1641 }
else if (is_a<lst>(x_)) {
1642 return Li(m_, x_).hold();
1653 return (
pow(2,1-m_)-1) *
zeta(m_);
1667 int m__ = ex_to<numeric>(m_).
to_int();
1668 const cln::cl_N x__ = ex_to<numeric>(x_).to_cl_N();
1669 const cln::cl_N result = Lin_numeric(m__, x__);
1673 return Li(m_, x_).hold();
1679 if (is_a<lst>(
m) || is_a<lst>(
x)) {
1682 return pseries(rel, std::move(seq));
1693 for (
int i=1; i<
order; ++i)
1699 ser +=
pseries(rel, std::move(nseq));
1704 throw std::runtime_error(
"Li_series: don't know how to do the series expansion at this point!");
1714 if (deriv_param == 0) {
1717 if (m_.
nops() > 1) {
1718 throw std::runtime_error(
"don't know how to derivate multiple polylogarithm!");
1721 if (is_a<lst>(m_)) {
1727 if (is_a<lst>(x_)) {
1733 return Li(
m-1,
x) /
x;
1743 if (is_a<lst>(m_)) {
1749 if (is_a<lst>(x_)) {
1754 c.s <<
"\\mathrm{Li}_{";
1755 auto itm =
m.begin();
1758 for (; itm !=
m.end(); itm++) {
1766 for (; itx !=
x.
end(); itx++) {
1780 do_not_evalf_params());
1798std::vector<std::vector<cln::cl_N>> Yn;
1811void fill_Yn(
int n,
const cln::float_format_t& prec)
1813 const int initsize = ynlength;
1815 cln::cl_N
one = cln::cl_float(1, prec);
1818 std::vector<cln::cl_N> buf(initsize);
1819 auto it = buf.begin();
1820 auto itprev = Yn[
n-1].begin();
1821 *it = (*itprev) / cln::cl_N(
n+1) *
one;
1826 for (
int i=
n+2; i<=initsize+
n; i++) {
1827 *it = *(it-1) + (*itprev) / cln::cl_N(i) *
one;
1833 std::vector<cln::cl_N> buf(initsize);
1834 auto it = buf.begin();
1837 for (
int i=2; i<=initsize; i++) {
1838 *it = *(it-1) + 1 / cln::cl_N(i) *
one;
1848void make_Yn_longer(
int newsize,
const cln::float_format_t& prec)
1851 cln::cl_N
one = cln::cl_float(1, prec);
1853 Yn[0].resize(newsize);
1854 auto it = Yn[0].begin();
1856 for (
int i=ynlength+1; i<=newsize; i++) {
1857 *it = *(it-1) + 1 / cln::cl_N(i) *
one;
1861 for (
int n=1;
n<ynsize;
n++) {
1862 Yn[
n].resize(newsize);
1863 auto it = Yn[
n].begin();
1864 auto itprev = Yn[
n-1].begin();
1867 for (
int i=ynlength+
n+1; i<=newsize+
n; i++) {
1868 *it = *(it-1) + (*itprev) / cln::cl_N(i) *
one;
1880cln::cl_N C(
int n,
int p)
1884 for (
int k=0;
k<p;
k++) {
1885 for (
int j=0; j<=(
n+
k-1)/2; j++) {
1889 result = result - 2 * cln::expt(cln::pi(),2*j) * S_num(
n-2*j,p,1) /
cln::factorial(2*j);
1892 result = result + 2 * cln::expt(cln::pi(),2*j) * S_num(
n-2*j,p,1) /
cln::factorial(2*j);
1900 * cln::expt(cln::pi(),2*j) * S_num(
n+
k-2*j,p-
k,1)
1905 * cln::expt(cln::pi(),2*j) * S_num(
n+
k-2*j,p-
k,1)
1916 * cln::expt(cln::pi(),2*j) * S_num(
n+
k-2*j,p-
k,1)
1925 if (((np)/2+
n) & 1) {
1948 for (
int m=2;
m<=
k;
m++) {
1949 result = result + cln::expt(cln::cl_N(-1),
m) *
cln::zeta(
m) * a_k(
k-
m);
1967 for (
int m=2;
m<=
k;
m++) {
1968 result = result + cln::expt(cln::cl_N(-1),
m) *
cln::zeta(
m) * b_k(
k-
m);
1976cln::cl_N S_do_sum(
int n,
int p,
const cln::cl_N&
x,
const cln::float_format_t& prec)
1978 static cln::float_format_t oldprec = cln::default_float_format;
1981 return Li_projection(
n+1,
x, prec);
1985 if ( oldprec != prec ) {
1994 for (
int i=ynsize; i<p-1; i++) {
2000 cln::cl_F
one = cln::cl_float(1, cln::float_format(
Digits));
2001 cln::cl_N xf =
x *
one;
2006 cln::cl_N
factor = cln::expt(xf, p);
2010 if (i-p >= ynlength) {
2012 make_Yn_longer(ynlength*2, prec);
2014 res = res +
factor / cln::expt(cln::cl_I(i),
n+1) * Yn[p-2][i-p];
2018 }
while (res != resbuf);
2025cln::cl_N S_projection(
int n,
int p,
const cln::cl_N&
x,
const cln::float_format_t& prec)
2028 if (
cln::abs(cln::realpart(
x)) > cln::cl_F(
"0.5")) {
2030 cln::cl_N result = cln::expt(cln::cl_I(-1),p) * cln::expt(
cln::log(
x),
n)
2033 for (
int s=0; s<
n; s++) {
2035 for (
int r=0;
r<p;
r++) {
2036 res2 = res2 + cln::expt(cln::cl_I(-1),
r) * cln::expt(
cln::log(1-
x),
r)
2045 return S_do_sum(
n, p,
x, prec);
2050const cln::cl_N S_num(
int n,
int p,
const cln::cl_N&
x)
2065 for (
int nu=0; nu<
n; nu++) {
2066 for (
int rho=0; rho<=p; rho++) {
2067 result = result + b_k(
n-nu-1) * b_k(p-rho) * a_k(nu+rho+1)
2071 result = result * cln::expt(cln::cl_I(-1),
n+p-1);
2078 return -(1-cln::expt(cln::cl_I(2),-
n)) *
cln::zeta(
n+1);
2085 cln::float_format_t prec = cln::default_float_format;
2086 const cln::cl_N
value =
x;
2088 if (!instanceof(realpart(
value), cln::cl_RA_ring))
2089 prec = cln::float_format(cln::the<cln::cl_F>(cln::realpart(
value)));
2090 else if (!instanceof(imagpart(
value), cln::cl_RA_ring))
2091 prec = cln::float_format(cln::the<cln::cl_F>(cln::imagpart(
value)));
2098 cln::cl_N result = cln::expt(cln::cl_I(-1),p) * cln::expt(
cln::log(
value),
n)
2101 for (
int s=0; s<
n; s++) {
2103 for (
int r=0;
r<p;
r++) {
2104 res2 = res2 + cln::expt(cln::cl_I(-1),
r) * cln::expt(
cln::log(1-
value),
r)
2118 for (
int s=0; s<p; s++) {
2119 for (
int r=0;
r<=s;
r++) {
2122 * S_num(
n+s-
r,p-s,cln::recip(
value));
2125 result = result * cln::expt(cln::cl_I(-1),
n);
2128 for (
int r=0;
r<
n;
r++) {
2133 result = result + cln::expt(cln::cl_I(-1),p) * res2;
2141 for (
int s=0; s<p-1; s++)
2144 ex res = H(
m,numeric(
value)).evalf();
2145 return ex_to<numeric>(res).to_cl_N();
2148 return S_projection(
n, p,
value, prec);
2168 const int n_ = ex_to<numeric>(
n).to_int();
2169 const int p_ = ex_to<numeric>(p).to_int();
2170 if (is_a<numeric>(
x)) {
2171 const cln::cl_N x_ = ex_to<numeric>(
x).to_cl_N();
2172 const cln::cl_N result = S_num(n_, p_, x_);
2176 if (is_a<numeric>(x_val)) {
2177 const cln::cl_N x_val_ = ex_to<numeric>(x_val).to_cl_N();
2178 const cln::cl_N result = S_num(n_, p_, x_val_);
2183 return S(
n, p,
x).hold();
2195 for (
int i=ex_to<numeric>(p).
to_int()-1; i>0; i--) {
2204 int n_ = ex_to<numeric>(
n).to_int();
2205 int p_ = ex_to<numeric>(p).to_int();
2206 const cln::cl_N x_ = ex_to<numeric>(
x).to_cl_N();
2207 const cln::cl_N result = S_num(n_, p_, x_);
2215 return S(
n, p,
x).hold();
2234 std::vector<ex> presubsum, subsum;
2235 subsum.push_back(0);
2236 for (
int i=1; i<
order-1; ++i) {
2237 subsum.push_back(subsum[i-1] +
numeric(1, i));
2239 for (
int depth=2; depth<p; ++depth) {
2241 for (
int i=1; i<
order-1; ++i) {
2242 subsum[i] = subsum[i-1] +
numeric(1, i) * presubsum[i-1];
2246 for (
int i=1; i<
order; ++i) {
2253 ser +=
pseries(rel, std::move(nseq));
2258 throw std::runtime_error(
"S_series: don't know how to do the series expansion at this point!");
2268 if (deriv_param < 2) {
2272 return S(
n-1, p,
x) /
x;
2274 return S(
n, p-1,
x) / (1-
x);
2281 c.s <<
"\\mathrm{S}_{";
2297 do_not_evalf_params());
2314symbol H_polesign(
"IMSIGN");
2320bool convert_parameter_H_to_Li(
const lst& l,
lst&
m,
lst& s,
ex& pf)
2324 for (
const auto & it : l) {
2326 for (
ex count=it-1; count > 0; count--) {
2330 }
else if (it < -1) {
2331 for (ex count=it+1; count < 0; count++) {
2342 bool has_negative_parameters =
false;
2344 for (
const auto & it : mexp) {
2350 m.append((it+acc-1) * signum);
2352 m.append((it-acc+1) * signum);
2358 has_negative_parameters =
true;
2361 if (has_negative_parameters) {
2362 for (std::size_t i=0; i<
m.nops(); i++) {
2364 m.let_op(i) = -
m.op(i);
2372 return has_negative_parameters;
2377struct map_trafo_H_convert_to_Li :
public map_function
2379 ex operator()(
const ex& e)
override
2381 if (is_a<add>(e) || is_a<mul>(e)) {
2382 return e.
map(*
this);
2384 if (is_a<function>(e)) {
2385 std::string name = ex_to<function>(e).get_name();
2388 if (is_a<lst>(e.op(0))) {
2389 parameter = ex_to<lst>(e.op(0));
2391 parameter =
lst{e.op(0)};
2398 if (convert_parameter_H_to_Li(parameter,
m, s, pf)) {
2400 return pf * Li(
m, s).hold();
2402 for (std::size_t i=0; i<
m.nops(); i++) {
2406 return Li(
m, s).hold();
2416struct map_trafo_H_convert_to_zeta :
public map_function
2418 ex operator()(
const ex& e)
override
2420 if (is_a<add>(e) || is_a<mul>(e)) {
2421 return e.
map(*
this);
2423 if (is_a<function>(e)) {
2424 std::string name = ex_to<function>(e).get_name();
2427 if (is_a<lst>(e.op(0))) {
2428 parameter = ex_to<lst>(e.op(0));
2430 parameter =
lst{e.op(0)};
2436 if (convert_parameter_H_to_Li(parameter,
m, s, pf)) {
2437 return pf *
zeta(
m, s);
2449struct map_trafo_H_reduce_trailing_zeros :
public map_function
2451 ex operator()(
const ex& e)
override
2453 if (is_a<add>(e) || is_a<mul>(e)) {
2454 return e.map(*
this);
2456 if (is_a<function>(e)) {
2457 std::string name = ex_to<function>(e).get_name();
2460 if (is_a<lst>(e.op(0))) {
2461 parameter = ex_to<lst>(e.op(0));
2463 parameter =
lst{e.op(0)};
2466 if (parameter.op(parameter.nops()-1) == 0) {
2469 if (parameter.nops() == 1) {
2474 auto it = parameter.begin();
2475 while ((it != parameter.end()) && (*it == 0)) {
2478 if (it == parameter.end()) {
2483 parameter.remove_last();
2484 std::size_t lastentry = parameter.nops();
2485 while ((lastentry > 0) && (parameter[lastentry-1] == 0)) {
2490 ex result =
log(arg) * H(parameter,arg).
hold();
2492 for (ex i=0; i<lastentry; i++) {
2493 if (parameter[i] > 0) {
2495 result -= (acc + parameter[i]-1) * H(parameter, arg).
hold();
2498 }
else if (parameter[i] < 0) {
2500 result -= (acc +
abs(parameter[i]+1)) * H(parameter, arg).
hold();
2508 if (lastentry < parameter.nops()) {
2509 result = result / (parameter.nops()-lastentry+1);
2510 return result.
map(*
this);
2523ex convert_H_to_zeta(
const lst&
m)
2525 symbol xtemp(
"xtemp");
2526 map_trafo_H_reduce_trailing_zeros filter;
2527 map_trafo_H_convert_to_zeta filter2;
2528 return filter2(filter(H(
m, xtemp).hold())).subs(xtemp == 1);
2533lst convert_parameter_Li_to_H(
const lst&
m,
const lst&
x, ex& pf)
2536 auto itm =
m.begin();
2542 while (itx !=
x.
end()) {
2548 signum *= (*itx !=
_ex_1) ? 1 : -1;
2550 res.append((*itm) * signum);
2560ex trafo_H_mult(
const ex& h1,
const ex& h2)
2565 ex h1nops = h1.op(0).nops();
2566 ex h2nops = h2.op(0).nops();
2568 hshort = h2.op(0).op(0);
2569 hlong = ex_to<lst>(h1.op(0));
2571 hshort = h1.op(0).op(0);
2573 hlong = ex_to<lst>(h2.op(0));
2575 hlong =
lst{h2.op(0).op(0)};
2578 for (std::size_t i=0; i<=hlong.nops(); i++) {
2582 newparameter.append(hlong[j]);
2584 newparameter.append(hshort);
2585 for (; j<hlong.nops(); j++) {
2586 newparameter.append(hlong[j]);
2588 res += H(newparameter, h1.op(1)).hold();
2595struct map_trafo_H_mult :
public map_function
2597 ex operator()(
const ex& e)
override
2600 return e.map(*
this);
2608 for (std::size_t pos=0; pos<e.nops(); pos++) {
2609 if (is_a<power>(e.op(pos)) && is_a<function>(e.op(pos).op(0))) {
2610 std::string name = ex_to<function>(e.op(pos).op(0)).get_name();
2612 for (ex i=0; i<e.op(pos).
op(1); i++) {
2613 Hlst.append(e.op(pos).op(0));
2617 }
else if (is_a<function>(e.op(pos))) {
2618 std::string name = ex_to<function>(e.op(pos)).get_name();
2620 if (e.op(pos).op(0).nops() > 1) {
2623 Hlst.append(e.op(pos));
2628 result *= e.op(pos);
2631 if (Hlst.nops() > 0) {
2632 firstH = Hlst[Hlst.nops()-1];
2639 if (Hlst.nops() > 0) {
2640 ex buffer = trafo_H_mult(firstH, Hlst.op(0));
2642 for (std::size_t i=1; i<Hlst.nops(); i++) {
2643 result *= Hlst.op(i);
2645 result = result.expand();
2646 map_trafo_H_mult recursion;
2647 return recursion(result);
2660ex trafo_H_1tx_prepend_zero(
const ex& e,
const ex& arg)
2664 if (is_a<function>(e)) {
2665 name = ex_to<function>(e).get_name();
2670 for (std::size_t i=0; i<e.nops(); i++) {
2671 if (is_a<function>(e.op(i))) {
2672 std::string name = ex_to<function>(e.op(i)).get_name();
2680 lst newparameter = ex_to<lst>(h.op(0));
2681 newparameter.prepend(0);
2682 ex addzeta = convert_H_to_zeta(newparameter);
2683 return e.subs(h == (addzeta-H(newparameter, h.op(1)).hold())).expand();
2685 return e * (-H(
lst{ex(0)},1/arg).hold());
2692ex trafo_H_prepend_one(
const ex& e,
const ex& arg)
2696 if (is_a<function>(e)) {
2697 name = ex_to<function>(e).get_name();
2702 for (std::size_t i=0; i<e.nops(); i++) {
2703 if (is_a<function>(e.op(i))) {
2704 std::string name = ex_to<function>(e.op(i)).get_name();
2712 lst newparameter = ex_to<lst>(h.op(0));
2713 newparameter.prepend(1);
2714 return e.subs(h == H(newparameter, h.op(1)).hold());
2716 return e * H(
lst{ex(1)},1-arg).hold();
2723ex trafo_H_1tx_prepend_minusone(
const ex& e,
const ex& arg)
2727 if (is_a<function>(e)) {
2728 name = ex_to<function>(e).get_name();
2733 for (std::size_t i=0; i<e.nops(); i++) {
2734 if (is_a<function>(e.op(i))) {
2735 std::string name = ex_to<function>(e.op(i)).get_name();
2743 lst newparameter = ex_to<lst>(h.op(0));
2744 newparameter.prepend(-1);
2745 ex addzeta = convert_H_to_zeta(newparameter);
2746 return e.subs(h == (addzeta-H(newparameter, h.op(1)).hold())).expand();
2748 ex addzeta = convert_H_to_zeta(
lst{ex(-1)});
2749 return (e * (addzeta - H(
lst{ex(-1)},1/arg).hold())).expand();
2756ex trafo_H_1mxt1px_prepend_minusone(
const ex& e,
const ex& arg)
2760 if (is_a<function>(e)) {
2761 name = ex_to<function>(e).get_name();
2766 for (std::size_t i = 0; i < e.nops(); i++) {
2767 if (is_a<function>(e.op(i))) {
2768 std::string name = ex_to<function>(e.op(i)).get_name();
2776 lst newparameter = ex_to<lst>(h.op(0));
2777 newparameter.prepend(-1);
2778 return e.subs(h == H(newparameter, h.op(1)).hold()).expand();
2780 return (e * H(
lst{ex(-1)},(1-arg)/(1+arg)).hold()).
expand();
2787ex trafo_H_1mxt1px_prepend_one(
const ex& e,
const ex& arg)
2791 if (is_a<function>(e)) {
2792 name = ex_to<function>(e).get_name();
2797 for (std::size_t i = 0; i < e.nops(); i++) {
2798 if (is_a<function>(e.op(i))) {
2799 std::string name = ex_to<function>(e.op(i)).get_name();
2807 lst newparameter = ex_to<lst>(h.op(0));
2808 newparameter.prepend(1);
2809 return e.subs(h == H(newparameter, h.op(1)).hold()).expand();
2811 return (e * H(
lst{ex(1)},(1-arg)/(1+arg)).hold()).
expand();
2817struct map_trafo_H_1mx :
public map_function
2819 ex operator()(
const ex& e)
override
2821 if (is_a<add>(e) || is_a<mul>(e)) {
2822 return e.
map(*
this);
2825 if (is_a<function>(e)) {
2826 std::string name = ex_to<function>(e).get_name();
2829 lst parameter = ex_to<lst>(e.op(0));
2833 bool allthesame =
true;
2834 if (parameter.op(0) == 0) {
2835 for (std::size_t i = 1; i < parameter.nops(); i++) {
2836 if (parameter.op(i) != 0) {
2843 for (
int i=parameter.nops(); i>0; i--) {
2844 newparameter.append(1);
2846 return pow(-1, parameter.nops()) * H(newparameter, 1-arg).
hold();
2848 }
else if (parameter.op(0) == -1) {
2849 throw std::runtime_error(
"map_trafo_H_1mx: cannot handle weights equal -1!");
2851 for (std::size_t i = 1; i < parameter.nops(); i++) {
2852 if (parameter.op(i) != 1) {
2859 for (
int i=parameter.nops(); i>0; i--) {
2860 newparameter.append(0);
2862 return pow(-1, parameter.nops()) * H(newparameter, 1-arg).
hold();
2866 lst newparameter = parameter;
2867 newparameter.remove_first();
2869 if (parameter.op(0) == 0) {
2872 ex res = convert_H_to_zeta(parameter);
2874 map_trafo_H_1mx recursion;
2875 ex buffer = recursion(H(newparameter, arg).hold());
2876 if (is_a<add>(buffer)) {
2877 for (std::size_t i = 0; i < buffer.nops(); i++) {
2878 res -= trafo_H_prepend_one(buffer.op(i), arg);
2881 res -= trafo_H_prepend_one(buffer, arg);
2888 map_trafo_H_1mx recursion;
2889 map_trafo_H_mult unify;
2890 ex res = H(
lst{ex(1)}, arg).hold() * H(newparameter, arg).hold();
2891 std::size_t firstzero = 0;
2892 while (parameter.op(firstzero) == 1) {
2895 for (std::size_t i = firstzero-1; i < parameter.nops()-1; i++) {
2899 newparameter.append(parameter[j+1]);
2901 newparameter.append(1);
2902 for (; j<parameter.nops()-1; j++) {
2903 newparameter.append(parameter[j+1]);
2905 res -= H(newparameter, arg).hold();
2907 res = recursion(res).expand() / firstzero;
2918struct map_trafo_H_1overx :
public map_function
2920 ex operator()(
const ex& e)
override
2922 if (is_a<add>(e) || is_a<mul>(e)) {
2923 return e.map(*
this);
2926 if (is_a<function>(e)) {
2927 std::string name = ex_to<function>(e).get_name();
2930 lst parameter = ex_to<lst>(e.op(0));
2934 bool allthesame =
true;
2935 if (parameter.op(0) == 0) {
2936 for (std::size_t i = 1; i < parameter.nops(); i++) {
2937 if (parameter.op(i) != 0) {
2943 return pow(-1, parameter.nops()) * H(parameter, 1/arg).
hold();
2945 }
else if (parameter.op(0) == -1) {
2946 for (std::size_t i = 1; i < parameter.nops(); i++) {
2947 if (parameter.op(i) != -1) {
2953 map_trafo_H_mult unify;
2954 return unify((
pow(H(
lst{ex(-1)},1/arg).hold() - H(
lst{ex(0)},1/arg).hold(), parameter.nops())
2955 /
factorial(parameter.nops())).expand());
2958 for (std::size_t i = 1; i < parameter.nops(); i++) {
2959 if (parameter.op(i) != 1) {
2965 map_trafo_H_mult unify;
2966 return unify((
pow(H(
lst{ex(1)},1/arg).hold() + H(
lst{ex(0)},1/arg).hold() + H_polesign, parameter.nops())
2967 /
factorial(parameter.nops())).expand());
2971 lst newparameter = parameter;
2972 newparameter.remove_first();
2974 if (parameter.op(0) == 0) {
2977 ex res = convert_H_to_zeta(parameter);
2978 map_trafo_H_1overx recursion;
2979 ex buffer = recursion(H(newparameter, arg).hold());
2980 if (is_a<add>(buffer)) {
2981 for (std::size_t i = 0; i < buffer.nops(); i++) {
2982 res += trafo_H_1tx_prepend_zero(buffer.op(i), arg);
2985 res += trafo_H_1tx_prepend_zero(buffer, arg);
2989 }
else if (parameter.op(0) == -1) {
2992 ex res = convert_H_to_zeta(parameter);
2993 map_trafo_H_1overx recursion;
2994 ex buffer = recursion(H(newparameter, arg).hold());
2995 if (is_a<add>(buffer)) {
2996 for (std::size_t i = 0; i < buffer.nops(); i++) {
2997 res += trafo_H_1tx_prepend_zero(buffer.op(i), arg) - trafo_H_1tx_prepend_minusone(buffer.op(i), arg);
3000 res += trafo_H_1tx_prepend_zero(buffer, arg) - trafo_H_1tx_prepend_minusone(buffer, arg);
3007 map_trafo_H_1overx recursion;
3008 map_trafo_H_mult unify;
3009 ex res = H(
lst{ex(1)}, arg).hold() * H(newparameter, arg).hold();
3010 std::size_t firstzero = 0;
3011 while (parameter.op(firstzero) == 1) {
3014 for (std::size_t i = firstzero-1; i < parameter.nops() - 1; i++) {
3018 newparameter.append(parameter[j+1]);
3020 newparameter.append(1);
3021 for (; j<parameter.nops()-1; j++) {
3022 newparameter.append(parameter[j+1]);
3024 res -= H(newparameter, arg).hold();
3026 res = recursion(res).expand() / firstzero;
3039struct map_trafo_H_1mxt1px :
public map_function
3041 ex operator()(
const ex& e)
override
3043 if (is_a<add>(e) || is_a<mul>(e)) {
3044 return e.map(*
this);
3047 if (is_a<function>(e)) {
3048 std::string name = ex_to<function>(e).get_name();
3051 lst parameter = ex_to<lst>(e.op(0));
3055 bool allthesame =
true;
3056 if (parameter.op(0) == 0) {
3057 for (std::size_t i = 1; i < parameter.nops(); i++) {
3058 if (parameter.op(i) != 0) {
3064 map_trafo_H_mult unify;
3065 return unify((
pow(-H(
lst{ex(1)},(1-arg)/(1+arg)).hold() - H(
lst{ex(-1)},(1-arg)/(1+arg)).hold(), parameter.nops())
3066 /
factorial(parameter.nops())).expand());
3068 }
else if (parameter.op(0) == -1) {
3069 for (std::size_t i = 1; i < parameter.nops(); i++) {
3070 if (parameter.op(i) != -1) {
3076 map_trafo_H_mult unify;
3077 return unify((
pow(
log(2) - H(
lst{ex(-1)},(1-arg)/(1+arg)).hold(), parameter.
nops())
3078 /
factorial(parameter.nops())).expand());
3081 for (std::size_t i = 1; i < parameter.nops(); i++) {
3082 if (parameter.op(i) != 1) {
3088 map_trafo_H_mult unify;
3089 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())
3090 /
factorial(parameter.nops())).expand());
3094 lst newparameter = parameter;
3095 newparameter.remove_first();
3097 if (parameter.op(0) == 0) {
3100 ex res = convert_H_to_zeta(parameter);
3101 map_trafo_H_1mxt1px recursion;
3102 ex buffer = recursion(H(newparameter, arg).hold());
3103 if (is_a<add>(buffer)) {
3104 for (std::size_t i = 0; i < buffer.nops(); i++) {
3105 res -= trafo_H_1mxt1px_prepend_one(buffer.op(i), arg) + trafo_H_1mxt1px_prepend_minusone(buffer.op(i), arg);
3108 res -= trafo_H_1mxt1px_prepend_one(buffer, arg) + trafo_H_1mxt1px_prepend_minusone(buffer, arg);
3112 }
else if (parameter.op(0) == -1) {
3115 ex res = convert_H_to_zeta(parameter);
3116 map_trafo_H_1mxt1px recursion;
3117 ex buffer = recursion(H(newparameter, arg).hold());
3118 if (is_a<add>(buffer)) {
3119 for (std::size_t i = 0; i < buffer.nops(); i++) {
3120 res -= trafo_H_1mxt1px_prepend_minusone(buffer.op(i), arg);
3123 res -= trafo_H_1mxt1px_prepend_minusone(buffer, arg);
3130 map_trafo_H_1mxt1px recursion;
3131 map_trafo_H_mult unify;
3132 ex res = H(
lst{ex(1)}, arg).hold() * H(newparameter, arg).hold();
3133 std::size_t firstzero = 0;
3134 while (parameter.op(firstzero) == 1) {
3137 for (std::size_t i = firstzero - 1; i < parameter.nops() - 1; i++) {
3141 newparameter.append(parameter[j+1]);
3143 newparameter.append(1);
3144 for (; j<parameter.nops()-1; j++) {
3145 newparameter.append(parameter[j+1]);
3147 res -= H(newparameter, arg).hold();
3149 res = recursion(res).expand() / firstzero;
3162cln::cl_N H_do_sum(
const std::vector<int>&
m,
const cln::cl_N&
x)
3164 const int j =
m.size();
3166 std::vector<cln::cl_N> t(j);
3168 cln::cl_F
one = cln::cl_float(1, cln::float_format(
Digits));
3175 t[j-1] = t[j-1] + 1 / cln::expt(cln::cl_I(q),
m[j-1]);
3176 for (
int k=j-2;
k>=1;
k--) {
3177 t[
k] = t[
k] + t[
k+1] / cln::expt(cln::cl_I(q+j-1-
k),
m[
k]);
3179 t[0] = t[0] + t[1] *
factor / cln::expt(cln::cl_I(q+j-1),
m[0]);
3181 }
while (t[0] != t0buf);
3201 if (is_a<lst>(x1)) {
3204 if (is_a<numeric>(x2)) {
3205 x = ex_to<numeric>(x2).to_cl_N();
3208 if (is_a<numeric>(x2_val)) {
3209 x = ex_to<numeric>(x2_val).to_cl_N();
3213 for (std::size_t i = 0; i < x1.
nops(); i++) {
3215 return H(x1, x2).hold();
3218 if (x1.
nops() < 1) {
3219 return H(x1, x2).hold();
3222 const lst& morg = ex_to<lst>(x1);
3224 if (*(--morg.
end()) == 0) {
3226 map_trafo_H_reduce_trailing_zeros filter;
3227 return filter(H(x1, xtemp).hold()).subs(xtemp==x2).evalf();
3231 for (
const auto & it : morg) {
3233 for (
ex count=it-1; count > 0; count--) {
3237 }
else if (it <= -1) {
3238 for (
ex count=it+1; count < 0; count++) {
3252 if (convert_parameter_H_to_Li(
m, m_lst, s_lst, pf)) {
3254 std::vector<int> m_int;
3255 std::vector<cln::cl_N> x_cln;
3256 for (
auto it_int = m_lst.
begin(), it_cln = s_lst.
begin();
3257 it_int != m_lst.
end(); it_int++, it_cln++) {
3258 m_int.push_back(ex_to<numeric>(*it_int).to_int());
3259 x_cln.push_back(ex_to<numeric>(*it_cln).to_cl_N());
3261 x_cln.front() = x_cln.front() *
x;
3262 return pf *
numeric(multipleLi_do_sum(m_int, x_cln));
3266 if (m_lst.
nops() == 1) {
3267 return Li(m_lst.
op(0), x2).evalf();
3269 std::vector<int> m_int;
3270 for (
const auto & it : m_lst) {
3271 m_int.push_back(ex_to<numeric>(it).
to_int());
3273 return numeric(H_do_sum(m_int,
x));
3281 if (cln::realpart(
x) < 0) {
3283 for (std::size_t i = 0; i <
m.nops(); i++) {
3285 m.let_op(i) = -
m.op(i);
3293 map_trafo_H_1overx trafo;
3294 res *= trafo(H(
m, xtemp).hold());
3295 if (cln::imagpart(
x) <= 0) {
3296 res = res.
subs(H_polesign == -
I*
Pi);
3298 res = res.
subs(H_polesign ==
I*
Pi);
3304 bool has_minus_one =
false;
3305 for (
const auto & it :
m) {
3307 has_minus_one =
true;
3315 map_trafo_H_1mxt1px trafo;
3316 res *= trafo(H(
m, xtemp).hold());
3319 if (has_minus_one) {
3320 map_trafo_H_convert_to_Li filter;
3322 res *= filter(H(
m,
numeric(
x)).hold()).evalf();
3325 map_trafo_H_1mx trafo;
3326 res *= trafo(H(
m, xtemp).hold());
3332 return H(x1,x2).hold();
3339 if (is_a<lst>(m_)) {
3344 if (
m.nops() == 0) {
3352 if (*
m.begin() >
_ex1) {
3358 }
else if (*
m.begin() <
_ex_1) {
3364 }
else if (*
m.begin() ==
_ex0) {
3371 for (
auto it = ++
m.begin(); it !=
m.end(); it++) {
3383 }
else if (*it <
_ex_1) {
3403 }
else if (
step == 1) {
3416 return H(m_,
x).hold();
3420 return convert_H_to_zeta(
m);
3426 return H(m_,
x).hold();
3433 }
else if ((
step == 1) && (pos1 ==
_ex0)){
3438 return pow(-1, p) * S(
n, p, -
x);
3447 return H(m_,
x).hold();
3454 return pseries(rel, std::move(seq));
3461 if (deriv_param == 0) {
3465 if (is_a<lst>(m_)) {
3481 return 1/(1-
x) * H(
m,
x);
3482 }
else if (mb ==
_ex_1) {
3483 return 1/(1+
x) * H(
m,
x);
3493 if (is_a<lst>(m_)) {
3498 c.s <<
"\\mathrm{H}_{";
3499 auto itm =
m.begin();
3502 for (; itm !=
m.end(); itm++) {
3518 do_not_evalf_params());
3524 map_trafo_H_reduce_trailing_zeros filter;
3525 map_trafo_H_convert_to_Li filter2;
3527 return filter2(filter(H(
m,
x).hold()));
3529 return filter2(filter(H(
lst{
m},
x).hold()));
3548const cln::cl_N lambda = cln::cl_N(
"319/320");
3550void halfcyclic_convolute(
const std::vector<cln::cl_N>& a,
const std::vector<cln::cl_N>& b, std::vector<cln::cl_N>&
c)
3552 const int size = a.size();
3553 for (
int n=0;
n<size;
n++) {
3555 for (
int m=0;
m<=
n;
m++) {
3563static void initcX(std::vector<cln::cl_N>& crX,
3564 const std::vector<int>& s,
3567 std::vector<cln::cl_N> crB(L2 + 1);
3568 for (
int i=0; i<=L2; i++)
3573 std::vector<std::vector<cln::cl_N>> crG(s.size() - 1, std::vector<cln::cl_N>(L2 + 1));
3574 for (
int m=0;
m < (int)s.size() - 1;
m++) {
3577 for (
int i = 0; i <= L2; i++)
3583 for (std::size_t
m = 0;
m < s.size() - 1;
m++) {
3584 std::vector<cln::cl_N> Xbuf(L2 + 1);
3585 for (
int i = 0; i <= L2; i++)
3586 Xbuf[i] = crX[i] * crG[
m][i];
3588 halfcyclic_convolute(Xbuf, crB, crX);
3594static cln::cl_N crandall_Y_loop(
const cln::cl_N& Sqk,
3595 const std::vector<cln::cl_N>& crX)
3597 cln::cl_F
one = cln::cl_float(1, cln::float_format(
Digits));
3598 cln::cl_N
factor = cln::expt(lambda, Sqk);
3599 cln::cl_N res =
factor / Sqk * crX[0] *
one;
3606 res = res + crX[N] *
factor / (N+Sqk);
3607 }
while (((res != resbuf) || cln::zerop(crX[N])) && (N+1 < crX.size()));
3613static void calc_f(std::vector<std::vector<cln::cl_N>>& f_kj,
3614 const int maxr,
const int L1)
3616 cln::cl_N t0, t1, t2, t3, t4;
3618 auto it = f_kj.begin();
3619 cln::cl_F
one = cln::cl_float(1, cln::float_format(
Digits));
3623 for (
k=1;
k<=L1;
k++) {
3626 for (j=1; j<=maxr; j++) {
3629 for (i=2; i<=j; i++) {
3633 (*it).push_back(t2 * t3 * cln::expt(cln::cl_I(
k),-j) *
one);
3641static cln::cl_N crandall_Z(
const std::vector<int>& s,
3642 const std::vector<std::vector<cln::cl_N>>& f_kj)
3644 const int j = s.size();
3653 t0 = t0 + f_kj[q+j-2][s[0]-1];
3654 }
while ((t0 != t0buf) && (q+j-1 < f_kj.size()));
3659 std::vector<cln::cl_N> t(j);
3666 t[j-1] = t[j-1] + 1 / cln::expt(cln::cl_I(q),s[j-1]);
3667 for (
int k=j-2;
k>=1;
k--) {
3668 t[
k] = t[
k] + t[
k+1] / cln::expt(cln::cl_I(q+j-1-
k), s[
k]);
3670 t[0] = t[0] + t[1] * f_kj[q+j-2][s[0]-1];
3671 }
while ((t[0] != t0buf) && (q+j-1 < f_kj.size()));
3678cln::cl_N zeta_do_sum_Crandall(
const std::vector<int>& s)
3680 std::vector<int>
r = s;
3681 const int j =
r.size();
3696 }
else if (
Digits < 86) {
3698 }
else if (
Digits < 192) {
3700 }
else if (
Digits < 394) {
3702 }
else if (
Digits < 808) {
3704 }
else if (
Digits < 1636) {
3715 for (
int i=0; i<j; i++) {
3722 std::vector<std::vector<cln::cl_N>> f_kj(L1);
3723 calc_f(f_kj, maxr, L1);
3727 std::vector<int> rz;
3730 for (
int k=
r.size()-1;
k>0;
k--) {
3732 rz.insert(rz.begin(),
r.back());
3733 skp1buf = rz.front();
3737 std::vector<cln::cl_N> crX;
3740 for (
int q=0; q<skp1buf; q++) {
3742 cln::cl_N pp1 = crandall_Y_loop(Srun+q-
k, crX);
3743 cln::cl_N pp2 = crandall_Z(rz, f_kj);
3753 rz.front() = skp1buf;
3755 rz.insert(rz.begin(),
r.back());
3757 std::vector<cln::cl_N> crX;
3758 initcX(crX, rz, L2);
3760 res = (res + crandall_Y_loop(S-j, crX)) / r0factorial
3761 + crandall_Z(rz, f_kj);
3767cln::cl_N zeta_do_sum_simple(
const std::vector<int>&
r)
3769 const int j =
r.size();
3772 std::vector<cln::cl_N> t(j);
3773 cln::cl_F
one = cln::cl_float(1, cln::float_format(
Digits));
3780 t[j-1] = t[j-1] +
one / cln::expt(cln::cl_I(q),
r[j-1]);
3781 for (
int k=j-2;
k>=0;
k--) {
3782 t[
k] = t[
k] +
one * t[
k+1] / cln::expt(cln::cl_I(q+j-1-
k),
r[
k]);
3784 }
while (t[0] != t0buf);
3791cln::cl_N zeta_do_Hoelder_convolution(
const std::vector<int>& m_,
const std::vector<int>& s_)
3795 std::vector<int> s = s_;
3796 std::vector<int> m_p = m_;
3797 std::vector<int> m_q;
3799 std::vector<cln::cl_N> s_p(s.size(), cln::cl_N(1));
3800 s_p[0] = s_p[0] * cln::cl_N(
"1/2");
3803 for (std::size_t i = 0; i < s_.size(); i++) {
3810 std::vector<cln::cl_N> s_q;
3811 cln::cl_N signum = 1;
3814 cln::cl_N res = multipleLi_do_sum(m_p, s_p);
3820 if (s.front() > 0) {
3821 if (m_p.front() == 1) {
3822 m_p.erase(m_p.begin());
3823 s_p.erase(s_p.begin());
3824 if (s_p.size() > 0) {
3825 s_p.front() = s_p.front() * cln::cl_N(
"1/2");
3831 m_q.insert(m_q.begin(), 1);
3832 if (s_q.size() > 0) {
3833 s_q.front() = s_q.front() * 2;
3835 s_q.insert(s_q.begin(), cln::cl_N(
"1/2"));
3838 if (m_p.front() == 1) {
3839 m_p.erase(m_p.begin());
3840 cln::cl_N spbuf = s_p.front();
3841 s_p.erase(s_p.begin());
3842 if (s_p.size() > 0) {
3843 s_p.front() = s_p.front() * spbuf;
3846 m_q.insert(m_q.begin(), 1);
3847 if (s_q.size() > 0) {
3848 s_q.front() = s_q.front() * 4;
3850 s_q.insert(s_q.begin(), cln::cl_N(
"1/4"));
3854 m_q.insert(m_q.begin(), 1);
3855 if (s_q.size() > 0) {
3856 s_q.front() = s_q.front() * 2;
3858 s_q.insert(s_q.begin(), cln::cl_N(
"1/2"));
3863 if (m_p.size() == 0)
break;
3865 res = res + signum * multipleLi_do_sum(m_p, s_p) * multipleLi_do_sum(m_q, s_q);
3870 res = res + signum * multipleLi_do_sum(m_q, s_q);
3890 if (is_exactly_a<lst>(
x) && (
x.
nops()>1)) {
3893 const int count =
x.
nops();
3894 const lst& xlst = ex_to<lst>(
x);
3895 std::vector<int>
r(count);
3896 std::vector<int> si(count);
3899 auto it1 = xlst.
begin();
3900 auto it2 =
r.begin();
3901 auto it_swrite = si.begin();
3906 *it2 = ex_to<numeric>(*it1).to_int();
3911 }
while (it2 !=
r.end());
3920 return numeric(zeta_do_Hoelder_convolution(
r, si));
3924 int limit = (
Digits>17) ? 10 : 6;
3925 if ((
r[0] < limit) || ((count > 3) && (
r[1] < limit/2))) {
3926 return numeric(zeta_do_sum_Crandall(
r));
3928 return numeric(zeta_do_sum_simple(
r));
3933 if (is_exactly_a<numeric>(
x) && (
x != 1)) {
3935 return zeta(ex_to<numeric>(
x));
3936 }
catch (
const dunno &e) { }
3945 if (is_exactly_a<lst>(
m)) {
3946 if (
m.nops() == 1) {
3947 return zeta(
m.op(0));
3953 const numeric& y = ex_to<numeric>(
m);
3989 if (is_exactly_a<lst>(
m)) {
3992 return zetaderiv(
_ex1,
m);
4000 if (is_a<lst>(m_)) {
4001 const lst&
m = ex_to<lst>(m_);
4002 auto it =
m.begin();
4005 for (; it !=
m.end(); it++) {
4021 do_not_evalf_params().
4036 if (is_exactly_a<lst>(
x)) {
4039 const int count =
x.
nops();
4040 const lst& xlst = ex_to<lst>(
x);
4041 const lst& slst = ex_to<lst>(s);
4042 std::vector<int> xi(count);
4043 std::vector<int> si(count);
4046 auto it_xread = xlst.
begin();
4047 auto it_sread = slst.
begin();
4048 auto it_xwrite = xi.begin();
4049 auto it_swrite = si.begin();
4054 *it_xwrite = ex_to<numeric>(*it_xread).to_int();
4055 if (*it_sread > 0) {
4064 }
while (it_xwrite != xi.end());
4067 if ((xi[0] == 1) && (si[0] == 1)) {
4072 return numeric(zeta_do_Hoelder_convolution(xi, si));
4082 if (is_exactly_a<lst>(s_)) {
4083 const lst& s = ex_to<lst>(s_);
4084 for (
const auto & it : s) {
4103 if (is_exactly_a<lst>(
m)) {
4107 return zetaderiv(
_ex1,
m);
4117 if (is_a<lst>(m_)) {
4123 if (is_a<lst>(s_)) {
4129 auto itm =
m.begin();
4130 auto its = s.
begin();
4132 c.s <<
"\\overline{";
4140 for (; itm !=
m.end(); itm++, its++) {
4143 c.s <<
"\\overline{";
4159 do_not_evalf_params().
Interface to GiNaC's sums of expressions.
#define GINAC_ASSERT(X)
Assertion macro for checking invariances.
virtual size_t nops() const
Number of operands/members.
const basic & hold() const
Stop further evaluation.
virtual ex map(map_function &f) const
Construct new expression by applying the specified function to all sub-expressions (one level only,...
Wrapper template for making GiNaC classes out of STL containers.
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.
Exception class thrown by classes which provide their own series expansion to signal that ordinary Ta...
Exception class thrown by functions to signal unimplemented functionality so the expression may just ...
Lightweight wrapper for GiNaC's symbolic objects.
ex map(map_function &f) const
const_iterator begin() const noexcept
bool is_equal(const ex &other) const
ex & let_op(size_t i)
Return modifiable operand/member at position i.
const_iterator end() const noexcept
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
void print(const print_context &c, unsigned level=0) const
Print expression to stream.
static unsigned register_new(function_options const &opt)
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
bool info(unsigned inf) const override
Information about the object.
bool is_integer() const
True if object is a non-complex integer.
cln::cl_N to_cl_N() const
Returns a new CLN object of type cl_N, representing the value of *this.
bool is_equal(const numeric &other) const
int to_int() const
Converts numeric types to machine's int.
bool is_zero() const
True if object is zero.
This class holds a two-component object, a basis and and exponent representing exponentiation.
Base class for print_contexts.
This class holds a extended truncated power series (positive and negative integer powers).
This class holds a relation consisting of two expressions and a logical relation between them.
@ no_pattern
disable pattern matching
Interface to GiNaC's constant types and some special constants.
Interface to GiNaC's initially known functions.
Definition of GiNaC's lst.
Interface to GiNaC's products of expressions.
static ex G3_eval(const ex &x_, const ex &s_, const ex &y)
const numeric I
Imaginary unit.
static ex zeta2_evalf(const ex &x, const ex &s)
static ex Li_evalf(const ex &m_, const ex &x_)
const numeric pow(const numeric &x, const numeric &y)
static ex H_deriv(const ex &m_, const ex &x, unsigned deriv_param)
static ex S_eval(const ex &n, const ex &p, const ex &x)
container< std::list > lst
static ex Li_deriv(const ex &m_, const ex &x_, unsigned deriv_param)
std::map< ex, ex, ex_is_less > exmap
const numeric bernoulli(const numeric &nn)
Bernoulli number.
std::vector< expair > epvector
expair-vector
const numeric abs(const numeric &x)
Absolute value.
function zeta(const T1 &p1)
static void S_print_latex(const ex &n, const ex &p, const ex &x, const print_context &c)
static ex S_evalf(const ex &n, const ex &p, const ex &x)
ex conjugate(const ex &thisex)
static ex zeta2_eval(const ex &m, const ex &s_)
const numeric imag(const numeric &x)
const numeric binomial(const numeric &n, const numeric &k)
The Binomial coefficients.
const numeric exp(const numeric &x)
Exponential function.
static ex S_deriv(const ex &n, const ex &p, const ex &x, unsigned deriv_param)
static ex Li_series(const ex &m, const ex &x, const relational &rel, int order, unsigned options)
const numeric factorial(const numeric &n)
Factorial combinatorial function.
unsigned log2(unsigned n)
Integer binary logarithm.
static void H_print_latex(const ex &m_, const ex &x, const print_context &c)
const constant Pi("Pi", PiEvalf, "\\pi", domain::positive)
Pi.
static ex Li_eval(const ex &m_, const ex &x_)
static ex H_series(const ex &m, const ex &x, const relational &rel, int order, unsigned options)
static void Li_print_latex(const ex &m_, const ex &x_, const print_context &c)
static ex zeta1_eval(const ex &m)
static ex G2_eval(const ex &x_, const ex &y)
const numeric log(const numeric &x)
Natural logarithm.
ex evalf(const ex &thisex)
_numeric_digits Digits
Accuracy in decimal digits.
bool is_real(const numeric &x)
ex op(const ex &thisex, size_t i)
static void zeta1_print_latex(const ex &m_, const print_context &c)
const constant Catalan("Catalan", CatalanEvalf, "G", domain::positive)
Catalan's constant.
static ex zeta2_deriv(const ex &m, const ex &s, unsigned deriv_param)
static void zeta2_print_latex(const ex &m_, const ex &s_, const print_context &c)
static ex G2_evalf(const ex &x_, const ex &y)
static ex S_series(const ex &n, const ex &p, const ex &x, const relational &rel, int order, unsigned options)
ex factor(const ex &poly, unsigned options)
Interface function to the outside world.
int to_int(const numeric &x)
ex convert_H_to_Li(const ex ¶meterlst, const ex &arg)
Converts a given list containing parameters for H in Remiddi/Vermaseren notation into the correspondi...
static ex H_evalf(const ex &x1, const ex &x2)
REGISTER_FUNCTION(conjugate_function, eval_func(conjugate_eval). evalf_func(conjugate_evalf). expl_derivative_func(conjugate_expl_derivative). info_func(conjugate_info). print_func< print_latex >(conjugate_print_latex). conjugate_func(conjugate_conjugate). real_part_func(conjugate_real_part). imag_part_func(conjugate_imag_part). set_name("conjugate","conjugate"))
static ex G3_evalf(const ex &x_, const ex &s_, const ex &y)
static ex zeta1_evalf(const ex &x)
std::vector< ex > exvector
static ex zeta1_deriv(const ex &m, unsigned deriv_param)
static ex H_eval(const ex &m_, const ex &x)
numeric step(const numeric &x)
function G(const T1 &x, const T2 &y)
ex expand(const ex &thisex, unsigned options=0)
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.
Interface to relations between expressions.
Interface to GiNaC's symbolic objects.
Interface to several small and furry utilities needed within GiNaC but not of any interest to the use...
Interface to GiNaC's wildcard objects.