Cross derivative rules

I am trying to generalize the condition

Derivative[1, 0][ℒp][t, ϕ] -> Derivative[0, 1][ℒp][t, ϕ]/l


for $$\ell$$ a constant, through the following rule

rule02 = {Derivative[a_, b_][ℒp][t_, ϕ_] :> 1/l D[ℒp[t, ϕ], {t, a}, {ϕ, a}]}


However, when I consider the test

Derivative[0, 1][ℒp][t, ϕ] /. rule02
(* ℒp[t, ϕ]/l *)


an extra factor $$1/\ell$$ appear. I understand that my codes replace the factor $$1/\ell$$ even in spatial derivatives, nonetheless, I don't know how to avoid this mistake (I am biased for my code).

• Well, the factor $1/\ell$ is there because you explicitly put it there in the replacement rule. Perhaps you mean rule02 = {Derivative[a_, b_][ℒp][t_, ϕ_] :> (1/l)^a D[ℒp[t, ϕ], {t, a}, {ϕ, a}]}? Commented Aug 6 at 16:18
• @Domen, nope. I just want that equation $\dot{\mathcal{L}p}=\frac{1}{\ell}\mathcal{L}p'$ (and its further derivatives) holds. Commented Aug 6 at 16:20
• What do you expect your rule to do for Derivative[0, 1][ℒp][t, ϕ] (ie. what is the expected output)? Commented Aug 6 at 16:29
• I expect nothing. As I said before, I am trying to create a rule for equation $\dot{f}=\frac{1}{\ell}f'$ to hold, where $f=f(t,\phi)$. Therefore, $f'$ should give nothing new, since the time-derivative is the one that changes to a spatial one. Commented Aug 6 at 16:48

If I understand correctly, you want to transform all time derivatives to spatial derivatives with the general rule:

$$\partial_t^a\partial_\phi^b \mathcal{L}(t,\phi) \mapsto (1/\ell)^a \partial_\phi^{a+b} \mathcal{L}(t,\phi).$$

So you do:

rule = Block[{t, ϕ}, {Derivative[a_, b_][ℒp][t, ϕ] :>
(1/l)^a Derivative[0, a + b][ℒp][t, ϕ]}];

Derivative[0, 1][ℒp][t, ϕ] /. rule
(* Derivative[0, 1][ℒp][t, ϕ] *)

Derivative[1, 0][ℒp][t, ϕ] /. rule
(* Derivative[0, 1][ℒp][t, ϕ]/l *)

Derivative[3, 4][ℒp][t, ϕ] /. rule
(* Derivative[0, 7][ℒp][t, ϕ]/l^3 *)