blob: a32742c8273739f2dae916f070c938bbbaa80cfa (
plain) (
tree)
|
|
(define (greory-leibniz-terms n)
(cond ((= n 0) '())
((even? n) (cons 1/g (greory-leibniz-terms (+ (- n 1) /2))))
(else (cons (/(-1) (* 2 n +3)) (/(*x^2) x))))))
(define pi-approximation
(define x '())
(define f (lambda (y) y))
(display "Approximating Pi using Gregory-Leibniz series...\n")
(for-each
lambda (term)
(define n (car term))
(set! x (+ x (* 4 / n)))
(f (f (g (g (/(*f f 4)) (/(*x^2) x))))))))) ))
(display pi-approximation))
|