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  (23)

Numerical Evaluation  (5)

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:

FractionalPart threads elementwise over lists:

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  (4)

FractionalPart is defined for all real and complex inputs:

FractionalPart is an odd function:

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

TraditionalForm formatting:

Differentiation and Integration  (4)

First derivative with respect to x:

Second derivative with respect to x:

Evaluate an integral:

Series expansion:

Applications  (6)

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:

Introduced in 1996
 (3.0)