1.31

secje posted @ 2010年7月09日 06:24 in sicp , 1351 阅读
(define (product term a next b)
  (if (> a b)
      1
      (* (term a)
         (product term (next a) next b))))
(define (inc n) (+ n 1))
(define (indentity x) x)
(define (factoral n)
  (product indentity 1 inc n))
(define (pi-up n)
  (cond ((= n 1) 2)
        ((even? n) (+ n 2))
        (else (+ n 1))))
(define (pi-down n)
  (cond ((even? n ) (+ n 1))
        (else (+ n 2))))
(define (sequare x) (* x x))
(define (get-pi n)
  (* 1.0 (/ (product pi-up 1 inc n)
            (product pi-down 1 inc n))))
(define (pi-all n)
  (cond ((= n 1) (/ 2 3))
        ((even? n) (/ (+ n 2) (+ n 1)))
        (else (/ (+ n 1) (+ n 2)))))
(define (fast-pi n)
  (* 1.0 (product pi-all 1 inc n)))
(define (product term a next b result)
  (if (> a b)
      result
      (product term (next a) next b (* result (term a)))))
(define (product term a next b)
  (define (iter a result)
    (iter (next a)
          (* (term a) result)))
  (iter a 1))
전설 서구 说:
2021年2月26日 22:13

This article gives the light in which we can observe the reality. This is very nice one and gives indepth information. Thanks for this nice article. https://putlocker.wine/


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter