0
$\begingroup$

I would like to use subscripted notation such as $\sigma_x$ as identifiers for use as variables. In this example I am using the Pauli Matrices so that I would use notation such as: $$ \sigma_x = \{\{0,1\},\{1,0\}\} $$ However, when defining the expression, two variables or identifiers are defined in my current context. Using the Names function for the context I would find that the two identifiers $\sigma$ and $x$ are both individually defined but the identifier symbol $\sigma_x$ is not defined.

How do I prevent the individual definition of the $\sigma$ and $x$ and force the definition of the ONE subscripted identifier $\sigma_x$?

$\endgroup$
1
$\begingroup$

You could try using [x] instead of subscript-x:

Clear[σ, x];
σ[x] := {{0,1},{1,0}};
{σ, x, σ[x]}

It's not as elegant as a subscript, but it works. Just be sure not to define 'x' elsewhere!

$\endgroup$

Your Answer

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

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