Message Boards Message Boards


Include special (reserved) symbols in variable names?

Posted 2 months ago
2 Replies
1 Total Likes

I'm trying to translate some gnarly physics equations over to Mathematica for easier exploration / manipulation / etc, and I'm running into a problem when it comes to variable names like enter image description here .

In particular, these sorts of variable names are enormously convenient when writing equations and doing derivations by hand, but Mathematica seems to insist on treating the <parallel> symbol as an infix operator, causing it to produce errors.

Is there any way to override that behavior and tell Mathematica to treat the whole thing as a single, atomic symbol, or am I stuck with the undesirable and much less readable enter image description here ?

The latter becomes especially cumbersome when I've got complicated equations with many expressions involving subscripts like "parallel", "perpendicular", etc. Doubly so when I've already got those expressions, using those symbols, in offline form in pen-and-paper notes.


2 Replies
Posted 2 months ago

Perfect, thanks much!

Hello Michael. Mathematica comes with the package "Notation", which allows you to define custom syntax rules and symbols. If you put your expression inside the function Symbolize[], you can treat basically any expression as an atomic symbol.

There's a support article that describes how to do this for subscripts and superscripts, but the idea applies to much more general expressions.

There is also a more comprehensive guide to the package at

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract