Difference between revisions of "Distance to integers"
From specialfunctionswiki
(Created page with "Define the function $\mathrm{dist}_{\mathbb{Z}} \colon \mathbb{R} \rightarrow \mathbb{R}$ by $$\mathrm{dist}_{\mathbb{Z}}(x)=\inf_{n \in \mathbb{Z}} |x-n|,$$ where $\inf$ deno...") |
|||
Line 3: | Line 3: | ||
where $\inf$ denotes the [[infimum]]. This function can be computed using the [[floor]] and [[ceiling]] functions: | where $\inf$ denotes the [[infimum]]. This function can be computed using the [[floor]] and [[ceiling]] functions: | ||
$$\mathrm{dist}_{\mathbb{Z}}(x)=\min \left(2^n x - \lfloor 2^n x \rfloor, \lceil 2^n x \rceil - x \right).$$ | $$\mathrm{dist}_{\mathbb{Z}}(x)=\min \left(2^n x - \lfloor 2^n x \rfloor, \lceil 2^n x \rceil - x \right).$$ | ||
+ | |||
+ | [[Category:SpecialFunction]] |
Revision as of 18:31, 24 May 2016
Define the function $\mathrm{dist}_{\mathbb{Z}} \colon \mathbb{R} \rightarrow \mathbb{R}$ by $$\mathrm{dist}_{\mathbb{Z}}(x)=\inf_{n \in \mathbb{Z}} |x-n|,$$ where $\inf$ denotes the infimum. This function can be computed using the floor and ceiling functions: $$\mathrm{dist}_{\mathbb{Z}}(x)=\min \left(2^n x - \lfloor 2^n x \rfloor, \lceil 2^n x \rceil - x \right).$$