File: factor_out.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 (29 lines) | stat: -rw-r--r-- 836 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
\cdbalgorithm{factor\_out}{}

Given a list of symbols, this algorithm tried to factor those symbols
out of terms. As an example,
\begin{screen}{1,2}
a b + a c e + a d:
@factor_out!(%){a};
a ( b + c e + d );
\end{screen}
In case you are familiar with FORM, {\tt factor\_out} is like its {\tt
bracket} statement. If you add more factors to factor out, it works as
in
\begin{screen}{1,2}
a b + a c e + a c + c e + c d + a d:
@factor_out!(%){a,c};
a (b + d) + c ( e + d ) + a c (e + 1);
\end{screen}
That is, separate terms will be generated for terms which differ by
powers of the factors to be factored out.

The algorithm of course also works with indexed objects, as in
\begin{screen}{1,2}
A_{m} B_{m} + C_{m} A_{m};
@factor_out!(%){A_{m}};
A_{m} (B_{m} + C_{m}) ;
\end{screen}
(this is still work in progress).

\cdbseealgo{factor_in}