]> www.ginac.de Git - ginac.git/commitdiff
- series expansion of pseries objects should now work as expected
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Tue, 8 Feb 2000 18:18:39 +0000 (18:18 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Tue, 8 Feb 2000 18:18:39 +0000 (18:18 +0000)
ginac/pseries.cpp
ginac/pseries.h

index 7fbf73113a74f293c3cca3b151083ff29dfa2bb9..9b6f64a944a788606cd3c11a0ce5f3981fca7087 100644 (file)
@@ -689,6 +689,31 @@ ex power::series(const symbol & s, const ex & point, int order) const
 }
 
 
+/** Re-expansion of a pseries object. */
+ex pseries::series(const symbol & s, const ex & p, int order) const
+{
+       if (var.is_equal(s) && point.is_equal(p)) {
+               if (order > degree(s))
+                       return *this;
+               else {
+               epvector new_seq;
+               epvector::const_iterator it = seq.begin(), itend = seq.end();
+                       while (it != itend) {
+                               int o = ex_to_numeric(it->coeff).to_int();
+                               if (o >= order) {
+                                       new_seq.push_back(expair(Order(_ex1()), o));
+                                       break;
+                               }
+                               new_seq.push_back(*it);
+                               it++;
+                       }
+                       return pseries(var, point, new_seq);
+               }
+       } else
+               return convert_to_poly().series(s, p, order);
+}
+
+
 /** Compute the truncated series expansion of an expression.
  *  This function returns an expression containing an object of class pseries to
  *  represent the series. If the series does not terminate within the given
index 046c838e05c91a352d5361b8c8e42bf000e7adca..ff575bbedf464955ff919c599c966758fefb6295 100644 (file)
@@ -65,6 +65,7 @@ public:
     ex coeff(const symbol &s, int n=1) const;
     ex eval(int level=0) const;
     ex evalf(int level=0) const;
+    ex series(const symbol & s, const ex & p, int order) const;
     ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
     ex subs(const lst & ls, const lst & lr) const;
 protected: