From 846e62e85c483f74d1e253c7841050ea11d70451 Mon Sep 17 00:00:00 2001 From: Jens Vollinga Date: Thu, 11 Mar 2004 16:01:26 +0000 Subject: [PATCH] Synced to HEAD. --- check/exam_pseries.cpp | 5 +++++ ginac/pseries.cpp | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/check/exam_pseries.cpp b/check/exam_pseries.cpp index 8ecbe7ac..7b447346 100644 --- a/check/exam_pseries.cpp +++ b/check/exam_pseries.cpp @@ -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; } diff --git a/ginac/pseries.cpp b/ginac/pseries.cpp index 607360e7..d799e62b 100644 --- a/ginac/pseries.cpp +++ b/ginac/pseries.cpp @@ -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(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(r.lhs()); - + if (!coeff.is_zero()) { seq.push_back(expair(coeff, _ex0)); } -- 2.25.4