From f4f7f966d313edf65d46216c7eb48d0791c6537c Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Wed, 6 Oct 2004 15:59:20 +0000 Subject: [PATCH] fixed another power::series() bug [Alexei Sheplyakov] --- check/exam_pseries.cpp | 4 ++++ ginac/pseries.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/check/exam_pseries.cpp b/check/exam_pseries.cpp index 040c5e58..1e34be78 100644 --- a/check/exam_pseries.cpp +++ b/check/exam_pseries.cpp @@ -133,6 +133,10 @@ static unsigned exam_series1() 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); + e = pow((x+a), b); + d = pow(a, b) + (pow(a, b)*b/a)*x + (pow(a, b)*b*b/a/a/2 - pow(a, b)*b/a/a/2)*pow(x, 2) + Order(pow(x, 3)); + result += check_series(e, 0, d, 3); + return result; } diff --git a/ginac/pseries.cpp b/ginac/pseries.cpp index 993eacf1..4ec5bcef 100644 --- a/ginac/pseries.cpp +++ b/ginac/pseries.cpp @@ -952,11 +952,13 @@ ex power::series(const relational & r, int order, unsigned options) const } // Is the expression of type something^(-int)? - if (!must_expand_basis && !exponent.info(info_flags::negint) && !is_a(basis)) + if (!must_expand_basis && !exponent.info(info_flags::negint) + && (!is_a(basis) || !is_a(exponent))) return basic::series(r, order, options); // Is the expression of type 0^something? - if (!must_expand_basis && !basis.subs(r, subs_options::no_pattern).is_zero() && !is_a(basis)) + if (!must_expand_basis && !basis.subs(r, subs_options::no_pattern).is_zero() + && (!is_a(basis) || !is_a(exponent))) return basic::series(r, order, options); // Singularity encountered, is the basis equal to (var - point)? -- 2.25.4