X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Fexam_pseries.cpp;h=8bd785a623ace37925cee58d1e8cda521d7ce9ae;hp=4e4b397667b8b1b40d1d0a0388878d9fe12243a7;hb=e2627379c98aeafae903cc2f04bdbdc9defa34f7;hpb=f062dffbb7498279b137eb9aa1ab3b6a1ddb83c1 diff --git a/check/exam_pseries.cpp b/check/exam_pseries.cpp index 4e4b3976..8bd785a6 100644 --- a/check/exam_pseries.cpp +++ b/check/exam_pseries.cpp @@ -3,7 +3,7 @@ * Series expansion test (Laurent and Taylor series). */ /* - * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2003 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 @@ -27,20 +27,22 @@ static symbol x("x"); static unsigned check_series(const ex &e, const ex &point, const ex &d, int order = 8) { ex es = e.series(x==point, order); - ex ep = ex_to_pseries(es).convert_to_poly(); + ex ep = ex_to(es).convert_to_poly(); if (!(ep - d).is_zero()) { clog << "series expansion of " << e << " at " << point << " erroneously returned " << ep << " (instead of " << d << ")" << endl; - (ep-d).printtree(clog); + clog << tree << (ep-d) << dflt; return 1; } return 0; } // Series expansion -static unsigned exam_series1(void) +static unsigned exam_series1() { + using GiNaC::log; + unsigned result = 0; ex e, d; @@ -98,11 +100,16 @@ static unsigned exam_series1(void) d = 1 + t + pow(t, 2) / 2 + pow(t, 3) / 6 + pow(t, 4) / 24 + pow(t, 5) / 120 + pow(t, 6) / 720 + pow(t, 7) / 5040 + Order(pow(x, 8)); result += check_series(e, 0, d.expand()); + e = log(x); + d = e; + result += check_series(e, 0, d, 1); + result += check_series(e, 0, d, 2); + return result; } // Series addition -static unsigned exam_series2(void) +static unsigned exam_series2() { unsigned result = 0; ex e, d; @@ -115,7 +122,7 @@ static unsigned exam_series2(void) } // Series multiplication -static unsigned exam_series3(void) +static unsigned exam_series3() { unsigned result = 0; ex e, d; @@ -128,7 +135,7 @@ static unsigned exam_series3(void) } // Series exponentiation -static unsigned exam_series4(void) +static unsigned exam_series4() { unsigned result = 0; ex e, d; @@ -145,7 +152,7 @@ static unsigned exam_series4(void) } // Order term handling -static unsigned exam_series5(void) +static unsigned exam_series5() { unsigned result = 0; ex e, d; @@ -165,7 +172,7 @@ static unsigned exam_series5(void) } // Series expansion of tgamma(-1) -static unsigned exam_series6(void) +static unsigned exam_series6() { ex e = tgamma(2*x); ex d = pow(x+1,-1)*numeric(1,4) + @@ -197,7 +204,7 @@ static unsigned exam_series6(void) } // Series expansion of tan(x==Pi/2) -static unsigned exam_series7(void) +static unsigned exam_series7() { ex e = tan(x*Pi/2); ex d = pow(x-1,-1)/Pi*(-2) + pow(x-1,1)*Pi/6 + pow(x-1,3)*pow(Pi,3)/360 @@ -207,7 +214,7 @@ static unsigned exam_series7(void) } // Series expansion of log(sin(x==0)) -static unsigned exam_series8(void) +static unsigned exam_series8() { ex e = log(sin(x)); ex d = log(x) - pow(x,2)/6 - pow(x,4)/180 - pow(x,6)/2835 @@ -216,7 +223,7 @@ static unsigned exam_series8(void) } // Series expansion of Li2(sin(x==0)) -static unsigned exam_series9(void) +static unsigned exam_series9() { ex e = Li2(sin(x)); ex d = x + pow(x,2)/4 - pow(x,3)/18 - pow(x,4)/48 @@ -226,8 +233,10 @@ static unsigned exam_series9(void) } // Series expansion of Li2((x==2)^2), caring about branch-cut -static unsigned exam_series10(void) +static unsigned exam_series10() { + using GiNaC::log; + ex e = Li2(pow(x,2)); ex d = Li2(4) + (-log(3) + I*Pi*csgn(I-I*pow(x,2))) * (x-2) + (numeric(-2,3) + log(3)/4 - I*Pi/4*csgn(I-I*pow(x,2))) * pow(x-2,2) @@ -238,8 +247,10 @@ static unsigned exam_series10(void) } // Series expansion of logarithms around branch points -static unsigned exam_series11(void) +static unsigned exam_series11() { + using GiNaC::log; + unsigned result = 0; ex e, d; symbol a("a"); @@ -278,8 +289,10 @@ static unsigned exam_series11(void) } // Series expansion of other functions around branch points -static unsigned exam_series12(void) +static unsigned exam_series12() { + using GiNaC::log; + unsigned result = 0; ex e, d; @@ -304,7 +317,7 @@ static unsigned exam_series12(void) } -unsigned exam_pseries(void) +unsigned exam_pseries() { unsigned result = 0;