File: keep_terms.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 (12 lines) | stat: -rw-r--r-- 274 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
\cdbalgorithm{keep\_terms}{}

Keep the~$m$th to the~$n$th terms in a sum, dropping all others.
\begin{screen}{1,2,3}
A + B + C + D + E + F;
@keep_terms!(%){3}{5};
D + E + F;
\end{screen}
Note that counting starts from zero.

\cdbseealgo{keep_weight}
\cdbseealgo{take_match}