Fractals/Mathematics/Numbers
< Fractals < MathematicsNumber types
- numerical values used in numerical computations
- symbols used in symbolic computations
base and expansion
Number ( for example angle in turns ) can be used as a :
- decimal number (base = 10 ) [1]
- integer
- real number
- ratio = fraction ( Finite continued fraction ) = rational number ( if number can not be represented as a ratio then it is irrational number )
- in lowest terms ( irreducible form ) :
- reducible form
- in explicit normalized form ( only when denominator is odd )[2] :
- irrational number
- infinite continued fraction
- ratio = fraction ( Finite continued fraction ) = rational number ( if number can not be represented as a ratio then it is irrational number )
- decimal floating point number [3][4]
- finite expansion
- endless expansion
- continue infinitely without repeating (in which case the number is called irrational = non-repeating non-terminating decimal numbers[5])
- Recurring or repeating
- (strictly) periodic ( preperiod = 0 , preiod > 0 )
- mixed = eventually periodic ( preperiod > 0 , period > 0 )
- binary number ( base = 2 )[6]
- binary rational number ( ratio)
- binary real number
- binary floating point number ( scientific notation )
- binary fixed point number ( notation)
- with repeating sequences :
- with endless expansion
dimension
- 1D
- 2D
- dual[7]
- complex
Examples
finite
1/5 = 0.2 It is finite number ( terminating decimal ) : preperiod =0 and period = 0
There is also another representation as a preperiodic number with periodic part 0, like :
1/4 = 0.25(0) has a preperiod of 2 and a period of 1
preperiodic
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
1/3 = 0.(3) preperiod=0 preriod=2 ;
1/7 = 0.142857 ; 6 repeating decimal digits
Binary expansion of 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/81 = 0.(012345679) ; (period 9)[8]
1/97 = 0.01030927 83505154 63917525 77319587 62886597 93814432 98969072 16494845 36082474 22680412 37113402 06185567 ; 96 repeating digits
1/267=0.(00374531835205992509363295880149812734082397)
For 3923/6173 decimal expansion has period= 3086 and preperiod 0 [9]
Fraction with period of binary expansion = 34 and decimal denominator :
1/(2^p -1)
algorithm for :
- binary expansion
- decimal expasnion (?)
Decimal fraction 1/(2^p-1) has the same form in binary expansion as fraction 1/(2^p), but repeating. Example 1/(2^5)=0.00001 and 1/(2^5-1)=0.(00001)[10]
So binary fraction has period p and preperiod 0.
p | factors(denominator) | binary expansion | decimal expansion | (preperiod ; period) of decimal expansion | |
---|---|---|---|---|---|
2 | ((3,1)) | 0.(01) | 0.(3) | (0;1) | |
3 | ((7,1)) | 0.(001) | 0.(142857) | (0;6) | |
4 | ((3,1),(5,1)) | 0.(0001) | 0.0(6) | (1;1) | |
5 | (31,1)) | 0.(00001) | 0.(032258064516129) | (0;15) | |
6 | ((3,2),(7,1)) | 0.(000001) | 0.(015873) | ||
7 | ((127,1)) | 0.(0000001) | 0.(007874015748031496062992125984251968503937) | ||
8 | ((3,1),(5,1),(17,1)) | 0.(00000001) | 0.0(0392156862745098) | ||
9 | ((7,1),(73,1)) | 0.(000000001) | 0.(001956947162426614481409) | ||
10 | (3, 1), (11, 1), (31, 1)) | 0.(0000000001) | 0.(001955034213098729227761485826) |
Maxima CAS code :
fpprec:100; fpprintprec:100; linel:200; for i:2 thru 200 do print(i, "," ,2^i-1,",", ifactors(2^i-1), bfloat(1/(2^i-1)));
and output :
2 , 3 , [[3, 1]] 3.333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333b-1 3 , 7 , [[7, 1]] 1.428571428571428571428571428571428571428571428571428571428571428571428571428571428571428571428571429b-1 4 , 15 , [[3, 1], [5, 1]] 6.666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666667b-2 5 , 31 , [[31, 1]] 3.225806451612903225806451612903225806451612903225806451612903225806451612903225806451612903225806452b-2 6 , 63 , [[3, 2], [7, 1]] 1.587301587301587301587301587301587301587301587301587301587301587301587301587301587301587301587301587b-2 7 , 127 , [[127, 1]] 7.874015748031496062992125984251968503937007874015748031496062992125984251968503937007874015748031496b-3 8 , 255 , [[3, 1], [5, 1], [17, 1]] 3.921568627450980392156862745098039215686274509803921568627450980392156862745098039215686274509803922b-3 9 , 511 , [[7, 1], [73, 1]] 1.956947162426614481409001956947162426614481409001956947162426614481409001956947162426614481409001957b-3 10 , 1023 , [[3, 1], [11, 1], [31, 1]] 9.775171065493646138807429130009775171065493646138807429130009775171065493646138807429130009775171065b-4 11 , 2047 , [[23, 1], [89, 1]] 4.885197850512945774303859306301905227161700048851978505129457743038593063019052271617000488519785051b-4 12 , 4095 , [[3, 2], [5, 1], [7, 1], [13, 1]] 2.442002442002442002442002442002442002442002442002442002442002442002442002442002442002442002442002442b-4 13 , 8191 , [[8191, 1]] 1.220852154804053229153949456720791112196313026492491759247955072640703210841167134659992674887071176b-4 14 , 16383 , [[3, 1], [43, 1], [127, 1]] 6.103888176768601599218702313373618995300006103888176768601599218702313373618995300006103888176768602b-5 15 , 32767 , [[7, 1], [31, 1], [151, 1]] 3.051850947599719229712820825830866420484023560289315469832453382976775414288766136661885433515427107b-5 ...... 195 , 50216813883093446110686315385661331328818843555712276103167 , [[7, 1], [31, 1], [79, 1], [151, 1], [8191, 1], [121369, 1], [145295143558111, 1], [134304196845099262572814573351, 1]] 1.991364888915565346286100497209639756988880693990773482592396972073911683910436357812547195643147476b-59 196 , 100433627766186892221372630771322662657637687111424552206335 , [[3, 1], [5, 1], [29, 1], [43, 1], [113, 1], [127, 1], [197, 1], [19707683773, 1], [4363953127297, 1], [4432676798593, 1], [4981857697937, 1]] 9.956824444577826731430502486048198784944403469953867412961885722016538277004397647478523847608439585b-60 197 , 200867255532373784442745261542645325315275374222849104412671 , [[7487, 1], [26828803997912886929710867041891989490486893845712448833, 1]] 4.978412222288913365715251243024099392472201734976933706480918076420014102865252788343208891152395343b-60 198 , 401734511064747568885490523085290650630550748445698208825343 , [[3, 3], [7, 1], [19, 1], [23, 1], [67, 1], [73, 1], [89, 1], [199, 1], [683, 1], [5347, 1], [20857, 1], [153649, 1], [599479, 1], [33057806959, 1], [242099935645987, 1]] 2.489206111144456682857625621512049696236100867488466853240452842062943292523389885322591187413241559b-60 199 , 803469022129495137770981046170581301261101496891396417650687 , [[164504919713, 1], [4884164093883941177660049098586324302977543600799, 1]] 1.244603055572228341428812810756024848118050433744233426620224871994705706534385815449042279165881751b-60 200 , 1606938044258990275541962092341162602522202993782792835301375 , [[3, 1], [5, 3], [11, 1], [17, 1], [31, 1], [41, 1], [101, 1], [251, 1], [401, 1], [601, 1], [1801, 1], [4051, 1], [8101, 1], [61681, 1], [268501, 1], [340801, 1], [2787601, 1], [3173389601, 1]] 6.223015277861141707144064053780124240590252168721167133101120487381613683353656259214578109477561187b-61
How to find number type
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 https://en.wikipedia.org/wiki/Repeating_decimal " A fraction in lowest terms with a prime denominator other than 2 or 5 (i.e. coprime to 10) always produces a repeating decimal. The length of the repetend (period of the repeating decimal) of 1/p is equal to the order of 10 modulo p. If 10 is a primitive root modulo p, the repetend length is equal to p − 1; if not, the repetend length is a factor of p − 1. This result can be deduced from Fermat's little theorem, which states that 10p−1 = 1 (mod p)." --------------------------------------------------------------------------------------- */ GiveRatioType(ratio):= block ( [denominator: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(denominator), FactorsList:map(first,FactorsList), print(denominator, 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
Conversion between :
- converting decimal fraction to binary : "... we repeatedly multiply the decimal fraction by 2. If the result is greater than or equal to 1, we add a 1 to our answer. If the result is less than 1, we add a 0 to our answer." (from Virginia Tech Online CS module [20])
Algorithm [21]:
- Multiply the input decimal fraction by two
- from above result
- take integer part as the binary digit
- take the fractional part as the starting point for the next step
- repeat until you either get to 0 or a periodic number
- read the number starting from the top - the first binary digit is the first digit after the comma
Example of conversion 0.1 decimal fraction to binary fraction :
0.1 * 2 = 0.2 -> 0 0.2 * 2 = 0.4 -> 0 0.4 * 2 = 0.8 -> 0 0.8 * 2 = 1.6 -> 1 0.6 * 2 = 1.2 -> 1 0.2 * 2 = 0.4 -> 0 0.4 * 2 = 0.8 -> 0 0.8 * 2 = 1.6 -> 1 0.6 * 2 = 1.2 -> 1 0.2 * 2 = 0.4 -> 0 0.4 * 2 = 0.8 -> 0 0.8 * 2 = 1.6 -> 1 0.6 * 2 = 1.2 -> 1 0.2 * 2 = 0.4 -> 0
Result:
Repeating fractions :[22]
0.(567) = 567/999 = 189/333 = 63/111 0.(0011) = 0011 / 1111 =(in decimal) 3/15 = 1/5

