Cadabra
a field-theory motivated approach to computer algebra

Accents

It often occurs that you want to put a hat or tilde or some other accent on top of a symbol, as a means to indicate a slightly different object. In most of these cases, the properties of the normal symbol and the accented symbol are identical. Such accents are declared using the Accent property, as in
\hat{#}::Accent;
\(\displaystyle{}\text{Property Accent attached to }\backslash\texttt{hat}\{\#\}.\)
This automatically makes all symbols with hats inherit the properties of the unhatted symbols,
\hat{#}::Accent. {\psi, \chi}::AntiCommuting. {\psi, \chi}::SortOrder. ex:= \hat{\chi} \psi; sort_product(_);
\(\displaystyle{}\widehat{\chi} \psi\)
\hat{\chi} \psi
\(\displaystyle{}-\psi \widehat{\chi}\)
-\psi \hat{\chi}
If you want to put an accent on an object with indices, wrap the accent around the entire object, do not leave the indices outside.
Note that it is also possible to mark objects by attaching sub- or superscripted symbols to them, as in e.g. $A^\dagger$. This can be done by declaring these symbols explicitly using the Symbol property,
\dagger::Symbol;
\(\displaystyle{}\text{Property Symbol attached to }\dagger.\)
If you do not do this, the dagger symbol will be seen as an index and an error will be reported if it appears more than twice.
Copyright © 2001-2024 Kasper Peeters
Questions? info@cadabra.science