Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (42 sloc) 1.05 KB
(load "3.55.scm")
(load "lib/exploit_stream.scm")
(display-line "------3.65------")
(define (ln2-sequence n)
(cons-stream (/ 1.0 n)
(stream-map - (ln2-sequence (+ n 1)))))
(define ln2
(partial-sums (ln2-sequence 1)))
(display-top10-line (ln2-sequence 1))
; 1.
; -.5
; .3333333333333333
; -.25
; .2
; -.16666666666666666
; .14285714285714285
; -.125
; .1111111111111111
; -.1
(display-top10-line (euler-transform (ln2-sequence 1)))
; 3.5714285714285754e-2
; -.0098039215686275
; 4.032258064516098e-3
; -2.0408163265305534e-3
; 1.1737089201877826e-3
; -7.363770250368162e-4
; 4.921259842519676e-4
; -3.4506556245686437e-4
; 2.512562814070418e-4
; -1.8860807242548905e-4
(display-top10-line (accelerated-sequence euler-transform (ln2-sequence 1)))
; 1.
; 3.5714285714285754e-2
; 8.068879311952798e-4
; 1.1143777059114406e-5
; 1.0412414891455865e-7
; 6.780819845601064e-10
; 2.3461045685571884e-12
; -3.7828082000095906e-14
; 1.2449987764879285e-15
; -3.570337399341144e-17
; 可以看到,和 pi-stream 一样,加强型的序列很快就收敛到 e-10 次方了。