Last modified on 17 September 2014, at 09:09

# Number typeEdit

Number ( for example angle in turns ) can be used as a :

• decimal number (base = 10 ) [1]
• ratio = rational number ( if number can not be represented as a ratio then it is irrational number )
• in lowest terms ( irreducible form ) : $\tfrac{1}{21}$
• reducible form
• in explicit normalized form ( only when denominator is odd )[2] : $\tfrac{3}{63} = \tfrac{3}{2^{6}-1}$
• decimal floating point number $0.\overline{047619}$
• finite expansion
• endless expansion
• continue infinitely without repeating (in which case the number is called irrational = non-repeating non-terminating decimal numbers[3])
• Recurring or repeating
• (strictly) periodic ( preperiod = 0 , preiod > 0 )
• mixed = eventually periodic ( preperiod > 0 , period > 0 )
• binary number ( base = 2 )
• binary rational number ( ratio) $\tfrac{1}{10101}$
• binary real number
• binary floating point number ( scientific notation )
• binary fixed point number ( notation)
• with repeating sequences : $0.\overline{000011}$
• with endless expansion $0.000011000011000011000011...$

# ExamplesEdit

## preperiodicEdit

1/12= 1/(3*2^2) = 0.08(3) so preperiod=2 period=1

1/6=1/(2*3) = 0.1(6) so preperiod=1 preriod=2

77/600 = 77/(2^3*3*5^2) = 0.128(3) so preperiod=3 period = 1

## periodicEdit

1/3 = 0.(3) preperiod=0 preriod=2 ;

1/7 = 0.142857  ; 6 repeating decimal digits

Binary expansion of $\tfrac{1}{21}$ has a period= 6 under doubling map

1/17 = 0.05882352 94117647  ; 16 repeating digits

1/19 = 0.052631578 947368421  ; 18 repeating digits

1/23 = 0.04347826086 95652173913  ; 22 repeating digits

1/29 = 0.0344827 5862068 9655172 4137931  ; 28 repeating digits

1/97 = 0.01030927 83505154 63917525 77319587 62886597 93814432 98969072 16494845 36082474 22680412 37113402 06185567  ; 96 repeating digits

For 3923/6173 decimal expansion has period= 3086 and preperiod 0 [4]

## finiteEdit

1/5 = 0.2 It is finite number ( terminating decimal ) : preperiod =0 and period = 0

# How to find number typeEdit

Note that in numerical computations with finite precision ( on computer) :

• if number is represented as a ratio ( of integers) then it is a rational number
• if number has a floating point representation the it is also a rational number because of limited precision = finite expansion

/*

Maxima CAS batch file

*/

remvalue(all);
kill(all);

/*
input = ratio, which automaticaly changed to lowest terms by Maxima CAS
output = string describing a type of decimal expansion

---------------------------------------------------------------------------------
" The rules that determine whether a fraction has recurring decimals or
not are really quite simple.

1. First represent the fraction in its simplest form, by dividing both
numerator and denominator by common factors.

2. Now, look at the denominator.

3.
3.1 If the prime factorization of the denominator contains only the
factors 2 and 5, then the decimal fraction of that fraction will not
have recurring digits. In other words : Terminating decimals represent
rational numbers of the form k/(2^n*5^m)

3.2
A fraction in lowest terms with a prime denominator other than 2 or 5
(i.e. coprime to 10) always produces a repeating decimal.

3.2.1
If the prime factorization yields factors like 3, 7, 11 or other
primes (other than 2 and 5), then that fraction will have a decimal
representation that includes recurring digits.

3.2.2
Moreover, if the denominator's prime factors include 2 and/or 5 in
addition to other prime factors like 3, 7, etc., the decimal
representation of the fraction will start with a few non-recurring
decimals before the recurring part."

http://blogannath.blogspot.com/2010/04/vedic-mathematics-lesson-49-recurring.html

check :
http://www.knowledgedoor.com/2/calculators/convert_a_ratio_of_integers.html

---------------------------------------------------------------------------------------

*/

GiveRatioType(ratio):=
block
(
[numerator:denom(ratio),
FactorsList ,
Factor,
Has25:false,
HasAlsoOtherPrimes:false,
type ], /* type of decimal expansion of the ratio of integers */

/* compute list of prime factors ofd denominator */
FactorsList:ifactors(numerator),
FactorsList:map(first,FactorsList),
print(numerator, FactorsList),
/* check factors type :
only 2 or 5
also other primes then 2 or 5
*/
if (member(2,FactorsList) or member(5,FactorsList)) then Has25:true,

for Factor in FactorsList do
if (not member(Factor,[2,5])) then
HasAlsoOtherPrimes:true,
print(Has25, HasAlsoOtherPrimes),

/* find type of decimal expansion */
if (not Has25 and HasAlsoOtherPrimes)     then type:"periodic",
if (Has25 and HasAlsoOtherPrimes)     then type:"preperiodic",
if (Has25 and not HasAlsoOtherPrimes) then type:"finite",

return(type)
)$compile(all)$

/* input numbers*/
a:1 $b:3$

r:a/b\$

type :  GiveRatioType(r);


# ConversionsEdit

Conversion between :

• bases
• using bc / dc
• ratio and expansion
• expansion and rational form [7]
• repeating decimals and ratio [8]
• Recognizing Rational Numbers From Their Decimal Expansion[9]: "to compute the simple continued fraction of the approximation, and truncate it before a large partial quotient a_n, then compute the value of the truncated continued fraction."

# How to use numbers in computer programs ?Edit

"Any number with a finite decimal expansion is a rational number. " In other words  : "any floating point number can be converted to a rational number." [10]

So in numerical computations one can use only integer of floating points numbers ( rational ).

## Irrational =Edit

If one wants use irrational number then should check :

• symbolic computations :
• exact number can be used as a symbol, but "you cannot print the whole irrational number"
• infinite continued fraction
• numerical computations : close rational approximations to irrational numbers [11] (the Diophantine Approximation [12])
• ratio of integers
• floating point number
• finite continued fractions

### Inverse golden meanEdit

Using Maxima CAS :

(%i10) print(float(%phi-1));
(%o10).6180339887498949
(%i11) rationalize(float(%phi-1));
(%o11) 347922205179541/562949953421312


and  :

(%i14) print(float(1/%phi));
(%o14) .6180339887498948
(%i15) rationalize(float(1/%phi));
(%o15) 5566755282872655/9007199254740992


where denominator :

$562949953421312 = 1 + 2^{49}$


# CardinalityEdit

In mathematic ( theory) :

• "... the rational numbers are a countable set whereas the irrational numbers are an uncountable set. In other words, there are more irrational numbers than there are rational. " [13]
• "... in the set of real numbers there is continuum of irrational numbers and only aleph-zero rational numbers. Thus probability that any random number is irrational is 1;" ( Bartek Ogryczak) [14] "To be pedantically correct you should have said almost certainly is 1. " – David Hammen

# Random numberEdit

The probability that any random number :

• is irrational is almost 1 ( in theory because of cardinality )
• is rational is 1 ( in numerical computations because of limited precision )