How can I define a function which takes as an only parameter a real number and gives as a result the closest smaller natural number? E.g. $f(3.554)=3, f(4.95485)=4, f(2.001)=2$.
|
|
First, if your real number $k < 1$, then the function $f$ is not defined at $k$ since there is no natural number lesser than the value of $k$. The function $f$ you are trying to define is just a subset of the floor function where $f:\{x|x\ge 1\} \mapsto \mathbb{N}$. Thus we can define your function as $f(x) = \max (y\in \mathbb{N}|y\le x), x \in [1,\infty)$. |
|||||||
|
|
|
You can define such a function directly by it's desired properties, i.e. for $x\geq 1$, define $$ f(x) :=\max \left\{ n\in\mathbb{N}:n\leq x \right\}. $$ As has already been pointed out, $f(x)$ is commonly denoted by $\lfloor x\rfloor$. Clearly $f$ is discontinuous, so it cannot be expressed as a finite composition of continuous functions (which probably is what you've actually been looking for) or a power series. One obvious representation of $f$ would be to write it as a limit of step functions: $$ f = \lim_{n\rightarrow \infty}\sum_{k=1}^n k \cdot\chi_{[k,k+1)}$$ where $\chi_I$ is the characteristic function of the interval $I$, but this is really nothing more than toying with the definition. |
||||
|
