From c572a2717d00f8aca375862d2fd4a7d82a2e2a28 Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Wed, 6 Oct 2004 16:03:22 +0000 Subject: [PATCH] synced to HEAD (series bugfix) --- NEWS | 1 + check/exam_pseries.cpp | 4 ++++ ginac/pseries.cpp | 6 ++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 37b6c5fc..914c986a 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ This file records noteworthy changes. 1.2.4 () * binomial(n, k) evaluates for non-integer arguments n. +* Fixed another bug in the series expansion of powers. 1.2.3 (13 August 2004) * Added variants of dirac_trace() and color_trace() that take the trace over 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.44.0