In sage it is fairly easy to do a Taylor expansion of an unknown function f(x),

x = var('x')
h = var('h')
f = function('f',x)
g1 = taylor(f,x,h,2)

How can this be done in sympy?


Update

asmeurer points out that this is a feature which will be available soon in sympy from the pull request http://github.com/sympy/sympy/pull/1888. I installed the branch using pip,

pip install -e git+git@github.com:renatocoutinho/sympy.git@897b#egg=sympy --upgrade

However, when I try to calculate the series of f(x),

x, h = symbols("x,h")
f = Function("f")
series(f,x,x+h)

I get the following error,

TypeError: unbound method series() must be called with f instance as first argument (got Symbol instance instead)

Edit
Report