How to substitute a function within derivatives?
I want to simplify an ODE by making a substitution, say g(x) -> h(x)*x, but can't get it to work. I tried:
g=function('g', x)
h=function('h', x)
dg = g.diff(x)
dg
sage output: D[0](g)(x)
dg.subs(g==h*x)
sage output: D[0](g)(x)
The substitution is not done for the g function within derivatives. I tried dg.subs(g(x)==h(x)*x) too, got deprecation warnings and the same results. How can I make this work? This is a simplified example, in reality, instead of dg, I have the lhs of an ODE defined interms of g(x).
Thanks