2

Is there a way to declare that subscripted letters are not functions of the letter? By default, this happens:

In[5]:= D[Subscript[t, 0], t]
Out[5]= (Subscript^(1,0))[t,0]

which I can understand but is slightly eye-roll-inducing. Mathematical practice would like this t_0 to be constant.

1 Answers1

4

You can use a variation of the following idea where I fix a similar issue with Solve:

$Notations = Alternatives[
    Subscript, Superscript, Subsuperscript, SubPlus, SubMinus, SubStar, SuperPlus,
    SuperMinus, SuperStar, SuperDagger, Overscript, Underscript, Underoverscript, 
    OverBar, OverVector, OverTilde, OverHat, OverDot, UnderBar
];

Unprotect[D]; D[a__] /; !FreeQ[{a}, $Notations[__]] := Block[{CompressedData}, With[{z=Unevaluated[D[a]] /. s:$Notations[__] :> CompressedData[Compress[s]]}, z /; !MatchQ[z,_D] ] ] Protect[D];

Then:

D[t Subscript[t,0] + t^2, t]

2 t + Subscript[t, 0]

Carl Woll
  • 130,679
  • 6
  • 243
  • 355