Repeating Decimal - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Number Theory : Repeating Decimal

NumberTheory

  

RepeatingDecimal

  

rational number in repeating decimal form

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

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)

Parameters

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

Description

• 

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 interfaceprettyprint 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.

Examples

withNumberTheory:

qRepeatingDecimal1916

q-31.83&conjugate0;

(1)

Signq

−1

(2)

IntegralPartq

31

(3)

NonRepeatingPartq

8

(4)

NonRepeatingPartq,output=rational

45

(5)

NonRepeatingPartq,output=float

0.8

(6)

RepeatingPartq

3

(7)

RepeatingPartq,output=rational

130

(8)

RepeatingPartq,output=float

0.03

(9)

A rational number in repeating decimal form can be converted back to fractional form.

convertq,rational

1916

(10)

convertq,float

−31.83333333

(11)

qRepeatingDecimal17

q0.142857&conjugate0;

(12)

pRepeatingDecimal13

p0.3&conjugate0;

(13)

evalf2p

0.33

(14)

p+q

0.476190&conjugate0;

(15)

17q

0.020408163265306122448979591836734693877551&conjugate0;

(16)

q2.5

0.007713560679

(17)

evalbp+q=10RepeatingDecimal121

true

(18)

evalbp=13

true

(19)

evalb0.33333333333333=13

true

(20)

Compatibility

• 

The NumberTheory[RepeatingDecimal] command was introduced in Maple 2016.

• 

For more information on Maple 2016 changes, see Updates in Maple 2016.

See Also

interface

NumberTheory