From: Jens Vollinga Date: Sat, 17 Apr 2004 16:11:37 +0000 (+0000) Subject: Synced bug-fix to 1.2 X-Git-Tag: release_1-2-1~6 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=commitdiff_plain;h=57e3d68a23f298ee042919608d10c97086a28857;p=ginac.git Synced bug-fix to 1.2 --- diff --git a/check/exam_pseries.cpp b/check/exam_pseries.cpp index 7ec803f8..93d78684 100644 --- a/check/exam_pseries.cpp +++ b/check/exam_pseries.cpp @@ -124,6 +124,11 @@ static unsigned exam_series1() d = pow(x, 2) + Order(pow(x, 3)); result += check_series(e, 0, d, 3); + symbol b("b"); + e = log(a*x + b*x*x*log(x)); + d = log(a*x) + b/a*log(x)*x - pow(b/a, 2)/2*pow(log(x)*x, 2) + Order(pow(x, 3)); + result += check_series(e, 0, d, 3); + return result; } diff --git a/ginac/inifcns_trans.cpp b/ginac/inifcns_trans.cpp index 7df32121..872308b9 100644 --- a/ginac/inifcns_trans.cpp +++ b/ginac/inifcns_trans.cpp @@ -201,6 +201,22 @@ static ex log_series(const ex &arg, // in this case n more (or less) terms are needed // (sadly, to generate them, we have to start from the beginning) const ex newarg = ex_to((arg/coeff).series(rel, order+n, options)).shift_exponents(-n).convert_to_poly(true); + if (n == 0 && coeff == 1) { + epvector epv; + ex acc = (new pseries(rel, epv))->setflag(status_flags::dynallocated); + epv.reserve(2); + epv.push_back(expair(-1, _ex0)); + epv.push_back(expair(Order(_ex1), order)); + ex rest = pseries(rel, epv).add_series(argser); + for (int i = order-1; i>0; --i) { + epvector cterm; + cterm.reserve(1); + cterm.push_back(expair(i%2 ? _ex1/i : _ex_1/i, _ex0)); + acc = pseries(rel, cterm).add_series(ex_to(acc)); + acc = (ex_to(rest)).mul_series(ex_to(acc)); + } + return acc; + } return pseries(rel, seq).add_series(ex_to(log(newarg).series(rel, order, options))); } else // it was a monomial return pseries(rel, seq);