f(x) = f(x0) + (x-x0)*f(x).diff(x)|x=x0 + ....

Is there any reason not to allow that rhs as the return for 
>>> f(x).series(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sympy\core\expr.py", line 2341, in series
    s = self.subs(x, rep).series(x, x0=0, n=n, dir='+')
  File "sympy\core\expr.py", line 2354, in series
    s1 = self._eval_nseries(x, n=n, logx=None)
  File "sympy\core\function.py", line 447, in _eval_nseries
    supported.'''))
NotImplementedError:
series for user-defined functions are not supported.

Maybe it could return something like this:

>>> def fseries(eq, x0, n):
...   return Add(*[(x - x0)**i*Subs(eq.diff(x, i), x, x0) for i in range(n 
+ 1)])

>>> pprint(fseries(f(x), 1, 2).doit())
         /  2      \|
       2 | d       ||              /d       \|
(x - 1) *|---(f(x))||    + (x - 1)*|--(f(x))||    + f(1)
         |  2      ||              \dx      /|x=1
         \dx       /|x=1

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to