#  2.  2. ../petermulkers/dec2frac Show tree


How to convert a decimal number into a fraction ?

example :

given decimal number:      1.13207...

r0=                      1.13207...
r1 =  1/(O.13207...) =    7.57142...
r2 =  1/(0.57142...) =    1.75
r3 =  1/(0.75)       =    1.33333...
r4 =  1/(0.33333...) =    3
p = r0*r1*r2*r3*r4 = 60
q = r1*r2*r3*r4 = 53
fraction: p/q = 60/53


Why does this work ?

The product of all the remainders in a finite
continued-fraction equals the most simple numerator.

p/q  = [a0;a1,a2,a3,...an]
p/q  = [a0;a1,a2,a3,...rn]
...
p/q  = [a0;a1,a2,r3]
p/q  = [a0;a1,r2]
p/q  = [a0;r1]
p/q  = r0

p = r0*r1*r2*r3*...*rn


Theorems:

finite continued fraction :

[a0;a1,a2,a3,…,a(k-1),ak,a(k+1),…,a(n-1),an]
A finite continued fraction is rational,
so it can be represented as a normal fraction.
[a0;a1,a2,a3,…,a(k-1),ak,a(k+1),…,a(n-1),an] = p/q
remainder :
rk = [ak,a(k+1),…,a(n-1),an]
rk = ak + 1/r(k+1)               (1)
each remainder of a continued fraction can
be seen as another continued fraction.

When the continued fraction is finite, so are
the remainders, and so they can be represented
by normal fractions.
 

rk = pk/qk                      (2)


The last remainder of a finite continued fraction is
a whole number so its denominator equals 1.

rn = pn/qn = pn/1
qn = 1                          (3)


The relation between numerators and denominators
of succesive remainders :

rk = ak + 1/r(k+1) (1)
pk/qk = ak + 1/(p(k+1)/q(k+1)) (2)in((1)
pk/qk = ak + q(k+1)/p(k+1)
pk/qk = (ak*p(k+1) + q(k+1)) / p(k+1)
and so
pk = ak*p(k+1) + q(k+1)
and
qk = p(k+1) or pk = q(k-1)        (4)


Proof with nth order continued fraction:

What we want to proof:

r0*r1*r2*…*r(n-1)*rn =? p0
implement:(2)
(p0/q0)*(p1/q1)*(p2/q2)*…*(p(n-1)/q(n-1))*(pn/qn) =? p0
implement:(3)
(p0/q0)*(p1/q1)*(p2/q2)*…*(p(n-1)/q(n-1))*(pn/1) =? p0
(p0/q0)*(p1/q1)*(p2/q2)*…*(p(n-1)/q(n-1))*pn =? p0
implement:(4)
(p0/q0)*(p1/q1)*(p2/q2)*…*(p(n-1)/q(n-1))*q(n-1) =? p0
(p0/q0)*(p1/q1)*(p2/q2)*…*p(n-1) =? p0
implement:(4)
(p0/q0)*(p1/q1)*(p2/q2)*…*q(n-2) =? p0

(p0/q0)*(p1/q1)*(p2/q2)*q2=? p0
(p0/q0)*(p1/q1)*p2=? p0
implement:(4)
(p0/q0)*(p1/q1)*q1=? p0
(p0/q0)*p1 =? p0
implement:(4)
(p0/q0)*q0 =? p0
p0 = p0

Proof with 3th order (n=3) continued fraction:

r0*r1*r2*r3 =? p0
(p0/q0)*(p1/q1)*(p2/q2)*(p3/q3) =? p0
(p0/q0)*(p1/q1)*(p2/q2)*(p3/1) =? p0
(p0/q0)*(p1/q1)*(p2/q2)*(q2/1) =? p0
(p0/q0)*(p1/q1)*p2=? p0
(p0/q0)*(p1/q1)*q1=? p0
(p0/q0)*p1 =? p0
(p0/q0)*q0 =? p0
p0 = p0

Peter Mulkers
Belgium
P.Mulkers@GMX.net