C
- itoa
- snprintf[23]
- Binary integer constant
- Macro BOOST_BINARY
- gmp
- mandelbrot-symbolics lbrary by Claude Heiland-Allen
itoa
itoa function [24]
/*
itoa example
http://www.cplusplus.com/reference/cstdlib/itoa/
*/
#include <stdio.h>
#include <stdlib.h>
int main ()
{
int i;
char buffer [33];
printf ("Enter a number: ");
scanf ("%d",&i);
itoa (i,buffer,10);
printf ("decimal: %s\n",buffer);
itoa (i,buffer,16);
printf ("hexadecimal: %s\n",buffer);
itoa (i,buffer,2);
printf ("binary: %s\n",buffer);
return 0;
}
Binary integer constant
Binary integer constant[25]
"Integer constants can be written as binary constants, consisting of a sequence of ‘0’ and ‘1’ digits, prefixed by ‘0b’ or ‘0B’. This is particularly useful in environments that operate a lot on the bit level (like microcontrollers).
The following statements are identical:
i = 42;
i = 0x2a;
i = 052;
i = 0b101010;
The type of these constants follows the same rules as for octal or hexadecimal integer constants, so suffixes like ‘L’ or ‘UL’ can be applied."
gmp
/*
C programme using gmp
gcc r.c -lgmp -Wall
http://gmplib.org/manual/Rational-Number-Functions.html#Rational-Number-Functions
*/
#include <stdio.h>
#include <gmp.h>
int main ()
{
// input = binary fraction as a string
char *sbr = "01001010010010100101001001010010010100101001001010010100100101001001010010100100101001010/11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
mpq_t q; // rational number;
int b =2 ; // base of numeral system
mpz_t n ;
mpz_t d ;
mpf_t f;
// init and set variables
mpq_init (q); // Initialize r and set it to 0/1.
mpq_set_str (q, sbr , b);
mpq_canonicalize (q); // It is the responsibility of the user to canonicalize the assigned variable before any arithmetic operations are performed on that variable.
mpq_canonicalize (q); // It is the responsibility of the user to canonicalize the assigned variable before any arithmetic operations are performed on that variable.
// n , d
mpz_inits(n,d,NULL);
mpq_get_num(n,q);
mpq_get_den(d, q);
//
mpf_init2(f, 100); // http://stackoverflow.com/questions/12804362/gmp-division-precision-or-printing-issue
mpf_set_q(f,q); // There is no rounding, this conversion is exact.
// print
gmp_printf ("decimal fraction = %Zd / %Zd \ndecimal canonical form = %Qd\n",n,d, q); //
gmp_printf ("binary fraction = %s \n", sbr); //
gmp_printf ("decimal floating point number : %.30Ff \n", f); //
// clear memory
mpq_clear (q);
mpz_clear (n);
mpz_clear (d);
mpf_clear (f);
return 0;
}
Output :
decimal fraction = 179622968672387565806504266 / 618970019642690137449562111 decimal canonical form = 179622968672387565806504266/618970019642690137449562111 binary fraction = 01001010010010100101001001010010010100101001001010010100100101001001010010100100101001010/11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 decimal floating point number : 0.290196557138708685358212602171
Haskell
Code by Claude Heiland-Allen: [26]
-- http://mathr.co.uk/blog/2014-10-13_converting_fractions_to_strings_of_digits.html
import Data.Fixed (mod')
import Data.List (nub)
import Data.Ratio ((%), denominator)
import Data.Numbers.Primes (primeFactors)
import System.Environment (getArgs)
data Digits = Digits
{ dNegative :: Bool
, dInteger
, dPreperiodic
, dPeriodic :: [Int]
} deriving Show
preperiod :: Digits -> Int
preperiod = length . dPreperiodic
period :: Digits -> Int
period = length . dPeriodic
digitsAtBase :: Int -> Rational -> Digits
digitsAtBase base rational
= Digits
{ dNegative = rational < 0
, dInteger = int
, dPreperiodic = pre
, dPeriodic = per
}
where
integer :: Integer
fraction :: Rational
(integer, fraction) = properFraction (abs rational)
int | integer == 0 = [0]
| otherwise = goInt integer []
goInt i ds
| i == 0 = ds
| otherwise = goInt i' (fromInteger d : ds)
where
(i', d) = i `divMod` baseZ
factors :: [Integer]
factors = map fromIntegral . nub . primeFactors $ base
isPreperiodic :: Rational -> Bool
isPreperiodic x = any (`divides` denominator x) factors
baseZ :: Integer
baseZ = fromIntegral base
baseQ :: Rational
baseQ = fromIntegral base
(pre, per) = goPre fraction
where
goPre :: Rational -> ([Int], [Int])
goPre x
| isPreperiodic x = first (d:) (goPre x')
| otherwise = ([], d : goPer x x')
where (d, x') = properFraction (baseQ * x)
goPer :: Rational -> Rational -> [Int]
goPer x0 x
| x0 == x = []
| otherwise = d : goPer x0 x'
where (d, x') = properFraction (baseQ * x)
first :: (a -> c) -> (a, b) -> (c, b)
first f (a, b) = (f a, b)
divides :: Integer -> Integer -> Bool
factor `divides` number = number `mod` factor == 0
digitsToString :: [String] -> Digits -> String
digitsToString digits Digits
{ dNegative = sign
, dInteger = int
, dPreperiodic = pre
, dPeriodic = per
}
= (if sign then "-" else "")
++ d int ++ "." ++ d pre ++ "(" ++ d per ++ ")"
where
d = concatMap (digits !!)
atBase :: Int -> Rational -> String
atBase base rational = digitsToString ds (digitsAtBase base rational)
where
ds | base <= 62 = map (:[]) $ ['0'..'9'] ++ ['A'..'Z'] ++ ['a'..'z']
| otherwise = [ "<" ++ show d ++ ">" | d <- [0 .. base - 1] ]
main :: IO ()
main = do
[sbase, sfraction] <- getArgs
let (snum, _:sden) = break ('/' ==) sfraction
base = read sbase
num = read snum
den = read sden
rational = num % den
putStrLn (atBase base rational)
Python
# https://wiki.python.org/moin/BitManipulation
# binary string to integer
>>> int('00100001', 2)
33
# conversion from binary string to hex string
>>> print "0x%x" % int('11111111', 2)
0xff
>>> print "0x%x" % int('0110110110', 2)
0x1b6
>>> print "0x%x" % int('0010101110101100111010101101010111110101010101', 2)
0xaeb3ab57d55
Other methods [27]
How to use numbers in computer programs ?
integer
- types
- limits and overflow
Limit
/*
gcc l.c -lm -Wall
./a.out
http://stackoverflow.com/questions/29592898/do-long-long-and-long-have-same-range-in-c-in-64-bit-machine
*/
#include <stdio.h>
#include <math.h> // M_PI; needs -lm also
#include <limits.h> // INT_MAX, http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html
int main(){
double lMax;
lMax = log2(INT_MAX);
printf("INT_MAX \t= %25d ; lMax = log2(INT_MAX) \t= %.0f \n",INT_MAX, lMax);
lMax = log2(UINT_MAX);
printf("UINT_MAX \t= %25u ; lMax = log2(UINT_MAX) \t= %.0f \n", UINT_MAX, lMax);
lMax = log2(LONG_MAX);
printf("LONG_MAX \t= %25ld ; lMax = log2(LONG_MAX) \t= %.0f \n",LONG_MAX, lMax);
lMax = log2(ULONG_MAX);
printf("ULONG_MAX \t= %25lu ; lMax = log2(ULONG_MAX) \t= %.0f \n",ULONG_MAX, lMax);
lMax = log2(LLONG_MAX);
printf("LLONG_MAX \t= %25lld ; lMax = log2(LLONG_MAX) \t= %.0f \n",LLONG_MAX, lMax);
lMax = log2(ULLONG_MAX);
printf("ULLONG_MAX \t= %25llu ; lMax = log2(ULLONG_MAX) \t= %.0f \n",ULLONG_MAX, lMax);
return 0;
}
Results :
INT_MAX = 2147483647 ; lMax = log2(INT_MAX) = 31 UINT_MAX = 4294967295 ; lMax = log2(UINT_MAX) = 32 LONG_MAX = 9223372036854775807 ; lMax = log2(LONG_MAX) = 63 ULONG_MAX = 18446744073709551615 ; lMax = log2(ULONG_MAX) = 64 LLONG_MAX = 9223372036854775807 ; lMax = log2(LLONG_MAX) = 63 ULLONG_MAX = 18446744073709551615 ; lMax = log2(ULLONG_MAX) = 64
For example Wolf Jung in program Mandel makes a silent bounds check[28] :
// mndynamo.h by Wolf Jung (C) 2007-2014
typedef unsigned long long int qulonglong;
// mndcombi.cpp by Wolf Jung (C) 2007-2014
qulonglong mndAngle::wake(int k, int r, qulonglong &n)
{ if (k <= 0 || k >= r || r > 64) return 0LL;
If r is to big for unsigned long long int type it returns 0 to prevent ineger overflow.
GMP library has arbitrary precision rationals.
Rational
"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." [29]
So in numerical computations one can use only integer of floating points numbers ( rational ).
Binary
Numbers
In C one can use :
- bitwise operators [30]
In Maxima CAS one can use :
(%i1) ibase; (%o1) 10 (%i2) obase; (%o2) 10 (%i3) ibase:2; (%o3) 2 (%i4) x=1001110; (%o4) x=78
String
Calculation of binary numbers with as a string with replicating parts in Haskell (ghci):
-- by Claude Heiland-Allen
-- http://mathr.co.uk/blog/haskell.html
Prelude> let rep n s = concat (replicate n s)
Prelude> putStrLn $ ".(" ++ rep 88 "001" ++ "010)"
.(001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001010)
putStrLn $ ".(" ++ rep 87 "001" ++ "010001)"
.(001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001010001)
Prelude> putStrLn $ ".(" ++ rep 88 "001" ++ "0001)"
.(0010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010001)
Prelude> putStrLn $ ".(" ++ rep 88 "001" ++ "0010)"
.(0010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010)
In Python :
>>> bin(173)
'0b10101101'
>>> int('01010101111',2)
687
Literal
In python one can use binary literals :[31]
python
Python 2.7.5+ (default, Feb 27 2014, 19:37:08)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 0b101111
47
Irrational
The problem is that we are exploring environments based upon irrational numbers through computer machinery which works with finite rationals ! ( Alessandro Rosa )
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 [32] (the Diophantine Approximation [33])
- ratio of integers
- floating point number
- finite continued fractions
Inverse golden mean
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 :
More
Cardinality
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. " [34]
- "... 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) [35] "To be pedantically correct you should have said almost certainly is 1. " – David Hammen
Paritition
- paritition function : "partition numbers behave like fractals, possessing an infinitely-repeating structure" [36]
Random number
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 )
References
- ↑ wikipedia : Number base
- ↑ HOW TO WORK WITH ONE-DI MENSIONAL QUADRATIC MAPS G. Pastor , M. Romera, G. Álvarez, and F. Montoya
- ↑ What Every Programmer Should Know About Floating-Point Arithmetic
- ↑ Stackoverflow : Why Are Floating Point Numbers Inaccurate?
- ↑ home school math : The fascinating irrational numbers
- ↑ Tutorial: Floating-Point Binary by Kip Irvine
- ↑ Dual Numbers & Automatic Differentiation
- ↑ stackexchange 1/81
- ↑ wolframalpha : 3923/6173
- ↑ Binary expasnion by John McIntosh
- ↑ fractions to strings of digits by Claude Heiland-Allen
- ↑ knowledgedoor calculators: convert_a_ratio_of_integers
- ↑ R.Knott : Fractions – Decimals Calculator
- ↑ | Base Number - Decimal Number Conversion
- ↑ Decimal to Floating-Point Converter By Rick Regan
- ↑ wolframalpha binary to decimal conversion
- ↑ Recognizing Rational Numbers From Their Decimal Expansion by William Stein
- ↑ basic-mathematics : converting-repeating-decimals-to-fractions
- ↑ Rational Numbers From Their Decimal Expansion by William Stein
- ↑ Virginia Tech Online CS module
- ↑ Stackoverflow : How do you convert a fraction to binary ?
- ↑ Converting a repeating binary number to decimal (express as a series?)
- ↑ Where is the itoa function in Linux?
- ↑ itoa with GCC by Stuart
- ↑ gcc - Binary-constants
- ↑ Converting fractions to strings of digits by Claude Heiland-Allen
- ↑ stackoverflow : python int to binary
- ↑ wikipedia : Bounds checking
- ↑ stackoverflow questions : check-if-a-number-is-rational-in-python
- ↑ Joe McCullough : bitwise operators
- ↑ Stackoverflow : How do you express binary literals in Python?
- ↑ John D Cook : best-rational-approximation
- ↑ DISCOVERING EXACTLY WHEN A RATIONAL IS A BEST APPROXIMATE OF AN IRRATIONAL By KARI LOCK
- ↑ home school math : The fascinating irrational numbers
- ↑ stackoverflow questions : irrational-number-check-function
- ↑ Fractal Structure to Partition Function.
See also
- Discrete Mathematics : Number representations
- A-level_Computing : Binary_fractions
- sequence_of_fraction_in_the_elephant_valley
- Fractals : Iterations_in_the_complex_plane , wake