Use Binet's formula entirely within . Set
Here pairs mean the rational and radical coefficients. An exact program using the preceding procedures is
z = mkRat(0,1); one = mkRat(1,1)
half = mkRat(1,2)
phi = mkIrr(half,half)
psi = mkIrr(half,negRat(half))
c = mkIrr(z,mkRat(1,5))
p = mkIrr(one,z); q = mkIrr(one,z)
for i = 0,...,n-1:
    minusQ = mkIrr(negRat(q.rat),negRat(q.irr))
    OutIrr(mulIrr(c,addIrr(p,minusQ)))
    Out.Ln()
    p = mulIrr(p,phi)
    q = mulIrr(q,psi)
At iteration , and , so the printed value is exactly . The irrational coefficient cancels algebraically, and the rational result is an integer. This prints ; to use the convention , initialize p=phi and q=psi. There are field operations, with growing arbitrary-precision arithmetic costs kept separate from that count.

Articles by others on the same topic (0)

There are currently no matching articles.