Tuesday, 22 May 2012

Floor and ceiling functions

In mathematics and computer science, the attic and beam functions map a absolute amount to the better antecedent or the aboriginal afterward integer, respectively. More precisely, floor(x) = is the better accumulation not greater than x and ceiling(x) = is the aboriginal accumulation not beneath than x.1

Notation


tation

Carl Friedrich Gauss alien the aboveboard bracket characters x for the attic action in his third affidavit of boxlike advantage (1808).2 This remained the standard3 in mathematics until Kenneth E. Iverson alien the names "floor" and "ceiling" and the agnate notations x and x in his 1962 book A Programming Language.45 Both notations are now acclimated in mathematics;6 this commodity follows Iverson.

The attic action is aswell alleged the greatest accumulation or entier (French for "integer") function, and its amount at x is alleged the basic allotment or accumulation allotment of x; for abrogating ethics of x the closing agreement are sometimes instead taken to be the amount of the beam function, i.e., the amount of x angled to an accumulation appear 0. The accent APL (programming language) uses ⌊x; added computer languages frequently use notations like entier(x) (Algol), INT(x) (BASIC), or floor(x)(C, C++, R, and Python).7 In mathematics, it can aswell be accounting with boldface or bifold brackets .8

The beam action is usually denoted by ceil(x) or ceiling(x) in non-APL computer languages that accept a characters for this function. The J Programming Language, a chase on to APL that is advised to use accepted keyboard symbols, uses >. for beam and <. for floor.9 In mathematics, there is addition characters with antipodal boldface or bifold brackets or just application accustomed antipodal brackets x.10

The apportioned allotment denticulate function, denoted by for absolute x, is authentic by the formula11

For all x,

editExamples

Sample amount x Floor Ceiling Fractional allotment

12/5 = 2.4 2 3 2/5 = 0.4

2.7 2 3 0.7

−2.7 −3 −2 0.3

−2 −2 −2 0

Definition and properties


In the afterward formulas, x and y are absolute numbers, k, m, and n are integers, and is the set of integers (positive, negative, and zero).

Floor and beam may be authentic by the set equations

Since there is absolutely one accumulation in a half-open breach of breadth one, for any absolute x there are different integers m and n satisfying

Then and may aswell be taken as the analogue of attic and ceiling.

editEquivalences

These formulas can be acclimated to abridge expressions involving floors and ceilings.12

In the accent of adjustment theory, the attic action is a residuated mapping, that is, allotment of a Galois connection: it is the high adjoint of the action that embeds the integers into the reals.

These formulas appearance how abacus integers to the arguments affect the functions:

The aloft are not necessarily accurate if n is not an integer; however:

editRelations a allotment of the functions

It is bright from the definitions that

with adequation if and alone if x is an integer, i.e.

In fact, back for integers n:

Negating the altercation switches attic and beam and changes the sign:

i.e.

Negating the altercation complements the apportioned part:

The floor, ceiling, and apportioned allotment functions are idempotent:

The aftereffect of nested attic or beam functions is the centermost function:

For anchored y, x mod y is idempotent:

Also, from the definitions,

editQuotients

If m and n are integers and n ≠ 0,

If n is positive13

If m is positive14

For m = 2 these imply

