Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have very strong desire to use superscript as the index of the variable.

However, it looks like that the Mathematica automatically recognize the superscript as the power and I got message that my variable with superscript is 'protected'.

Could you help me to make the superscript used as the index of the variable instead of power?

share|improve this question
I'm not sure if it's possible to do, although somebody else might have an answer. I've had this problem before, and just use subscripts instead. For example: $$v_{k\_,j\_}:=\mbox{Sin}[k^2+j^3];$$ Is there a reason why subscripts are not as good for your application? –  DumpsterDoofus Oct 8 '13 at 18:38

3 Answers 3

For internal representation, I prefer avoiding subscripts and superscripts, so I'll give a way for using superscripts for input and output formatting, while the internal expression is of the form x[i].

For output formatting, something like this:

Format[x[i_]] := Superscript[x, i]


Table[x[i], {i, 3}]

Mathematica graphics

For input, this works, but I would wonder whether it is safe:

Power[x, i_] ^:= x[i];
Power /: Set[Power[x, i_], val_] := x[i] = val;

x^i // InputForm
(* x[i] *)

It also works with keyboard input of superscripts.

(x^1 + x^2)^3 // Expand

Mathematica graphics

Mathematica graphics

Mathematica graphics

share|improve this answer

If you want to use superscripts so as to follow some textbook symbols then use Symbolize


I'm going to paste an image because pasting Symbolize gives you this:

Symbolize[ParsedBoxWrapper[SuperscriptBox["y", "1"]]]

enter image description here

share|improve this answer

When I asked people about this before, they wrote up: Displaying index as subscript on output: e.g. C[i] -> C_i with Notation[...] or Interpretation[..]? As with the other answers, this focuses on only output. But uses an Interpretation instead of just changing the functions themselves. You should just be able to copy/paste the code to try it out. To change from subscripts to superscripts for your code, it should just be a copy/replace.

As for why you shouldn't use subscripts/superscripts, it took me a while to figure it out, but basically it is because $x_i$ is not a symbol. Try to call FullForm on $x_i$ to get Subscript[x,i] which is tough to work with.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.