From b190e692c644774f17b38e4ab6371a36ff3c42a4 Mon Sep 17 00:00:00 2001 From: Jens Vollinga Date: Sat, 17 Apr 2004 16:13:45 +0000 Subject: [PATCH] Synced bug-fix to 1.1 --- check/exam_pseries.cpp | 5 +++++ ginac/inifcns_trans.cpp | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) 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 806ed3aa..070fdc15 100644 --- a/ginac/inifcns_trans.cpp +++ b/ginac/inifcns_trans.cpp @@ -194,6 +194,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); -- 2.50.0