Hello
I have this derivative of a function that has an argument which is also a function
# Declaration
x = symbols('x')
U, Theta = symbols('U Theta', cls=Function)
# Function to derive
obj_function = Theta(U(x),x)
# Derivative
gradient_obj_function = obj_function.diff(x)
And this is the output I obtain
Derivative(Theta(U(x), x), x) + Derivative(U(x), x)*Subs(Derivative(Theta(_xi_1, x), _xi_1), (_xi_1,), (U(x),))
How can I replace Subs(Derivative(Theta(_xi_1, x), _xi_1), (_xi_1,), (U(x),)) with Derivative(Theta(U(x), x), U(x)) ?
Thanks
Miguel