File: substitute.tex

package info (click to toggle)
cadabra 1.46-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,244 kB
  • sloc: cpp: 33,188; ansic: 2,724; makefile: 329; yacc: 180; sh: 157; python: 45; lex: 38; lisp: 19
file content (31 lines) | stat: -rw-r--r-- 1,073 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
\cdbalgorithm{substitute}{}

 \label{loc_substitute} Generic substitution command.
Takes a rule or a set of rules according to which an expression
should be modified. If more than one rule is given, it tries each rule
in turn, until the first working one is encountered, after which it
continues with the next node.
\begin{screen}{1,2}
G_{mu nu rho} + F_{mu nu rho};
@substitute!(%)( F_{mu nu rho} -> A_{mu nu} B_{rho} );
G_{mu nu rho} + A_{mu nu} B_{rho};
\end{screen}
\begin{screen}{1,2}
A_{mu nu} B_{nu rho} C_{rho sigma};
@substitute!(%)( A_{m n} C_{p q} -> D_{m q} );
D_{mu sigma} B_{nu rho};
\end{screen}
This command takes full care of dummy index relabelling, as the
following example shows:
\begin{screen}{1,2,3}
{m,n,q,d1,d2,d3,d4}::Indices(vector).
a_{m} b_{n};
@substitute!(%)( a_{q} -> c_{m n} d_{m n q} );
c_{d1 d2} * d_{d1 d2 m} * b_{n};
\end{screen}
By postfixing a name with a question mark, it becomes a pattern.

The substitution algorithm can do very complicated things; for more
detailed information on substitution, see the manual.

\cdbseealgo{vary}