]> www.ginac.de Git - ginac.git/blobdiff - ginac/pseries.cpp
Fix power::subs() in some special cases.
[ginac.git] / ginac / pseries.cpp
index 0d7b073b06a8b35030b32a5d30c28e912ddd1d0f..fbc849c4c27fa3534c7cf0f0a071d3de6f1ff092 100644 (file)
@@ -4,7 +4,7 @@
  *  methods for series expansion. */
 
 /*
- *  GiNaC Copyright (C) 1999-2019 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2022 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -394,17 +394,7 @@ ex pseries::collect(const ex &s, bool distributed) const
 /** Perform coefficient-wise automatic term rewriting rules in this class. */
 ex pseries::eval() const
 {
-       if (flags & status_flags::evaluated) {
-               return *this;
-       }
-
-       // Construct a new series with evaluated coefficients
-       epvector new_seq;
-       new_seq.reserve(seq.size());
-       for (auto & it : seq)
-               new_seq.emplace_back(expair(it.rest, it.coeff));
-
-       return dynallocate<pseries>(relational(var,point), std::move(new_seq)).setflag(status_flags::evaluated);
+       return hold();
 }
 
 /** Evaluate coefficients numerically. */
@@ -414,7 +404,7 @@ ex pseries::evalf() const
        epvector new_seq;
        new_seq.reserve(seq.size());
        for (auto & it : seq)
-               new_seq.emplace_back(expair(it.rest, it.coeff));
+               new_seq.emplace_back(expair(it.rest.evalf(), it.coeff));
 
        return dynallocate<pseries>(relational(var,point), std::move(new_seq)).setflag(status_flags::evaluated);
 }
@@ -901,7 +891,7 @@ ex mul::series(const relational & r, int order, unsigned options) const
                bool flag_redo = false;
                try {
                        real_ldegree = buf.expand().ldegree(sym-r.rhs());
-               } catch (std::runtime_error) {}
+               } catch (std::runtime_error &) {}
 
                if (real_ldegree == 0) {
                        if ( factor < 0 ) {
@@ -1090,14 +1080,14 @@ ex power::series(const relational & r, int order, unsigned options) const
        bool must_expand_basis = false;
        try {
                basis.subs(r, subs_options::no_pattern);
-       } catch (pole_error) {
+       } catch (pole_error &) {
                must_expand_basis = true;
        }
 
        bool exponent_is_regular = true;
        try {
                exponent.subs(r, subs_options::no_pattern);
-       } catch (pole_error) {
+       } catch (pole_error &) {
                exponent_is_regular = false;
        }
 
@@ -1166,7 +1156,7 @@ ex power::series(const relational & r, int order, unsigned options) const
        ex result;
        try {
                result = ex_to<pseries>(e).power_const(numexp, order);
-       } catch (pole_error) {
+       } catch (pole_error &) {
                epvector ser { expair(Order(_ex1), order) };
                result = pseries(r, std::move(ser));
        }