]> www.ginac.de Git - ginac.git/commitdiff
- ex::series() catches and re-throws exceptions happening during expansion
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Mon, 13 Mar 2000 19:21:20 +0000 (19:21 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Mon, 13 Mar 2000 19:21:20 +0000 (19:21 +0000)
  (almost always caused by expansion of unhandled poles)
- series(log(x),x) now returns log(x) instead of an error

ginac/inifcns_trans.cpp
ginac/pseries.cpp

index 14921f46cccd3eec28084c7d3c82b6f413ca521c..87a77cb2b97e1c0a42755b09ec2184f7923b920f 100644 (file)
@@ -31,6 +31,7 @@
 #include "power.h"
 #include "relational.h"
 #include "symbol.h"
 #include "power.h"
 #include "relational.h"
 #include "symbol.h"
+#include "pseries.h"
 #include "utils.h"
 
 #ifndef NO_NAMESPACE_GINAC
 #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());
 }
 
     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).
 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)
 
 //////////
 // sine (trigonometric function)
index a091000e0318e2eafcbbb836038dcf71280fe14d..4faa7200c8551a161fa700ae80c0a5b4c0b09342 100644 (file)
@@ -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);
 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;
 }
 
 
 }