From: Christian Bauer Date: Mon, 13 Mar 2000 19:21:20 +0000 (+0000) Subject: - ex::series() catches and re-throws exceptions happening during expansion X-Git-Tag: release_0-5-4~9 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=af8a306646b51b66a0bbe325326059f814f81289;ds=sidebyside - ex::series() catches and re-throws exceptions happening during expansion (almost always caused by expansion of unhandled poles) - series(log(x),x) now returns log(x) instead of an error --- diff --git a/ginac/inifcns_trans.cpp b/ginac/inifcns_trans.cpp index 14921f46..87a77cb2 100644 --- a/ginac/inifcns_trans.cpp +++ b/ginac/inifcns_trans.cpp @@ -31,6 +31,7 @@ #include "power.h" #include "relational.h" #include "symbol.h" +#include "pseries.h" #include "utils.h" #ifndef NO_NAMESPACE_GINAC @@ -143,9 +144,20 @@ static ex log_deriv(const ex & x, unsigned deriv_param) return power(x, _ex_1()); } +static ex log_series(const ex & x, const symbol & s, const ex & pt, int order) +{ + if (x.subs(s == pt).is_zero()) { + epvector seq; + seq.push_back(expair(log(x), _ex0())); + return pseries(s, pt, seq); + } else + throw do_taylor(); +} + REGISTER_FUNCTION(log, eval_func(log_eval). evalf_func(log_evalf). - derivative_func(log_deriv)); + derivative_func(log_deriv). + series_func(log_series)); ////////// // sine (trigonometric function) diff --git a/ginac/pseries.cpp b/ginac/pseries.cpp index a091000e..4faa7200 100644 --- a/ginac/pseries.cpp +++ b/ginac/pseries.cpp @@ -763,7 +763,13 @@ ex pseries::series(const symbol & s, const ex & p, int order) const ex ex::series(const symbol &s, const ex &point, int order) const { GINAC_ASSERT(bp!=0); - return bp->series(s, point, order); + ex e; + try { + e = bp->series(s, point, order); + } catch (exception &x) { + throw (std::logic_error(string("unable to compute series (") + x.what() + ")")); + } + return e; }