Is it possible to use subscripts in Mathematica functions, for example

  f[Subscript[x, a] _] := x^2

However this doesn't seem to work, is there a way to allow indexed variables to behave in the same way as non-indexed variables?


  • 1
    $\begingroup$ But then, why do you need to do this? $\endgroup$ – J. M.'s torpor Jan 15 '17 at 19:22
  • $\begingroup$ I just prefer the notion style for readability. $\endgroup$ – Q.P. Jan 15 '17 at 19:29
  • 4
    $\begingroup$ The best advice about working with Subscripts is: don't use them. See here, here, and here. $\endgroup$ – corey979 Jan 15 '17 at 19:41
  • 1
    $\begingroup$ @corey979 Duly noted. It can be done, its just probably not worth it. Lesson of the day don't use subscripts. $\endgroup$ – Q.P. Jan 15 '17 at 20:01
  • 1
    $\begingroup$ @ corey979 This has been the common opinion for many years. However, recently I started to notice that the expressions with subscripts work in situations they have not work before, and started to use subscripts, especially in tensor expressions, being very careful in cross-checking the results with and without subscripts. It seems to work. May it be an improvement of the latest Mma version? $\endgroup$ – Alexei Boulbitch Jan 16 '17 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.