Synced to HEAD.
authorJens Vollinga <vollinga@thep.physik.uni-mainz.de>
Thu, 11 Mar 2004 16:01:26 +0000 (16:01 +0000)
committerJens Vollinga <vollinga@thep.physik.uni-mainz.de>
Thu, 11 Mar 2004 16:01:26 +0000 (16:01 +0000)
check/exam_pseries.cpp
ginac/pseries.cpp

index 8ecbe7accbb43aba3f9b92e4f93f2a1d911c2fc4..7b4473469a2a14c6c075a3812f45aa118bbe58cc 100644 (file)
@@ -115,6 +115,11 @@ static unsigned exam_series1()
            + Order(pow(x, 2));
        result += check_series(e, 0, d, 2);
        
+       symbol a("a");
+       e = pow(x, 4) * sin(a) + pow(x, 2);
+       d = pow(x, 2) + Order(pow(x, 3));
+       result += check_series(e, 0, d, 3);
+
        return result;
 }
 
index 607360e757d451cc04981100f4978327932838b1..d799e62b132a576b23430298a2237b09b0b5eef7 100644 (file)
@@ -529,9 +529,10 @@ bool pseries::is_terminating() const
 ex basic::series(const relational & r, int order, unsigned options) const
 {
        epvector seq;
+       const symbol &s = ex_to<symbol>(r.lhs());
 
        // default for order-values that make no sense for Taylor expansion
-       if (order <= 0) {
+       if ((order <= 0) && this->has(s)) {
                seq.push_back(expair(Order(_ex1), order));
                return pseries(r, seq);
        }
@@ -540,8 +541,7 @@ ex basic::series(const relational & r, int order, unsigned options) const
        numeric fac = 1;
        ex deriv = *this;
        ex coeff = deriv.subs(r, subs_options::no_pattern);
-       const symbol &s = ex_to<symbol>(r.lhs());
-       
+
        if (!coeff.is_zero()) {
                seq.push_back(expair(coeff, _ex0));
        }