Fractals/Mathematics/Numbers

From Wikibooks, open books for an open world
Jump to: navigation, search

Number type[edit]

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

Examples[edit]

preperiodic[edit]

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

periodic[edit]

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]

finite[edit]

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

How to find number type[edit]

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);

Conversions[edit]

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

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"
  • numerical computations : close rational approximations to irrational numbers [11] (the Diophantine Approximation [12])
    • ratio of integers
    • floating point number
    • continued fractions

Cardinality[edit]

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 number[edit]

The probability that any random number :

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

References[edit]

  1. wikipedia : Number base
  2. HOW TO WORK WITH ONE-DI MENSIONAL QUADRATIC MAPS G. Pastor , M. Romera, G. Álvarez, and F. Montoya
  3. home school math  : The fascinating irrational numbers
  4. wolframalpha : 3923/6173
  5. knowledgedoor calculators: convert_a_ratio_of_integers
  6. R.Knott : Fractions – Decimals Calculator
  7. Recognizing Rational Numbers From Their Decimal Expansion by William Stein
  8. basic-mathematics : converting-repeating-decimals-to-fractions
  9. Rational Numbers From Their Decimal Expansion by William Stein
  10. stackoverflow questions : check-if-a-number-is-rational-in-python
  11. John D Cook : best-rational-approximation
  12. DISCOVERING EXACTLY WHEN A RATIONAL IS A BEST APPROXIMATE OF AN IRRATIONAL By KARI LOCK
  13. home school math : The fascinating irrational numbers
  14. stackoverflow questions : irrational-number-check-function