I want to get rid of an extra substitution which sympy makes when differentiating a user defined composite function. The code is
t = Symbol('t')
u = Function('u')
f = Function('f')
U = Symbol('U')
pprint(diff(f(u(t),t),t))
The output is:
d d ⎛ d ⎞│
──(f(u(t), t)) + ──(u(t))⋅⎜───(f(ξ₁, t))⎟│
dt dt ⎝dξ₁ ⎠│ξ₁=u(t)
I guess it does this because you can't differentiate w.r.t u(t), so this is ok. What I want to do next is to substitute u(t) with an other variable say U and then get rid of the extra substitution \xi_1
⎞│
⎟│
⎠│ξ₁=U
To clarify, I want this output:
d d ⎛d ⎞
──(f(U, t)) + ──(U)⋅⎜──(f(U, t))⎟
dt dt ⎝dU ⎠
The reason is; when I Taylor expand a composite function like this, the extra substitutions make the output unreadable. Does anyone know how to do this? Any other solution is of course welcomed.