- if (x.subs(r).is_zero()) {
- epvector seq;
- seq.push_back(expair(log(x), _ex0()));
- return pseries(r, seq);
- } else
- throw do_taylor();
+ const ex x_pt = x.subs(rel);
+ if (!x_pt.info(info_flags::negative) && !x_pt.is_zero())
+ throw do_taylor(); // caught by function::series()
+ // now we either have to care for the branch cut or the branch point:
+ if (x_pt.is_zero()) { // branch point: return a plain log(x).
+ epvector seq;
+ seq.push_back(expair(log(x), _ex0()));
+ return pseries(rel, seq);
+ } // on the branch cut:
+ const ex point = rel.rhs();
+ const symbol *s = static_cast<symbol *>(rel.lhs().bp);
+ const symbol foo;
+ // compute the formal series:
+ ex replx = series(log(x),*s==foo,order).subs(foo==point);
+ epvector seq;
+ seq.push_back(expair(-I*csgn(x*I)*Pi,_ex0()));
+ seq.push_back(expair(Order(_ex1()),order));
+ return series(replx - I*Pi + pseries(rel, seq),rel,order);