# How to declare variables with plus/minus sign as subscript/superscript?

I am pretty new to mathematica, so please forgive me if I ask any stupid questions.

I want to create a vector $a^{+}=[a^+_{k-2},a^+_{k-1},a^+_{k},a^+_{k+1},a^+_{k+2}]$ and then do some symbolic manipulation with it, but how do I use plus/minus sign as symbols rather than operators? Besides, when I type $a=[a_{k-2},a_{k-1},a_{k},a_{k+1},a_{k+2}]$, I get the error message 'Recursion depth of 1024 exceeded during evaluation of $a_{k-2}$'. Why and how to deal with this?

thanks

PS: I know I need to use curly bracket instead of square bracket when typing them in mathematica.

• I don't think there is an easy way to avoid the recursion error; just don't use the same variable name for the lists and the elements of the list. To have the superscripts stay as symbols, can you just use strings? E.g. alist = {a[k-2]^"+", a[k-1]^"+", ... } – Marius Ladegård Meyer Jul 11 '16 at 10:27
• but even if I type $b=[a_{k-2},a_{k-1},a_{k}]$ I still get that recursion error. – Physicist Jul 11 '16 at 10:54
• Do Clear[a,b] first. – Marius Ladegård Meyer Jul 11 '16 at 11:37
• If you only want to do formatting, check out the function SuperPlus or SuperDagger. Also, you get recursion error because there is an a on both the left and right sides of the = sign. Opt for naming it aVec on left hand side. – QuantumDot Jul 11 '16 at 14:15
• You could also use a different symbol that looks similar to a plus sign, e.g., FromCharacterCode. – Jens Jul 11 '16 at 16:07