X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Fexam_inifcns_nstdsums.cpp;h=b836ee4f307d69024448509fa9f28bb42570314a;hp=d0f6869effc033164f24f9d7a40e1764c4f2fe3e;hb=dbde7117e88ba61597d6fee18615fe396c291a87;hpb=1254f5ef941aa6ead793e843b637edc927f47c7d diff --git a/check/exam_inifcns_nstdsums.cpp b/check/exam_inifcns_nstdsums.cpp index d0f6869e..b836ee4f 100644 --- a/check/exam_inifcns_nstdsums.cpp +++ b/check/exam_inifcns_nstdsums.cpp @@ -4,7 +4,7 @@ * functions. */ /* - * GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2010 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 @@ -21,12 +21,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include #include "ginac.h" -using namespace std; using namespace GiNaC; +#include +#include +using namespace std; //////////////////////////////////////////////////////////////////////////////// @@ -80,7 +80,7 @@ static unsigned inifcns_test_S() int digitsbuf = Digits; // precision of data Digits = 22; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); unsigned result = 0; @@ -125,9 +125,10 @@ static unsigned inifcns_test_S() static unsigned inifcns_test_HLi() { + using GiNaC::log; int digitsbuf = Digits; Digits = 17; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); numeric almostone("0.999999999999999999"); unsigned result = 0; @@ -198,7 +199,7 @@ static unsigned inifcns_test_zeta() for (lst::const_iterator it = res.begin(); it != res.end(); it++) { Digits = 17; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); ex diff = abs((*it).evalf()); if (diff > prec) { clog << *it << " seems to be wrong: " << diff << endl; @@ -207,7 +208,7 @@ static unsigned inifcns_test_zeta() } cout << "." << flush; Digits = 40; - prec = 5 * pow(10, -(int)Digits); + prec = 5 * pow(10, -(ex)Digits); diff = abs((*it).evalf()); if (diff > prec) { clog << *it << " seems to be wrong: " << diff << endl; @@ -234,7 +235,7 @@ static unsigned inifcns_test_LiG() { int digitsbuf = Digits; Digits = 17; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); numeric almostone("0.99999999999999999999"); unsigned result = 0; @@ -300,7 +301,7 @@ static unsigned inifcns_test_LiG() static unsigned inifcns_test_legacy() { Digits = 17; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); unsigned result = 0; @@ -310,6 +311,57 @@ static unsigned inifcns_test_legacy() result++; } + ex x1 = exp(2*Pi*I/13).evalf(); + ex x2 = exp(24*Pi*I/13).evalf(); + ex r2 = Li(lst(2),lst(x1)).hold().evalf(); + ex r3 = Li(lst(2),lst(x2)).hold().evalf(); + if ( abs(r2-conjugate(r3)) > prec ) { + clog << "Legacy test 2 seems to be wrong." << endl; + result++; + } + + ex x3 = exp(5*Pi*I/3).evalf(); + ex r4 = Li(lst(3),lst(x3)).hold().evalf(); + if ( abs(r4 - numeric("0.40068563438653142847-0.95698384815740185713*I")) > prec ) { + clog << "Legacy test 3 seems to be wrong." << endl; + result++; + } + + Digits = 100; + prec = 5 * pow(10, -(ex)Digits); + ex x0 = 1.; + x1 = exp(Pi*I/3).evalf(); + x2 = exp(2*Pi*I/3).evalf(); + x3 = -1.; + ex x4 = exp(4*Pi*I/3).evalf(); + ex x5 = exp(5*Pi*I/3).evalf(); + + ex r5 = Li(lst(1,1,1,1),lst(x2,x4,x3,x0)).hold().evalf(); + ex r6 = Li(lst(1,1,1,1),lst(x4,x2,x3,x0)).hold().evalf(); + if ( abs(r5-conjugate(r6)) > prec ) { + clog << "Legacy test 4 seems to be wrong." << endl; + result++; + } + + ex r7 = Li(lst(1,2,1),lst(x3,x2,x4)).hold().evalf() + +Li(lst(1,1,2),lst(x3,x2,x4)).hold().evalf() + +Li(lst(1,1,1,1),lst(x3,x0,x2,x4)).hold().evalf() + +Li(lst(1,1,1,1),lst(x3,x2,x0,x4)).hold().evalf() + +Li(lst(1,1,1,1),lst(x3,x2,x4,x0)).hold().evalf() + +Li(lst(1,2,1),lst(x2,x1,x0)).hold().evalf() + +Li(lst(1,1,2),lst(x2,x3,x4)).hold().evalf() + +Li(lst(1,1,1,1),lst(x2,x4,x3,x0)).hold().evalf() + +Li(lst(1,1,1,1),lst(x2,x3,x4,x0)).hold().evalf() + +Li(lst(1,1,1,1),lst(x2,x3,x0,x4)).hold().evalf() + +Li(lst(2,2),lst(x5,x4)).hold().evalf() + +Li(lst(2,1,1),lst(x5,x0,x4)).hold().evalf() + +Li(lst(2,1,1),lst(x5,x4,x0)).hold().evalf() + -Li(lst(1,1),lst(x3,x0)).hold().evalf()*Li(lst(1,1),lst(x2,x4)).hold().evalf(); + if ( abs(r7) > prec ) { + clog << "Legacy test 5 seems to be wrong." << endl; + result++; + } + return result; }