FractionalPart

FractionalPart[x]

gives the fractional part of x.

Details

  • Mathematical function, suitable for both symbolic and numerical manipulation.
  • FractionalPart[x] in effect takes all digits to the right of the decimal point and drops the others.
  • FractionalPart[x]+IntegerPart[x] is always exactly x.
  • FractionalPart[x] yields a result when x is any numeric quantity, whether or not it is an explicit number.
  • For exact numeric quantities, FractionalPart internally uses numerical approximations to establish its result. This process can be affected by the setting of the global variable $MaxExtraPrecision.
  • FractionalPart applies separately to real and imaginary parts of complex numbers.
  • FractionalPart automatically threads over lists. »

Examples

open allclose all

Basic Examples  (3)

Find the fractional part of a real number:

Find the fractional part of a negative real number:

Plot over a subset of the reals:

Scope  (31)

Numerical Evaluation  (6)

Evaluate numerically:

Complex number inputs:

Evaluate to high precision:

The precision of the output tracks the precision of the input:

Evaluate efficiently at high precision:

Compute the elementwise values of an array using automatic threading:

Or compute the matrix FractionalPart function using MatrixFunction:

Compute average-case statistical intervals using Around:

Specific Values  (6)

Values of FractionalPart at fixed points:

Value at zero:

Value at Infinity:

Evaluate symbolically:

Manipulate FractionalPart symbolically:

Find a value of x for which the FractionalPart[x]=0.5:

Visualization  (4)

Plot the FractionalPart function:

Plot scaled FractionalPart functions:

Plot FractionalPart in three dimensions:

Visualize FractionalPart in the complex plane:

Function Properties  (11)

FractionalPart is defined for all real and complex inputs:

Function range of FractionalPart:

FractionalPart is an odd function:

FractionalPart can be made periodic on the reals by adding one to its value on the negative reals:

FractionalPart is not an analytic function:

It has both singularities and discontinuities:

FractionalPart is neither nondecreasing nor nonincreasing:

FractionalPart is not injective:

FractionalPart is not surjective:

FractionalPart is neither non-negative nor non-positive:

FractionalPart is neither convex nor concave:

TraditionalForm formatting:

Differentiation and Integration  (4)

First derivative with respect to x:

Second derivative with respect to x:

Evaluate an integral:

Series expansion:

Applications  (7)

Find the first few digits of , using Stirling's approximation:

Plot fractional parts of powers:

Plot fractional parts of powers of a Pisot number:

Iterate the shift map with a rational initial condition and plot the result:

Irrational initial condition:

See the degradation in precision for approximate real numbers:

Make a Bernoulli polynomial periodic and plot it:

Properties & Relations  (3)

Convert FractionalPart to Piecewise:

Denest FractionalPart functions:

Possible Issues  (2)

Guard digits influence the result of FractionalPart:

Numerical decision procedures with default settings cannot simplify this expression:

Using a larger setting for $MaxExtraPrecision gives the expected result:

Neat Examples  (1)

Convergence of the Fourier series of FractionalPart:

Wolfram Research (1996), FractionalPart, Wolfram Language function, https://reference.wolfram.com/language/ref/FractionalPart.html.

Text

Wolfram Research (1996), FractionalPart, Wolfram Language function, https://reference.wolfram.com/language/ref/FractionalPart.html.

CMS

Wolfram Language. 1996. "FractionalPart." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FractionalPart.html.

APA

Wolfram Language. (1996). FractionalPart. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FractionalPart.html

BibTeX

@misc{reference.wolfram_2024_fractionalpart, author="Wolfram Research", title="{FractionalPart}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/FractionalPart.html}", note=[Accessed: 06-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_fractionalpart, organization={Wolfram Research}, title={FractionalPart}, year={1996}, url={https://reference.wolfram.com/language/ref/FractionalPart.html}, note=[Accessed: 06-December-2024 ]}