Python sympy: Expressions with an undefined function whose value at zero is known

26 Views Asked by At

I'm trying to evaluate an expression in sympy using a function $f(x)$. The function is unknown, but its value at $0$ is known $f(0)=0$. If it's any help, specifically I want to evaluate the Taylor series of f(x)'s inverse using Lagrange's Inversion Theorem.

This means I want to evaluate $$\frac{d^n}{dx^n} \Big(\frac{x}{f(x)}\Big)^n \Big|_{x=0}$$

Obviously, L'Hopital's rule should be applied, and often, but using subs(<expression>, x, 0), sympy discards all terms with a nominator with $x$ as equalling $0$, ignoring that the denominator, with $f(x)$ might be also $0$. The result is trivial and wrong.

What can I do for a right treatment of my question?