1Function: chardiv
2Section: number_theoretical
3C-Name: chardiv0
4Prototype: GGG
5Help: chardiv(cyc, a,b): given a finite abelian group (by its elementary
6 divisors cyc) and two characters a and b, return the character a/b.
7Doc: let \var{cyc} represent a finite abelian group by its elementary
8 divisors, i.e. $(d_j)$ represents $\sum_{j \leq k} \Z/d_j\Z$ with $d_k
9 \mid \dots \mid d_1$; any object which has a \kbd{.cyc} method is also
10 allowed, e.g.~the output of \kbd{znstar} or \kbd{bnrinit}. A character
11 on this group is given by a row vector $a = [a_1,\ldots,a_n]$ such that
12 $\chi(\prod g_j^{n_j}) = \exp(2\pi i\sum a_j n_j / d_j)$, where $g_j$ denotes
13 the generator (of order $d_j$) of the $j$-th cyclic component.
14
15 Given two characters $a$ and $b$, return the character
16 $a / b = a \overline{b}$.
17 \bprog
18 ? cyc = [15,5]; a = [1,1]; b =  [2,4];
19 ? chardiv(cyc, a,b)
20 %2 = [14, 2]
21 ? bnf = bnfinit(x^2+23);
22 ? bnf.cyc
23 %4 = [3]
24 ? chardiv(bnf, [1], [2])
25 %5 = [2]
26 @eprog\noindent For Dirichlet characters on  $(\Z/N\Z)^*$, additional
27 representations are available (Conrey labels, Conrey logarithm),
28 see \secref{se:dirichletchar} or \kbd{??character}.
29 If the two characters are in the same format, the
30 result is given in the same format, otherwise a Conrey logarithm is used.
31 \bprog
32 ? G = znstar(100, 1);
33 ? G.cyc
34 %2 = [20, 2]
35 ? a = [10, 1]; \\ usual representation for characters
36 ? b = 7; \\ Conrey label;
37 ? c = znconreylog(G, 11); \\ Conrey log
38 ? chardiv(G, b,b)
39 %6 = 1   \\ Conrey label
40 ? chardiv(G, a,b)
41 %7 = [0, 5]~  \\ Conrey log
42 ? chardiv(G, a,c)
43 %7 = [0, 14]~   \\ Conrey log
44 @eprog
45
46Variant: Also available is
47 \fun{GEN}{chardiv}{GEN cyc, GEN a, GEN b}, when \kbd{cyc} is known to
48 be a vector of elementary divisors and $a, b$ are compatible characters
49 (no checks).
50