剰余演算と床関数・天井関数の関係

剰余演算と床関数・天井関数の関係
\(\beta\ne0\)とする。

(1)

\[ \alpha=\beta\left\lfloor \frac{\alpha}{\beta}\right\rfloor +\mod\left(\alpha,\beta\right) \]

(2)

\[ \alpha=\beta\left\lceil \frac{\alpha}{\beta}\right\rceil +\mod\left(\alpha,-\beta\right) \]

(3)

\[ \alpha=\left\lfloor \alpha\right\rfloor +\mod\left(\alpha,1\right) \]

(4)

\[ \alpha=\left\lceil \alpha\right\rceil +\mod\left(\alpha,-1\right) \]

(5)

\[ \alpha=\beta\left\lfloor \frac{\alpha-\gamma}{\beta}\right\rfloor +\mod\left(\alpha,\beta,\gamma\right) \]

(6)

\[ \alpha=\beta\left\lceil \frac{\alpha-\gamma}{\beta}\right\rceil +\mod\left(\alpha,-\beta,\gamma\right) \]

-

\(\mod\left(\alpha,\beta\right)\)は剰余演算
\(\left\lfloor z\right\rfloor \)は床関数
\(\left\lceil z\right\rceil \)は天井関数

(1)

\(\alpha\)を\(\beta\)で割った商は\(\left\lfloor \frac{\alpha}{\beta}\right\rfloor \)、余りは\(\mod\left(\alpha,\beta\right)\)なので与式は成り立つ。

(2)

\begin{align*} \alpha & =-\beta\left\lfloor \frac{\alpha}{-\beta}\right\rfloor +\mod\left(\alpha,-\beta\right)\\ & =\beta\left\lceil \frac{\alpha}{\beta}\right\rceil +\mod\left(\alpha,-\beta\right) \end{align*}

(3)

(1)で\(\beta=1\)を代入すればいい。

(4)

(2)で\(\beta=1\)を代入すればいい。

(5)

\begin{align*} \alpha & =\alpha-\gamma+\gamma\\ & =\beta\left\lfloor \frac{\alpha-\gamma}{\beta}\right\rfloor +\mod\left(\alpha-\gamma,\beta\right)+\gamma\\ & =\beta\left\lfloor \frac{\alpha-\gamma}{\beta}\right\rfloor +\mod\left(\alpha,\beta,\gamma\right) \end{align*}

(6)

\begin{align*} \alpha & =\alpha-\gamma+\gamma\\ & =\beta\left\lceil \frac{\alpha-\gamma}{\beta}\right\rceil +\mod\left(\alpha-\gamma,-\beta\right)+\gamma\\ & =\beta\left\lceil \frac{\alpha-\gamma}{\beta}\right\rceil +\mod\left(\alpha,-\beta,\gamma\right) \end{align*}

ページ情報
タイトル
剰余演算と床関数・天井関数の関係
URL
https://www.nomuramath.com/c42fve4z/
SNSボタン