Exercise 1.44

The idea of smoothing a function is an important concept in signal processing. If f is a function and dx is some small number, then the smoothed version of f is the function whose value at a point x is the average of f(x-dx), f(x), and f(x+dx).Write a procedure smooth that takes as input a procedure that computes f and returns a procedure that computes the smoothed f . It is sometimes valuable to repeatedly smooth a function (that is, smooth the smoothed function, and so on) to obtain the n-folds moothed function. Show how to generate the n-fold smoothed function of any given function using smooth and repeated from Exercise 1.43.


这道题难度不大,smooth 函数返回一个计算3个数平均值的 lambda 函数就行。

(define dx 0.0001)
(define (smooth f)
(lambda (x) (/ (+ (f (- x dx))
(f x)
(f (+ x dx)))
3))) (define (n-fold-smooth f n)
(repeated f n)) ((smooth square) 5)
((smooth inc) 5) ((n-fold-smooth square 2) 5)
((n-fold-smooth inc 10) 5) ; 执行结果
25.000000006666667
6.0 625
15

sicp每日一题[1.44]的更多相关文章

  1. 老男孩IT教育-每日一题汇总

    老男孩IT教育-每日一题汇总 第几天 第几周 日期 快速访问链接 第123天 第二十五周 2017年8月25日 出现Swap file….already exists以下错误如何解决? 第122天 2 ...

  2. 【Java每日一题】20170106

    20170105问题解析请点击今日问题下方的"[Java每日一题]20170106"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; ...

  3. 【Java每日一题】20170105

    20170104问题解析请点击今日问题下方的"[Java每日一题]20170105"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; ...

  4. 【Java每日一题】20170104

    20170103问题解析请点击今日问题下方的"[Java每日一题]20170104"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; ...

  5. 【Java每日一题】20170103

    20161230问题解析请点击今日问题下方的"[Java每日一题]20170103"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; ...

  6. 【Java每日一题】20161230

    // 20161229问题解析请点击今日问题下方的"[Java每日一题]20161230"查看(问题解析在公众号首发,公众号ID:weknow619)package Dec2016 ...

  7. 【Java每日一题】20161229

    package Dec2016; import java.util.ArrayList; import java.util.List; public class Ques1229 { public s ...

  8. 【Java每日一题】20161228

    package Dec2016; import java.util.ArrayList; import java.util.List; public class Ques1228 { public s ...

  9. 【Java每日一题】20161227

    package Dec2016; public class Ques1227 { public static void main(String[] args){ } { c = 1; } int c ...

  10. 【Java每日一题】20161226

    package Dec2016; public class Ques1226 { static{ num = 1; } public static int num = 2; public static ...

随机推荐

  1. Linux自己制作rpm包

    制作rpm包 由源码包---->rpm包 安装制作rpm包工具包rpm-build 在制作过程中需要源码包和配置文件 rpmbuild制作rpm包的原理: 1.首先rpmbuild会先将源码包进 ...

  2. Django 不通过外键实现多表关联查询

    Django不通过外键实现多表关联查询 by:授客 QQ:1033553122 测试环境 Win 10   Python 3.5.4   Django-2.0.13.tar.gz 需求 不通过外键,使 ...

  3. c++17 auto非类型模板参数

    //用auto非类型模板参数 #include <iostream> using namespace std; template<auto c> auto foot() { c ...

  4. Jenkins如何使用CrumbIssuer防御CSRF攻击

    1.CSRF(跨站请求伪造)概述 在讲解Jenkins的跨站请求伪造(CSRF)保护机制之前,让我们首先对CSRF这一安全威胁及其重要性进行简明扼要的概述. 1.1  CSRF(跨站请求伪造)的原理 ...

  5. python global变量作用域

    python变量作用域 var1 = 123 def func(): var1 = 456 print(var1) func() #456 print(var1) #123 ============= ...

  6. 我用Awesome-Graphs看论文:解读X-Stream

    X-Stream论文:<X-Stream: Edge-centric Graph Processing using Streaming Partitions> 前面通过文章<论文图谱 ...

  7. 探索Amazon S3:存储解决方案的基石(Amazon S3使用记录)

    探索Amazon S3:存储解决方案的基石 本文为上一篇minio使用的衍生版 相关链接:1.https://www.cnblogs.com/ComfortableM/p/18286363 ​ 2.h ...

  8. RPA美团外卖商家中心批量发送消息

    美团外卖商家中心批量发送消息,首先我们需要确定给谁发,发送什么内容 给谁发:可以传入美团用户名.美团订单号.美团将通过此条件进行搜索进入会话框 发送什么内容:批量发送信息给不同的用户,比如给不同的订单 ...

  9. 6、SpringBoot2之整合Mybatis

    创建名为springboot_mybatis的新module,过程参考3.1节 6.1.引入相关依赖 注意:虽然本文使用的是 spring boot 2.7.18 和 MySQL 5.7 ,但是出于可 ...

  10. 3、SpringMVC之RequestMapping注解

    3.1.环境搭建 创建名为spring_mvc_demo的新module,过程参考2.1节 3.1.1.创建SpringMVC的配置文件 <?xml version="1.0" ...