Skip to content

Substitution inside derivatives is inconsistent #216

@Gyoshi

Description

@Gyoshi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions