NumberTheory
RepeatingDecimal
rational number in repeating decimal form
Calling Sequence
Parameters
Description
Examples
Compatibility
RepeatingDecimal(x)
q := RepeatingDecimal(x)
Sign(q)
IntegralPart(q)
NonRepeatingPart(q, output = o)
RepeatingPart(q, output = o)
convert(q, conversion)
evalf(q)
evalf[n](q)
x
-
rational number
q
variable name to use for the returned object
output = o
(optional) name; either list, rational, or float; defaults to list
conversion
name; either rational or float
n
positive integer
The RepeatingDecimal(x) command computes the repeating decimal form of a rational number x. The return value is an object q that represents x exactly in decimal form. The object q can be used with the commands shown on this help page, but in order to use it with other commands you will typically need to convert it to a rational number or a floating-point number.
When q is displayed, if interface⁡prettyprint is greater than or equal to 2, then the repeating part is denoted by a vinculum. Otherwise, the repeating part is delimited by a pair of parentheses.
The Sign command returns 1 if q is positive and −1 if q is negative. If q is zero, then the return value is _Envsignum0 if it is assigned or 0 if it is not assigned. (See signum)
The IntegralPart command returns the unsigned integer part of q.
The NonRepeatingPart command returns the non-repeating fractional part of q.
The RepeatingPart command returns the repeating part of q.
For NonRepeatingPart and RepeatingPart, if the keyword argument output is omitted or set to list, then the return value is a list of decimal digits that represents the corresponding part. If output is set to rational, then the return value is the rational number that represents the corresponding part. If output is set to float, then the return value is a floating-point number with the number of significant digits equal to the length of the non-repeating part or the length of the repeating part, depending on the command that was called.
The convert command can be used to convert q into either fractional form or a floating-point number.
evalf may also be used to convert q to a floating-point number. If evalf has an index n, then the output will have n significant digits.
Three operators, +, *, and ^ are defined for q. They can be used with other rational numbers in decimal or fractional form, and with floating-point numbers.
The equality operator = can also be used with q and will recognize equality among rational numbers in different forms and floating-point numbers representing terminating decimals or approximating repeating decimals.
with⁡NumberTheory:
q≔RepeatingDecimal⁡−1916
q≔-31.83&conjugate0;
Sign⁡q
−1
IntegralPart⁡q
31
NonRepeatingPart⁡q
8
NonRepeatingPart⁡q,output=rational
45
NonRepeatingPart⁡q,output=float
0.8
RepeatingPart⁡q
3
RepeatingPart⁡q,output=rational
130
RepeatingPart⁡q,output=float
0.03
A rational number in repeating decimal form can be converted back to fractional form.
convert⁡q,rational
−1916
convert⁡q,float
−31.83333333
q≔RepeatingDecimal⁡17
q≔0.142857&conjugate0;
p≔RepeatingDecimal⁡13
p≔0.3&conjugate0;
evalf2⁡p
0.33
p+q
0.476190&conjugate0;
17⁢q
0.020408163265306122448979591836734693877551&conjugate0;
q2.5
0.007713560679
evalb⁡p+q=10⁢RepeatingDecimal⁡121
true
evalb⁡p=13
evalb⁡0.33333333333333=13
The NumberTheory[RepeatingDecimal] command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
See Also
interface
Download Help Document