Taking derivative of abstract function pattern in sympy

I want to compute a derivative of an expression involving an abstract function like xg(x) or the mixed partial of xg(x)/(g(x)+g(y)).

Based on the original python docs here, I tried:

using SymPy
x = symbols("x")
h = function("h")
diff(x*h(x))

But the line h=function("h") is giving me an error:
syntax: expected "(" in function definition

Any suggestions? Thanks

Try: h = SymFunction("h").

2 Likes