return (new pseries(relational(var,point), new_seq))->setflag(status_flags::dynallocated | status_flags::evaluated);
}
-ex pseries::subs(const lst & ls, const lst & lr, unsigned options) const
+ex pseries::subs(const exmap & m, unsigned options) const
{
// If expansion variable is being substituted, convert the series to a
// polynomial and do the substitution there because the result might
// no longer be a power series
- if (ls.has(var))
- return convert_to_poly(true).subs(ls, lr, options);
+ if (m.find(var) != m.end())
+ return convert_to_poly(true).subs(m, options);
// Otherwise construct a new series with substituted coefficients and
// expansion point
newseq.reserve(seq.size());
epvector::const_iterator it = seq.begin(), itend = seq.end();
while (it != itend) {
- newseq.push_back(expair(it->rest.subs(ls, lr, options), it->coeff));
+ newseq.push_back(expair(it->rest.subs(m, options), it->coeff));
++it;
}
- return (new pseries(relational(var,point.subs(ls, lr, options)), newseq))->setflag(status_flags::dynallocated);
+ return (new pseries(relational(var,point.subs(m, options)), newseq))->setflag(status_flags::dynallocated);
}
/** Implementation of ex::expand() for a power series. It expands all the
epvector seq;
numeric fac = 1;
ex deriv = *this;
- ex coeff = deriv.subs(r);
+ ex coeff = deriv.subs(r, subs_options::no_pattern);
const symbol &s = ex_to<symbol>(r.lhs());
if (!coeff.is_zero())
if (deriv.is_zero()) // Series terminates
return pseries(r, seq);
- coeff = deriv.subs(r);
+ coeff = deriv.subs(r, subs_options::no_pattern);
if (!coeff.is_zero())
seq.push_back(expair(fac.inverse() * coeff, n));
}
// Basis is not a series, may there be a singularity?
bool must_expand_basis = false;
try {
- basis.subs(r);
+ basis.subs(r, subs_options::no_pattern);
} catch (pole_error) {
must_expand_basis = true;
}
return basic::series(r, order, options);
// Is the expression of type 0^something?
- if (!must_expand_basis && !basis.subs(r).is_zero())
+ if (!must_expand_basis && !basis.subs(r, subs_options::no_pattern).is_zero())
return basic::series(r, order, options);
// Singularity encountered, is the basis equal to (var - point)?