取整函数
取整函数 | |
---|---|
术语名称 | 取整函数 |
英语名称 |
下取整函数 | |
---|---|
术语名称 | 下取整函数 |
英语名称 | floor function |
别名 | 高斯函数, 整数部分, integer part, integral part |
上取整函数 | |
---|---|
术语名称 | 上取整函数 |
英语名称 | ceiling function |
向零取整函数 | |
---|---|
术语名称 | 向零取整函数 |
英语名称 | truncation toward zero function |
别名 | 截尾函数, 截尾取整函数 |
小数部分 | |
---|---|
术语名称 | 小数部分 |
英语名称 | fractional part |
别名 | decimal part |
取整函数指将实数映射到最近的整数的函数, 常见的包括下取整函数(floor function)和上取整函数(ceiling function), 在实践中也存在向零取整的取整函数,称为向零取整函数或截尾取整函数,相当于保留0位小数的截尾函数。
历史原因,下取整函数或向零取整函数也被称为整数部分(integer part),剩余部分被称为小数部分(fractional part/decimal part)。
定义
取整函数 | |
---|---|
函数名称 | 下取整函数 |
函数符号 | [math]\displaystyle{ \lfloor\bullet\rfloor }[/math],[math]\displaystyle{ [\bullet] }[/math] |
Latex | \lfloor\rfloor , [[latexCmd::[]]]
|
类型 | 单调非减函数 |
定义域 | [math]\displaystyle{ \mathbb{R} }[/math] |
陪域 | [math]\displaystyle{ \mathbb{Z} }[/math] |
取整函数 | |
---|---|
函数名称 | 上取整函数 |
函数符号 | [math]\displaystyle{ \lceil\bullet\rceil }[/math] |
Latex | \lceil\rceil
|
类型 | 单调非减函数 |
定义域 | [math]\displaystyle{ \mathbb{R} }[/math] |
陪域 | [math]\displaystyle{ \mathbb{Z} }[/math] |
取整函数 | |
---|---|
函数名称 | 小数部分 |
函数符号 | [math]\displaystyle{ \{\bullet\} }[/math] |
Latex | \{\}
|
类型 | 周期函数 |
定义域 | [math]\displaystyle{ \mathbb{R} }[/math] |
陪域 | [math]\displaystyle{ [0,1) }[/math] |
对实数 [math]\displaystyle{ x }[/math] ,
- 记整数 [math]\displaystyle{ \lfloor x \rfloor }[/math] 为不大于 [math]\displaystyle{ x }[/math] 的最大整数,即 [math]\displaystyle{ \lfloor x \rfloor = \max \{ x\in \mathbb{Z} \mid m \leq x \} }[/math] ,或 [math]\displaystyle{ \lfloor x \rfloor \leq x \lt \lfloor x \rfloor + 1 }[/math] ,称整数 [math]\displaystyle{ \lfloor x \rfloor }[/math] 为实数 [math]\displaystyle{ x }[/math] 的下取整,把实数映射到其下取整的函数称为下取整函数(floor function);
- 记整数 [math]\displaystyle{ \lceil x \rceil }[/math] 为不小于 [math]\displaystyle{ x }[/math] 的最小整数,即 [math]\displaystyle{ \lceil x \rceil = \min \{ x\in \mathbb{Z} \mid m \geq x \} }[/math] ,或 [math]\displaystyle{ \lceil x \rceil - 1 \lt x \leq \lceil x \rceil }[/math] ,称整数 [math]\displaystyle{ \lceil x \rfloor }[/math] 为实数 [math]\displaystyle{ x }[/math] 的下取整,把实数映射到其上取整的函数称为上取整函数(ceiling function);
- 记函数 [math]\displaystyle{ f }[/math] 把正实数及 0 映射到其下取整,负实数映射到其上取整,即 [math]\displaystyle{ f(x) = \begin{cases}\lfloor x \rfloor &, x \geq 0 \\ \lceil x \rceil &, x \lt 0\end{cases} }[/math] ,这样的函数称为向零取整函数。
下取整函数也记作 [math]\displaystyle{ [x] }[/math] ,并被称为高斯函数/高斯记号(Gauss bracket),同时,被称为整数部分(integrer/integral part),对应地,记 [math]\displaystyle{ \{x\} = x - [x] }[/math] ,称为小数部分(fractional part / decimal part)。但有时,整数部分也指向零取整后的整数,此时小数部分也指原数与这个意义下的整数部分之差。
性质
取整函数总是单调非减的,且其中只有向零取整是奇函数。取整函数在整数上都是恒等操作,且都是幂等的,如果不同的取整函数叠加,只有最先的函数起作用。
顺序上, [math]\displaystyle{ \lfloor x \rfloor \leq x \leq \lceil x \rceil }[/math] ,且两边都只在整数时候取等号。当不是整数时,有 [math]\displaystyle{ \lceil x \rceil - \lfloor x \rfloor = 1 }[/math] 。
改变符号时,应该同时改变取整方向,即
[math]\displaystyle{ \begin{aligned} & \lfloor -x \rfloor = - \lceil x \rceil \\ & \lceil -x \rceil = - \lfloor x \rfloor \end{aligned} }[/math]
加入整数不影响小数部分,对取整则顺序可交换,即
[math]\displaystyle{ \begin{aligned} & \lfloor x + m \rfloor = \lfloor x \rfloor + m \\ & \lceil x + m \rceil = \lceil x \rceil + m \\ & \{x + m\} = \{x\} \end{aligned} }[/math] 。