In have some matrices of pure functions or numbers which I multiply by other matrices or vectors. I would like the functions to be evaluated in the result, but all that I get is something like this:
(I*(D[#1, x] & ))[f[{x, y}]]
Instead I would like something like this:
I*Derivative[{1, 0}][f][{x, y}]
All that I need is that the derivative could pass through the most external round brackets, so that the function could be applied to the argument.
Since I work with a large amount of matrices, I cannot delete manually all the parenthesis after getting the result; is there a way to let the function know it can pass through the brackets?
Thanks.
EDIT:
The solution which best fits my needs is a modified version of @kglr
f1=#/.head_[a___][d___]:>If[StringMatchQ[ToString[{a}//FullForm],"*Function*"],
head[##&@@({a}/.w_Function:(1*#&):>w[d])],
head[a][d]]&;]