1
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ 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]^"+", ... } $\endgroup$ – Marius Ladegård Meyer Jul 11 '16 at 10:27
  • $\begingroup$ but even if I type $b=[a_{k-2},a_{k-1},a_{k}]$ I still get that recursion error. $\endgroup$ – Physicist Jul 11 '16 at 10:54
  • 2
    $\begingroup$ Do Clear[a,b] first. $\endgroup$ – Marius Ladegård Meyer Jul 11 '16 at 11:37
  • $\begingroup$ 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. $\endgroup$ – QuantumDot Jul 11 '16 at 14:15
  • $\begingroup$ You could also use a different symbol that looks similar to a plus sign, e.g., FromCharacterCode[10010]. $\endgroup$ – Jens Jul 11 '16 at 16:07

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.