More generally,15 for absolute m (See Hermite's identity)

The afterward can be acclimated to catechumen floors to ceilings and vice-versa (m positive)16

If m and n are absolute and coprime, then

Since the right-hand ancillary is balanced in m and n, this implies that

More generally, if m and n are positive,

This is sometimes alleged a advantage law.17

editNested divisions

For absolute integers m,n, and approximate absolute amount x:

editContinuity

None of the functions discussed in this commodity are continuous, but all are piecewise linear. and are piecewise connected functions, with discontinuites at the integers. aswell has discontinuites at the integers, and as a action of x for anchored y is alternate at multiples of y.

is high semi-continuous and and are lower semi-continuous. x mod y is lower semicontinuous for absolute y and high semi-continuous for abrogating y.

editSeries expansions

Since none of the functions discussed in this commodity are continuous, none of them accept a ability alternation expansion. Back attic and beam are not periodic, they do not accept Fourier alternation expansions.

x mod y for anchored y has the Fourier alternation expansion18

in accurate {x} = x mod 1 is accustomed by

At credibility of discontinuity, a Fourier alternation converges to a amount that is the boilerplate of its banned on the larboard and the right, clashing the floor, beam and apportioned allotment functions: for y anchored and x a assorted of y the Fourier alternation accustomed converges to y/2, rather than to x mod y = 0. At credibility of chain the alternation converges to the accurate value.

Using the blueprint {x} = x − floor(x), floor(x) = x − {x} gives

Applications


Mod operator

The mod operator, denoted by x mod y for absolute x and y, y ≠ 0, is authentic by the formula

x mod y is consistently amid 0 and y; i.e.

if y is positive,

and if y is negative,

If x is an accumulation and y is a absolute integer,

x mod y for a anchored y is a denticulate function.

editQuadratic reciprocity

Gauss's third affidavit of boxlike reciprocity, as adapted by Eisenstein, has two basal steps.1920

Let p and q be audible absolute odd prime numbers, and let

First, Gauss's antecedent is acclimated to appearance that the Legendre symbols are accustomed by

and

The additional footfall is to use a geometric altercation to appearance that

Combining these formulas gives boxlike advantage in the form

There are formulas that use attic to accurate the boxlike appearance of baby numbers mod odd primes p:21

editRounding

The accustomed rounding of the absolute amount x to the abutting accumulation can be bidding as The accustomed rounding of the abrogating amount x to the abutting accumulation can be bidding as

editTruncation

The truncation of a nonnegative amount is accustomed by The truncation of a nonpositive amount is accustomed by .

The truncation of any absolute amount can be accustomed by: , area sgn(x) is the assurance function.

editNumber of digits

The amount of digits in abject b of a absolute accumulation k is

with the appropriate ancillary of the blueprint aswell captivation accurate for .

editFactors of factorials

Let n be a absolute accumulation and p a absolute prime number. The backer of the accomplished ability of p that divides n! is accustomed by the formula22

Note that this is a bound sum, back the floors are aught if pk > n.

editBeatty sequence

The Beatty arrangement shows how every absolute aberrant amount gives acceleration to a allotment of the accustomed numbers into two sequences via the attic function.23

editEuler's connected (γ)

There are formulas for Euler's connected γ = 0.57721 56649 ... that absorb the attic and ceiling, e.g.24

and

editRiemann action (ζ)

The apportioned allotment action aswell shows up in basic representations of the Riemann zeta function. It is aboveboard to prove (using affiliation by parts)25 that if φ(x) is any action with a connected acquired in the bankrupt breach a, b,

Letting φ(n) = n−s for absolute allotment of s greater than 1 and absolution a and b be integers, and absolution b access beyond gives

This blueprint is accurate for all s with absolute allotment greater than −1, (except s = 1, area there is a pole) and accumulated with the Fourier amplification for {x} can be acclimated to extend the zeta action to the absolute circuitous even and to prove its anatomic equation.26

For s = σ + i t in the analytical band (i.e. 0 < σ < 1),

In 1947 van der Pol acclimated this representation to assemble an alternation computer for award roots of the zeta function.27

editFormulas for prime numbers

n is a prime if and alone if28

Let r > 1 be an integer, pn be the nth prime, and define

Then29

There is a amount θ = 1.3064... (Mills' constant) with the acreage that

are all prime.30

There is aswell a amount ω = 1.9287800... with the acreage that

are all prime.30

π(x) is the amount of primes beneath than or according to x. It is a aboveboard answer from Wilson's assumption that31

Also, if n ≥ 2,32

None of the formulas in this area is of any applied use.

editSolved problem

Ramanujan submitted this botheration to the Journal of the Indian Mathematical Society.33

If n is a absolute integer, prove that

(i)

(ii)

(iii)

editUnsolved problem

The abstraction of Waring's botheration has led to an baffling problem:

Are there any absolute integers k, k ≥ 6, such that34

Mahler35 has accepted there can alone be a bound amount of such k; none are known.

Computer implementations


Spreadsheet software

This commodity needs added citations for verification. Please advice advance this commodity by abacus citations to reliable sources. Unsourced actual may be challenged and removed. (August 2008)

Most spreadsheet programs abutment some anatomy of a beam function. Although the data alter amid programs, a lot of implementations abutment a additional parameter—a assorted of which the accustomed amount is to be angled to. For example, ceiling(2, 3) circuit 2 up to the abutting assorted of 3, giving 3. The analogue of what "round up" means, however, differs from affairs to program.

Until Excel 2010, Microsoft Excel's beam action was incorrect for abrogating arguments; ceiling(-4.5) was -5. . This has followed through to the Office Open XML book format. The actual beam action can be implemented application "-INT(-value)". Excel 2010 now follows the accepted definition.38

The OpenDocument book format, as acclimated by OpenOffice.org and others, follows the algebraic analogue of beam for its beam function, with an alternative constant for Excel compatibility. For example, CEILING(-4.5) allotment −4.

editTypesetting

The attic and beam action are usually typeset with larboard and appropriate aboveboard brackets area the high (for attic function) or lower (for beam function) accumbent confined are missing, and, e.g., in the LaTeX book arrangement these symbols can be defined with the \lfloor, \rfloor, \lceil and \rceil commands in algebraic mode. HTML 4.0 uses the aforementioned names: ⌊, ⌋, ⌈, and ⌉. Unicode contains codepoints for these symbols at U+2308–U+230B: ⌈x⌉, ⌊x⌋.