racional = a/b : siendo a y b numeros enteros.
Usando el metodo como Georg Ferdinand Ludwig Philipp Cantor demostro que los racionales son contables podemos crear un pequeñito programa para sacar el i-esimo racional de la tabla de cantor:
from math import sqrt
def rational(i):
b = int((sqrt(1+8*i)-1)/2)
n = i - (b**2 + b)/2 + 1
d = b + 2 - n
return (n,d)
for i in xrange(100):
(n,d) = rational(i)
print "(%d) %d/%d \t= %f"%(i,n,d,float(n)/float(d))
Bueno, La tabla de Cantor es sencilla, el numerador aumenta columna a columna desde 1 hasta aleph_0 y el denumenador fila a fila de 1 a aleph_0, de esta forma todos los nuemros racionales son cubiertos por la tabla, y por tanto son contables, se les puede asociar uno a uno un elemento de los enteros.
La tabla:
1/1 2/1 3/1 4/1 5/1 6/1 7/1 8/1 9/1 ...
1/2 2/2 3/2 4/2 5/2 6/2 7/2 8/2 9/2 ...
1/3 2/3 3/3 4/3 5/3 6/3 7/3 8/3 9/3 ...
1/4 2/4 3/4 4/4 5/4 6/4 7/4 8/4 9/4 ...
1/5 2/5 3/5 4/5 5/5 6/5 7/5 8/5 9/5 ...
1/6 2/6 3/6 4/6 5/6 6/6 7/6 8/6 9/6 ...
1/7 2/7 3/7 4/7 5/7 6/7 7/7 8/7 9/7 ...
1/8 2/8 3/8 4/8 5/8 6/8 7/8 8/8 9/8 ...
1/9 2/9 3/9 4/9 5/9 6/9 7/9 8/9 9/9 ...
Y el conteo:
0 2 5 9 14 20 27 35 44 ...
1 4 8 13 19 26 34 43 53 ...
3 7 12 18 25 33 42 52 ...
6 11 17 24 32 41 51 ...
10 16 23 31 40 50 ...
15 22 30 39 49 ...
21 29 38 48 ...
28 37 47 ...
36 46 ...
45 ...
...
Resultado de la ejecucion del codigo:
(0) 1/1 = 1.000000
(1) 1/2 = 0.500000
(2) 2/1 = 2.000000
(3) 1/3 = 0.333333
(4) 2/2 = 1.000000
(5) 3/1 = 3.000000
(6) 1/4 = 0.250000
(7) 2/3 = 0.666667
(8) 3/2 = 1.500000
(9) 4/1 = 4.000000
(10) 1/5 = 0.200000
(11) 2/4 = 0.500000
(12) 3/3 = 1.000000
(13) 4/2 = 2.000000
(14) 5/1 = 5.000000
(15) 1/6 = 0.166667
(16) 2/5 = 0.400000
(17) 3/4 = 0.750000
(18) 4/3 = 1.333333
(19) 5/2 = 2.500000
(20) 6/1 = 6.000000
(21) 1/7 = 0.142857
(22) 2/6 = 0.333333
(23) 3/5 = 0.600000
(24) 4/4 = 1.000000
(25) 5/3 = 1.666667
(26) 6/2 = 3.000000
(27) 7/1 = 7.000000
(28) 1/8 = 0.125000
(29) 2/7 = 0.285714
(30) 3/6 = 0.500000
(31) 4/5 = 0.800000
(32) 5/4 = 1.250000
(33) 6/3 = 2.000000
(34) 7/2 = 3.500000
(35) 8/1 = 8.000000
(36) 1/9 = 0.111111
(37) 2/8 = 0.250000
(38) 3/7 = 0.428571
(39) 4/6 = 0.666667
(40) 5/5 = 1.000000
(41) 6/4 = 1.500000
(42) 7/3 = 2.333333
(43) 8/2 = 4.000000
(44) 9/1 = 9.000000
(45) 1/10 = 0.100000
(46) 2/9 = 0.222222
(47) 3/8 = 0.375000
(48) 4/7 = 0.571429
(49) 5/6 = 0.833333
(50) 6/5 = 1.200000
(51) 7/4 = 1.750000
(52) 8/3 = 2.666667
(53) 9/2 = 4.500000
(54) 10/1 = 10.000000
(55) 1/11 = 0.090909
(56) 2/10 = 0.200000
(57) 3/9 = 0.333333
(58) 4/8 = 0.500000
(59) 5/7 = 0.714286
(60) 6/6 = 1.000000
(61) 7/5 = 1.400000
(62) 8/4 = 2.000000
(63) 9/3 = 3.000000
(64) 10/2 = 5.000000
(65) 11/1 = 11.000000
(66) 1/12 = 0.083333
(67) 2/11 = 0.181818
(68) 3/10 = 0.300000
(69) 4/9 = 0.444444
(70) 5/8 = 0.625000
(71) 6/7 = 0.857143
(72) 7/6 = 1.166667
(73) 8/5 = 1.600000
(74) 9/4 = 2.250000
(75) 10/3 = 3.333333
(76) 11/2 = 5.500000
(77) 12/1 = 12.000000
(78) 1/13 = 0.076923
(79) 2/12 = 0.166667
(80) 3/11 = 0.272727
(81) 4/10 = 0.400000
(82) 5/9 = 0.555556
(83) 6/8 = 0.750000
(84) 7/7 = 1.000000
(85) 8/6 = 1.333333
(86) 9/5 = 1.800000
(87) 10/4 = 2.500000
(88) 11/3 = 3.666667
(89) 12/2 = 6.000000
(90) 13/1 = 13.000000
(91) 1/14 = 0.071429
(92) 2/13 = 0.153846
(93) 3/12 = 0.250000
(94) 4/11 = 0.363636
(95) 5/10 = 0.500000
(96) 6/9 = 0.666667
(97) 7/8 = 0.875000
(98) 8/7 = 1.142857
(99) 9/6 = 1.500000
No comments:
Post a Comment