- 浏览: 215612 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
andy1015:
请教下楼主rtx问题 ,可以么
用HttpClient实现同步RTX -
cgp17:
请教:Chukwa支持Push数据吗?目前看到的都是Polli ...
基于Hadoo的日志收集框架---Chukwa的源码分析(适配器、代理) -
jimmee:
尼玛, 现在iteye的质量下降到何种水准了.
Mahout协同过滤框架Taste的源码分析 -
aubdiy:
aubdiy 写道我擦。。。。 这你叫分析才看到, 还有个 “ ...
Mahout协同过滤框架Taste的源码分析 -
aubdiy:
我擦。。。。 这你叫分析
Mahout协同过滤框架Taste的源码分析
练习1.29
(define (sum term a next b) (if (> a b) 0 (+ (term a) (sum term (next a) next b)))) (define (integral f a b dx) (define (add-dx x) (+ x dx)) (* (sum f (+ a (/ dx 2.0)) add-dx b) dx)) (define (simpson f a b n) (define (add-kh k) (* k (/ (- b a) n))) (define (inc n) (+ n 1)) (define (term k) (cond ((= k 0) (f a)) ((= k n) (f b)) ((= (remainder k 2) 0) (* 2.0 (f (+ a (add-kh k))))) (else (* 4.0 (f (+ a (add-kh k))))))) (* (/ (/ (- b a) n) 3) (sum term 0 inc n)))
> (integral cube 0 1 0.01)
0.24998750000000042
> (integral cube 0 1 0.001)
0.249999875000001
> (simpson cube 0 1 100)
0.24999999999999992
> (simpson cube 0 1 1000)
0.2500000000000002
可见使用辛普森数值积分法确实能得到更为精确的结果
练习1.30
;; sum过程的迭代实现 (define (sum-iter term a next b) (define (iter a result) (if (> a b) result (iter (next a) (+ (term a) result)))) (iter a 0))
练习1.31
a. ;; product过程的迭代实现 (define (product term a next b) (define (iter a result) (if (> a b) result (iter (next a) (* (term a) result)))) (iter a 1)) ;; factorial过程的实现 (define (factorial n) (define (inc n) (+ n 1)) (define (identity x) x) (product identity 1 inc n)) ;; 基于product过程计算pi值 (define (pi-product n) (define (square x) (* x x)) (define (term k) (/ (* 4.0 k (+ k 1)) (square (+ (* 2.0 k) 1)))) (product-new term 1 inc n)) > (* 4 (pi-product 100)) 3.1493784731686008 > (* 4 (pi-product 1000)) 3.142377365093882 > (* 4 (pi-product 10000)) 3.1416711865344946 b. ;; product过程的递归实现 (define (product term a next b) (if (> a b) 1 (* (term a) (product term (next a) next b))))
练习1.32
;; accumulate过程的递归实现 (define (accumulate combiner null-value term a next b) (if (> a b) null-value (combiner (term a) (accumulate combiner null-value term (next a) next b)))) ;; accumulate过程的迭代实现 (define (accumulate combiner null-value term a next b) (define (iter a result) (if (> a b) result (iter (next a) (combiner (term a) result)))) (iter a null-value)) ;; 定义sum和product, 则需要实现其对应的combiner过程 ;; combiner过程需要两个参数:当前项和前面各项累计结果, 则对sum和product分别实现如下combiner过程 (define (add x y) (+ x y)) (define (pro x y) (* x y)) ;; 对应的sum和product过程为 (accumulate add 0 term a next b) (accumulate pro 1 term a next b)
练习1.33
;; filtered-accumulate过程的迭代实现 (define (filtered-accumulate filtered combiner null-value term a next b) (define (iter a result) (if (> a b) result (if (filtered a) (iter (next a) (combiner (term a) result)) (iter (next a) result)))) (iter a null-value)) a) (define (sum-prime a b) (define (inc n) (+ n 1)) (define (identity x) x) (filtered-accumulate prime? add 0 identity a inc b)) b) (define (pro-gcd i n) (define (inc n) (+ n 1)) (define (identity x) x) (filtered-accumulate gcd? pro 1 identity i inc n))
发表评论
-
SICP学习笔记 2.3.2 实例:符号求导
2012-12-12 09:59 1295练习2.56 (define (deriv ... -
SICP学习笔记 2.2.4 实例:一个图形语言
2012-12-11 21:49 1271练习2.44 (define (up-spl ... -
SICP学习笔记 2.2.3 序列作为一种约定的接口
2012-09-14 17:48 1038练习2.33 ;; map过程即为使用过程p ... -
SICP学习笔记 2.2.2 层次性结构
2012-09-05 15:54 1211练习2.24 ;; 嵌套结构的list 1 ... -
SICP学习笔记 2.2.1 序列的表示
2012-08-31 17:31 1157练习2.17 ;; 直接利用已经实现的lis ... -
SICP学习笔记 2.1.4 扩展练习:区间算术
2012-08-28 17:12 1307练习2.7 ;; 抽象对象"区间& ... -
SICP学习笔记 2.1.3 数据意味着什么
2012-08-26 11:07 1099练习2.4 (define (new-con ... -
SICP学习笔记 2.1.2 抽象屏障
2012-08-18 22:05 877练习2.2 (define (make-poin ... -
SICP学习笔记 2.1.1 实例: 有理数的算术运算
2012-08-18 21:44 856练习 2.1 (define (make-r ... -
SICP学习笔记 1.3.4 过程作为返回值
2012-08-12 11:44 961练习 1.40 (define (cubic ... -
SICP学习笔记 1.3.3 过程作为一般性的方法
2012-08-12 11:38 866练习 1.35 φ^2 = φ+1 == ... -
SICP学习笔记 1.3.2 用lambda构造过程
2012-07-13 08:50 747练习 1.34 > (d ... -
SICP学习笔记 1.2.6 实例:素数检测
2012-06-04 11:08 1035练习1.22 ;; runtime函数在stk、ra ... -
SICP学习笔记 1.2.5 最大公约数
2012-05-17 17:35 812练习 1.20 (define (gcd a ... -
SICP学习笔记 1.2.4 求幂
2012-05-11 18:03 877练习1.16 根 ... -
SICP学习笔记 1.2.3 增长的阶
2012-05-09 21:06 1453练习1.14 (define (count-chan ... -
SICP学习笔记 1.1.7 实例:使用牛顿法求平方根
2012-04-25 18:02 1291练习1.6 应用序会对 (def ... -
SICP学习笔记 1.2.2 树形递归
2012-04-25 18:18 911练习1.11 递归过程 (defin ... -
SICP学习笔记 1.2.1 线性的递归和迭代
2012-04-24 17:22 842练习1.9 对于过程 (define ... -
SICP学习笔记 1.1.6 条件表达式和谓词
2012-04-24 17:18 811练习1.1 10 12 8 3 6 ...
相关推荐
sicp in python 中文版 sicp in python 中文版 sicp in python 中文版 !!!download>>>https://github.com/wizardforcel/sicp-py-zh
SICP中文第二版SICP中文第二版SICP中文第二版SICP中文第二版SICP中文第二版
SICP-Python版本
Python SICP epub版本,很适合学习抽象的思想,用Python版本比lisp更实用
SICP 使用的scheme解释器 以前叫DrScheme
sicp 2.2.4节图形语言的racket程序包,配置路径,C:\Users\Administrator\AppData\Roaming\Racket
Learn_sicp 学习sicp的一些代码
SICP 解题集
SICP CHINESE ENGLISH THE SECOND EDITION SICP CHINESE ENGLISH THE SECOND EDITION
sicp_notes SICP笔记和练习 资源 笔记 使用第一版,最高为ex 1.24。 从ex 1.31开始切换到第二版。
SICP 习题答案 计算机程序的构造和解释 1-3章 习题答案
sicp in python 中文版 sicp in python 中文版 sicp in python 中文版 download : https://github.com/wizardforcel/sicp-py-zh
请参考那些正在学习SICP的人。 笔记 如果你想在 gauch 中使用随机函数 (use math.mt-random) (define m (make <mersenne> :seed (sys-time))) (mt-random-integer m 1000) (define (random n) (mt-random-integer ...
SICP习题解答,主要第一章的内容习题答案
资源来自pypi官网。 资源全名:sicp-0.0.1b102.dev4.tar.gz
sicpsome codes during learning sicp 2.58.b todo 七皇后问题 2.42 2.73-2.74 缺少put和get函数 第二章 2.4 2.5 3.23-3.27 [双链表]environmentOS X 10.10.3DrRacket
sicp-in-python(中文版+英文版)PDF 背景. SICP 全称Structure and Interpretation of Computer Programs,翻译过来叫《计算机程序的构造和解释》使用python
资源名称:sicp 和 操作系统:精髓与设计原理第七版资源截图: 资源太大,传百度网盘了,链接在附件中,有需要的同学自取。
前言说,这是一本给MIT学生的入门级...用摄影打比方,这本书不比较尼康和佳能,不介绍繁杂的机型和参数,不介绍后期处理的技巧。这本书只讨论光线、色彩和构图,以及如何在不同场景拿捏这些基本原则组合出美妙的照片。