There is an inconsistency when substituting things in an expression where they are being differentiated:
@vars x
@funs f, g
gee = diff(f(x), x)
diff(g(x), x)(g(x)=>1) # 0
diff(gee, x)(gee=>1) # f_xx
Here we can imagine that g = f', and so the last two lines should be equivalent. It makes sense that if an expression is constant its derivative becomes 0, so this should be the case also when the expression is itself a derivative. Though multivariate functions does make it a bit more complicated.
Of course, there are similar issues of substituting more complicated expressions such as
(3x + 3f(x))(x+f(x)=>1) # substitution does nothing
And this seems to me quite a bit harder to solve, so perhaps I should just accept that substituting anything more complicated than a single variable or function will not always work.
There is an inconsistency when substituting things in an expression where they are being differentiated:
Here we can imagine that g = f', and so the last two lines should be equivalent. It makes sense that if an expression is constant its derivative becomes 0, so this should be the case also when the expression is itself a derivative. Though multivariate functions does make it a bit more complicated.
Of course, there are similar issues of substituting more complicated expressions such as
And this seems to me quite a bit harder to solve, so perhaps I should just accept that substituting anything more complicated than a single variable or function will not always work.