symmetry of derivatives

53 views
Skip to first unread message

Chris Smith

unread,
Aug 29, 2018, 1:55:03 AM8/29/18
to sympy
SymPy allows derivative wrt non-Symbols. Under the current assumptions, `g(t).diff(g(t),t) == g(t).diff(t, g(t)) == 0`. Can anyone give an example where `f(g(t)).diff(t, g(t))` would not equal `f(g(t)).diff(g(t), t)`? 

Aaron Meurer

unread,
Aug 29, 2018, 2:12:07 AM8/29/18
to sy...@googlegroups.com
I believe they are equal, according to SymPy's rule that
(g'(t)).diff(g(t)) == 0:

f(g(t)).diff(t, g(t)) == (f'(g(t))*g'(t)).diff(g(t)) == f''(g(t))*g'(t)

f(g(t)).diff(g(t), t) == f'(g(t)).diff(t) == f''(g(t))*g(t)

You can also verify this with SymPy:

>>> f(g(t)).diff(t).diff(g(t))
Derivative(f(g(t)), (g(t), 2))*Derivative(g(t), t)
>>> f(g(t)).diff(g(t)).diff(t)
Derivative(f(g(t)), (g(t), 2))*Derivative(g(t), t)

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/73c688ce-d447-4767-8ded-373346b822b7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Robert Dougherty-Bliss

unread,
Aug 29, 2018, 1:52:04 PM8/29/18
to sympy
Why do we assume that g'(t).diff(g(t)) == 0?

Here's a question on math.SE about derivatives w.r.t. functions: https://math.stackexchange.com/questions/954073

Does the assumption work with the accepted answer there?

Aaron Meurer

unread,
Aug 29, 2018, 2:22:57 PM8/29/18
to sy...@googlegroups.com
The original motivation for derivatives wrt functions and derivatives
of functions was to support the Euler-Lagrange equations
https://en.wikipedia.org/wiki/Euler%E2%80%93Lagrange_equation. In
Euler-Lagrange, dL(t, q(t), q'(t))/dq'(t) means consider L as a
function of three variables, L(x, y, z) and take dL/dz evaluated at
z=q'(t).

See also https://github.com/sympy/sympy/issues/15048

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/22f5c508-94ba-44f9-bd73-0d1f65f90330%40googlegroups.com.

Chris Smith

unread,
Sep 13, 2018, 7:32:27 AM9/13/18
to sympy
Although the ordering of t and g(t) does not matter, the ordering of t and g'(t) will matter. e.g. `(g(t) +g'(t)).diff(t, g'(t))` is 1 whereas differentiating in reverse order gives 0.
Reply all
Reply to author
Forward
0 new messages