平衡进位制记数法
符号数字进位制记数法 | |
---|---|
术语名称 | 符号数字进位制记数法 |
英语名称 | signed-digit positional notation |
平衡进位制记数法 | |
---|---|
术语名称 | 平衡进位制记数法 |
英语名称 | balanced positional notation |
别名 | 平衡进制, 平衡进位制 |
基数 | |
---|---|
术语名称 | 基数 |
英语名称 | radix |
别名 | base |
符号数字进位制记数法(signed-digit positional notation)指一种位值制记数法中,每一个数位的位权依次是特定数字(基数)的幂,且每个数位上的符号是包含正负的基数个符号。 平衡进位制记数法(balanced positional notation)指符号数字进位制记数法中的符号除 0 外正负各一半。若基数为偶数时,基数的一半可能允许正负同时存在。也称平衡进制或平衡进位制。
平衡进制记数法也常默认指代平衡三进制。
定义
关于记数法
在位值制记数法中,若每一个数位上的位权都是某个大于 1 自然数 [math]\displaystyle{ r }[/math] 的幂,即 [math]\displaystyle{ \cdots,r^3,r^2,r,1,r^{-1},r^{-2},r^{-3},\cdots }[/math] ,且若 [math]\displaystyle{ r }[/math] 为奇数,每一个数位上的数字都只使用 [math]\displaystyle{ r }[/math] 个符号 [math]\displaystyle{ 0,1,\bar{1}=-1,2,\bar{2}=-2, \cdots,d=\tfrac{r-1}{2},\bar{d}=-\tfrac{r-1}{2} }[/math] ,若 [math]\displaystyle{ r }[/math] 为偶数,每一个数位上的数字都只使用 [math]\displaystyle{ (r+1) }[/math] 个符号 [math]\displaystyle{ 0,1,\bar{1}=-1,2,\bar{2}=-2, \cdots,d=\tfrac{r}/2,\bar{d}=-\tfrac{r}/2 }[/math] ,则称这一类记数法为平衡进位制记数法(balanced positional notation),对应这一 [math]\displaystyle{ r }[/math] 的具体记数法称为平衡 [math]\displaystyle{ r }[/math] 进制(balanced base-[math]\displaystyle{ r }[/math] notation),自然数 [math]\displaystyle{ r }[/math] 称为平衡 [math]\displaystyle{ r }[/math] 进制中的基数(radix)/底数(base)。
关于数
对自然数 [math]\displaystyle{ r }[/math] ,若为奇数,集合 [math]\displaystyle{ D_r = \{0,1,\bar{1}=-1,2,\bar{2}=-2,\cdots,d=\tfrac{r-1}{2},\bar{d}=-\tfrac{r-1}{2}\} }[/math] 是一个含有 [math]\displaystyle{ r }[/math] 元素的符号集,记这一字符集合上的非空字符串集(或描述为 Kleene+ 闭包) [math]\displaystyle{ D_r^+ = \{d_n d_{n-1} d_{n-2} \cdots d_0 \mid n\gt =0 \land d_i \in D_r \} }[/math] ,通过等价关系 [math]\displaystyle{ d_n d_{n-1} d_{n-2} \cdots d_0 \sim 0 d_n d_{n-1} d_{n-2} \cdots d_0 }[/math] 定义的商集 [math]\displaystyle{ D_r^+/\sim }[/math] 与自然数集 [math]\displaystyle{ \mathbb{Z} }[/math] 存在令 [math]\displaystyle{ 0\mapsto 0 }[/math] 的序同构,其中元素称为平衡 [math]\displaystyle{ r }[/math] 进制数。
对基数为偶数的进制,一般约定字符串集合有某种正规化以避免同一个数值在有一位是 [math]\displaystyle{ \pm\tfrac{r}{2} }[/math] 时产生多种表达。
记号
使用平衡 [math]\displaystyle{ r }[/math] 进制时,通常在某一位数字上使用 [math]\displaystyle{ 0,1,\bar{1},\cdots,d=\tfrac{r-1}{2},\bar{d}=-\tfrac{r-1}{2} }[/math] 字符,并且按照类似平常十进制的方式书写。由于上划线有循环节的含义,有时也以其他规则使用其他字符,如平衡三进制中 [math]\displaystyle{ \bar{1} }[/math] 常被替换为形近的 T 。
整数排列为 [math]\displaystyle{ a_n a_{n-1} a_{n-2} \cdots a_0 }[/math] 的格式,用这一格式记录整数 [math]\displaystyle{ \sum_{i=0}^n a_i r^i = a_n r^n + a_{n-1} r^{n-1} + \cdots + a_0 }[/math] 。
反过来,每一位上的符号与数本身的递推关系满足:若 [math]\displaystyle{ m }[/math] 代表 [math]\displaystyle{ a_n a_{n-1} \cdots a_ 1 a_0 }[/math] ,则:
[math]\displaystyle{ \begin{aligned} m = q_0 r + a_0 &, -\tfrac{r}{2} \leq a_0 \leq \tfrac{r}{2} \\ q_0 = q_1 r + a_1 &, -\tfrac{r}{2} \leq a_1 \leq \tfrac{r}{2} \\ q_1 = q_2 r + a_2 &, -\tfrac{r}{2} \leq a_2 \leq \tfrac{r}{2} \\ \vdots \\ q_{n-1} = 0 r + a_n &, -\tfrac{r}{2} \leq a_n \leq \tfrac{r}{2} \\ \end{aligned} }[/math]
等式的右侧都是使用最小绝对余数的带余除法。但是偶数的情况下会存在多种表达,一般会有特定选择规则。
小数部分
若带有小数部分,则可写为 [math]\displaystyle{ a_n a_{n-1} a_{n-2} \cdots a_0 . a_{-1} a_{-2} \cdots }[/math] ,用这一格式记录的数为 [math]\displaystyle{ \sum_{i=0}^n a_i r^i + \sum_{i=1}^\infty a_{-i} r^{-i}= a_n r^n + a_{n-1} r^{n-1} + \cdots + a_0 + a_{-1} r^{-1} + a_{-2} r^{-2} + \cdots }[/math] 。具体数字选择与整数部分类似,特别地,尽管整数和有限小数都是唯一的,一些循环小数在奇基数下存在两种表示。
进制标注
平衡进制一般将数字打括号并下标 bal 及十进制标注进制基数,作为平衡进制的缩写。
记数系统 | |||
---|---|---|---|
位值制记数法 | 进位制记数法/标准位值制记数法(进制) | 二进制、八进制、十进制、十六进制、…… | |
非标准位值制记数法 | 带符号进位制记数法/ 平衡记数法(平衡进制) |
平衡三进制、…… | |
双射记数法(双射进制) | 一进制、双射十进制、双射二十六进制、…… | ||
位权是幂 但基数不是自然数 (非自然数进制) |
[math]\displaystyle{ -2 }[/math] 、 [math]\displaystyle{ -4 }[/math] 、…… | ||
[math]\displaystyle{ \sqrt{2} }[/math] 、 [math]\displaystyle{ \sqrt{3} }[/math] 、 [math]\displaystyle{ \sqrt[12]{2} }[/math] 、…… | |||
[math]\displaystyle{ 2i }[/math] 、 [math]\displaystyle{ \sqrt[4]{2}i }[/math] 、 [math]\displaystyle{ 2\omega }[/math] 、 [math]\displaystyle{ \sqrt[3]{2}\omega }[/math] 、 [math]\displaystyle{ -1\pm i }[/math] 、…… | |||
位权不是幂(混合进制) | 二五混合进制、阶乘进制、…… | ||
其他 | [math]\displaystyle{ p }[/math]-进数 | ||
质数记数法、…… | |||
符值制记数法 | 罗马记数法、希腊记数法、…… |