I'm playing around with coordinate transformations. Here are a set of three rules defining the linear differential operation:
OpX /: OpX[Ae_ + Bee__] := OpX[Ae] + OpX[Bee]
OpX /: OpX[Ae_*Uu_ [Rr_, Teta_]] := {D[Ae Uu[Rr, Teta], Rr], D[Ae Uu[Rr, Teta], Teta]}
OpX /: OpX[Uu_[Rr_, Teta_]] := {D[Uu[Rr, Teta], Rr], D[Uu[Rr, Teta], Teta]}
(Note: the Left hand SIde of the Rules with the underscores don't come out correctly for R_ and Teta_ because I don't know the escape characters) I define
CoefRay[Rr_, Teta_] := {Cos[Teta], -Sin[Teta]/Rr}
and compute
FrstOpX = CoefRay[rr, teta].OpX[You[rr, teta]].
Observe {D[FrstOpX, rr], D[FrstOpX, teta]} works a-okay. But not OpX[FrstOpX]; it goes ka-bluey when doing D[FrstOpX, teta] returning General::ivar: "-1 is not a valid variable." Any ideas how to modify the rules to overcome da'issue? Using MatchQ tells me the rules parse correctly. (At least they I think they should.)