fixed another power::series() bug [Alexei Sheplyakov]
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Wed, 6 Oct 2004 15:59:20 +0000 (15:59 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Wed, 6 Oct 2004 15:59:20 +0000 (15:59 +0000)
check/exam_pseries.cpp
ginac/pseries.cpp

index 040c5e5..1e34be7 100644 (file)
@@ -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;
 }
 
index 993eacf..4ec5bce 100644 (file)
@@ -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<add>(basis))
+       if (!must_expand_basis && !exponent.info(info_flags::negint)
+        && (!is_a<add>(basis) || !is_a<numeric>(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<add>(basis))
+       if (!must_expand_basis && !basis.subs(r, subs_options::no_pattern).is_zero()
+        && (!is_a<add>(basis) || !is_a<numeric>(exponent)))
                return basic::series(r, order, options);
 
        // Singularity encountered, is the basis equal to (var - point)?