# Chain rule in Symbolics.jl

Probably I’m blind,
but is there a way to get the transformation
\frac{d}{d t} x(y(t)) = \frac{\partial x}{\partial y}(y(t)) \frac{\partial y}{\partial t}(t)
where x and y are symbolic. (I want do do a symbolic transformation on a PDE).

using Symbolics
@variables t x(..) y(..)
Dt = Differential(t)

e = Dt(x(y(t)))
expand_derivatives(e) # == Differential(t)(x(y(t)))
# is there some way to get something like
# magic( e ) == Differential(y)(x) * Differential(t)(x)


I understand that x(..) implies that x(y) stays unevaluated. So, the above code does what it should. But I cannot find a symbolic way to trigger the chain rule. (I’m open to use other packages)

2 Likes

I found this in the source code of Symbolics.jl

     # The recursive expand_derivatives was not able to remove
# a nested Differential. We can attempt to differentiate the
# inner expression wrt to the outer iv. And leave the
# unexpandable Differential outside.


I am not sure, but this could be the reason?
Symbolics.jl/src/diff.jl

Mr. @shashi wrote those lines of code, probably he could help.

1 Like

Thanks! This seems to answer the question in the sense that it’s not there yet.

1 Like

@shashi said he was working on this example.

2 Likes
3 Likes

Amazing. Thanks a lot