TOPICS
Search

Fractional Part


The function frac(x) giving the fractional (noninteger) part of a real number x. The symbol {x} is sometimes used instead of frac(x) (Graham et al. 1994, p. 70; Havil 2003, p. 109), but this notation is not used in this work due to possible confusion with the set containing the element x.

FractionalPart

Unfortunately, there is no universal agreement on the meaning of frac(x) for x<0 and there are two common definitions. Let |_x_| be the floor function, then the Wolfram Language command FractionalPart[x] is defined as

 frac(x)={x-|_x_|   x>=0; x-[x]   x<0
(1)

(left figure). This definition has the benefit that frac(x)+int(x)=x, where int(x) is the integer part of x. Although Spanier and Oldham (1987) use the same definition as the Wolfram Language, they mention the formula only very briefly and then say it will not be used further. Graham et al. (1994, p. 70), and perhaps most other mathematicians, use the different definition

 frac(x)=x-|_x_|,
(2)

(right figure).

FractionalPartReImAbs
Min Max
Re
Im Powered by webMathematica

The fractional part function can also be extended to the complex plane as

 frac(x+iy)=frac(x)+ifrac(y)
(3)

as illustrated above.

Since usage concerning fractional part/value and integer part/value can be confusing, the following table gives a summary of names and notations used. Here, S&O indicates Spanier and Oldham (1987).

notationnameS&OGraham et al. Wolfram Language
[x]ceiling function--ceiling, least integerCeiling[x]
mod(m,n)congruence----Mod[m, n]
|_x_|floor functionInt(x)floor, greatest integer, integer partFloor[x]
x-|_x_|fractional valuefrac(x)fractional part or {x}SawtoothWave[x]
sgn(x)(|x|-|_|x|_|)fractional partFp(x)no nameFractionalPart[x]
sgn(x)|_|x|_|integer partIp(x)no nameIntegerPart[x]
nint(x)nearest integer function----Round[x]
m\nquotient----Quotient[m, n]

The (possibly scaled) periodic waveform corresponding to the latter definition is known as the sawtooth wave.

FractionalPartIntegral

The fractional part of 1/x, illustrated above, has the interesting analytic integrals

int_(1/2)^1frac(1/x)dx=int_(1/2)^1(1/x-1)dx
(4)
=ln2-1/2
(5)
int_(1/3)^(1/2)frac(1/x)dx=int_(1/3)^(1/2)(1/x-2)dx
(6)
=ln3-ln2-1/3
(7)
int_(1/4)^(1/3)frac(1/x)dx=int_(1/4)^(1/3)(1/x-3)dx
(8)
=ln4-ln3-1/4.
(9)

The integral

 I=int_0^1frac(1/x)dx
(10)

is therefore a telescoping sum given by

I=lim_(n->infty)[lnn-sum_(k=2)^(n)1/k]
(11)
=lim_(n->infty)(1+lnn-H_n)
(12)
=1-gamma,
(13)

where gamma is the Euler-Mascheroni constant and H_n is the harmonic number.

FractionalPartIntegral2

An additional related integral that can be done in closed form and gives the same result is

 int_1^infty(frac(x))/(x^2)dx=1-gamma
(14)

(Havil 2003, pp. 109-111).

FractionalPartNLogN

The plot above shows the fractional parts of nlnn for 1<=n<=10^5, showing characteristic gaps (Trott 2004, p. 223).

A consequence of Weyl's criterion is that the sequence {frac(nx)} is dense and equidistributed in the interval [0,1] for irrational x, where n=1, 2, ... (Finch 2003).


See also

Beatty Sequence, Ceiling Function, Equidistributed Sequence, Floor Function, Gauss Map, Integer Part, Mod, Nearest Integer Function, Power Fractional Parts, Quotient, Sawtooth Wave, Shift Transformation, Truncate, Whole Number

Related Wolfram sites

http://functions.wolfram.com/IntegerFunctions/FractionalPart/

Explore with Wolfram|Alpha

References

Finch, S. R. "Powers of 3/2 Modulo One." §2.30.1 in Mathematical Constants. Cambridge, England: Cambridge University Press, pp. 194-199, 2003.Graham, R. L.; Knuth, D. E.; and Patashnik, O. Concrete Mathematics: A Foundation for Computer Science, 2nd ed. Reading, MA: Addison-Wesley, 1994.Havil, J. Gamma: Exploring Euler's Constant. Princeton, NJ: Princeton University Press, pp. 109-110, 2003.Miklavc, A. "Elementary Proofs of Two Theorems on the Distribution of Numbers {nx} (mod 1)." Proc. Amer. Math. Soc. 39, 279-280, 1973.Sloane, N. J. A. Sequence A000079/M1129 in "The On-Line Encyclopedia of Integer Sequences."Spanier, J. and Oldham, K. B. "The Integer-Value Int(x) and Fractional-Value frac(x) Functions." Ch. 9 in An Atlas of Functions. Washington, DC: Hemisphere, pp. 71-78, 1987.Trott, M. The Mathematica GuideBook for Programming. New York: Springer-Verlag, 2004. http://www.mathematicaguidebooks.org/.

Referenced on Wolfram|Alpha

Fractional Part

Cite this as:

Weisstein, Eric W. "Fractional Part." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/FractionalPart.html

Subject classifications