1 Star 0 Fork 0

jacklisp/Learning-SICP

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
lec3b.chn+eng.ass 109.46 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215
[Script Info]
; Script generated by Aegisub 3.0.4
; http://www.aegisub.org/
Title: Default Aegisub file
ScriptType: v4.00+
WrapStyle: 0
ScaledBorderAndShadow: yes
Collisions: Normal
Last Style Storage: Default
Scroll Position: 1174
Active Line: 1179
Video Zoom Percent: 0.625
Audio URI: G:\untitled\ref\lec3b_480_muxed2.mp4
Video File: G:\untitled\ref\lec3b_480_muxed2.mp4
Video Aspect Ratio: c1.33333
Video Position: 78794
PlayResX: 640
PlayResY: 480
YCbCr Matrix: TV.601
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: EN,Calisto MT,21,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,1,0,2,10,10,30,1
Style: Declare,微软雅黑,30,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,2,0,8,10,10,10,1
Style: staff,微软雅黑,30,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,0,2,5,10,10,10,1
Style: title,微软雅黑,35,&H001D64D9,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,0,1,5,10,10,10,1
Style: Default,雅黑宋体,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,1,0,2,10,10,30,1
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:19.10,0:00:23.41,EN,,0,0,0,,PROFESSOR: Well, Hal just told us how you build robust systems.
Dialogue: 0,0:00:23.80,0:00:26.17,EN,,0,0,0,,The key idea was--
Dialogue: 0,0:00:26.81,0:00:30.20,EN,,0,0,0,,I'm sure that many of you don't really assimilate that yet--
Dialogue: 0,0:00:30.20,0:00:33.77,EN,,0,0,0,,but the key idea is that in order to make a system that's robust,
Dialogue: 0,0:00:33.93,0:00:36.48,EN,,0,0,0,,it has to be insensitive to small changes,
Dialogue: 0,0:00:36.60,0:00:37.37,EN,,0,0,0,,that is,
Dialogue: 0,0:00:37.37,0:00:40.90,EN,,0,0,0,,a small change in the problem should lead to only a small change in the solution.
Dialogue: 0,0:00:41.32,0:00:42.90,EN,,0,0,0,,There ought to be a continuity.
Dialogue: 0,0:00:42.90,0:00:45.94,EN,,0,0,0,,The space of solutions ought to be continuous in this space of problems.
Dialogue: 0,0:00:46.25,0:00:48.76,EN,,0,0,0,,The way he was explaining how to do that
Dialogue: 0,0:00:49.46,0:00:54.78,EN,,0,0,0,,was instead of solving a particular problem at every level of decomposition of the problem at the subproblems,
Dialogue: 0,0:00:55.08,0:00:56.78,EN,,0,0,0,,where you solve the class of problems,
Dialogue: 0,0:00:56.78,0:01:00.40,EN,,0,0,0,,which are a neighborhood of the particular problem that you're trying to solve.
Dialogue: 0,0:01:01.40,0:01:04.76,EN,,0,0,0,,The way you do that is by producing a language at that level of detail
Dialogue: 0,0:01:04.76,0:01:10.33,EN,,0,0,0,,in which the solutions to that class of problems is representable in that language.
Dialogue: 0,0:01:11.37,0:01:15.09,EN,,0,0,0,,Therefore when you change makes more changes to the problem you're trying to solve,
Dialogue: 0,0:01:15.09,0:01:19.29,EN,,0,0,0,,you generally have to make only small local changes to the solution you've constructed,
Dialogue: 0,0:01:19.29,0:01:22.26,EN,,0,0,0,,because at the level of detail you're working,
Dialogue: 0,0:01:22.26,0:01:24.26,EN,,0,0,0,,there's a language where you can express
Dialogue: 0,0:01:24.80,0:01:28.14,EN,,0,0,0,,the various solutions to alternate problems of the same type.
Dialogue: 0,0:01:30.04,0:01:33.74,EN,,0,0,0,,Well that's the beginning of a very important idea,
Dialogue: 0,0:01:34.40,0:01:38.61,EN,,0,0,0,,the most important perhaps idea that makes computer science more powerful
Dialogue: 0,0:01:38.61,0:01:42.37,EN,,0,0,0,,than most of the other kinds of engineering disciplines we know about.
Dialogue: 0,0:01:43.38,0:01:44.73,EN,,0,0,0,,What we've seen so far
Dialogue: 0,0:01:44.73,0:01:48.78,EN,,0,0,0,,is sort of how to use embedding of languages.
Dialogue: 0,0:01:49.26,0:01:53.36,EN,,0,0,0,,And, of course, the power of embedding languages partly comes from
Dialogue: 0,0:01:54.12,0:01:56.86,EN,,0,0,0,,procedures like this one that I showed you yesterday.
Dialogue: 0,0:01:57.37,0:02:02.13,EN,,0,0,0,,What you see here is the derivative program that we described yesterday.
Dialogue: 0,0:02:02.13,0:02:05.92,EN,,0,0,0,,It's a procedure that takes a procedure as an argument
Dialogue: 0,0:02:06.00,0:02:07.92,EN,,0,0,0,,and returns a procedure as a value.
Dialogue: 0,0:02:09.61,0:02:12.65,EN,,0,0,0,,And using such things is very nice.
Dialogue: 0,0:02:12.65,0:02:14.65,EN,,0,0,0,,You can make things like push combinators
Dialogue: 0,0:02:14.65,0:02:16.86,EN,,0,0,0,,and all that sort of wonderful thing that you saw last time.
Dialogue: 0,0:02:17.68,0:02:20.54,EN,,0,0,0,,However, now I'm going to really muddy the waters.
Dialogue: 0,0:02:21.56,0:02:25.90,EN,,0,0,0,,See this confuses the issue of what's the procedure and what is data,
Dialogue: 0,0:02:26.56,0:02:27.81,EN,,0,0,0,,but not very badly.
Dialogue: 0,0:02:28.42,0:02:30.90,EN,,0,0,0,,What we really want to do is confuse it very badly.
Dialogue: 0,0:02:31.18,0:02:32.44,EN,,0,0,0,,And the best way to do that
Dialogue: 0,0:02:32.44,0:02:37.62,EN,,0,0,0,,is to get involved with the manipulation of the algebraic expressions that the procedures themselves are expressed in.
Dialogue: 0,0:02:39.73,0:02:45.58,EN,,0,0,0,,So at this point, I want to talk about instead of things like on this slide,
Dialogue: 0,0:02:45.89,0:02:49.72,EN,,0,0,0,,the derivative procedure being a thing that manipulates a procedure--
Dialogue: 0,0:02:49.72,0:02:51.94,EN,,0,0,0,,this is a numerical method you see here.
Dialogue: 0,0:02:51.94,0:02:58.93,EN,,0,0,0,,And what you're seeing is a representation of the numerical approximationto the derivative.
Dialogue: 0,0:02:59.29,0:03:00.44,EN,,0,0,0,,That's what's here.
Dialogue: 0,0:03:00.86,0:03:04.93,EN,,0,0,0,,In fact what I'd like to talk about is instead things that look like this.
Dialogue: 0,0:03:06.05,0:03:11.33,EN,,0,0,0,,And what we have here are rules from a calculus book.
Dialogue: 0,0:03:12.09,0:03:16.17,EN,,0,0,0,,These are rules for finding the derivatives of the expressions
Dialogue: 0,0:03:16.70,0:03:20.58,EN,,0,0,0,,that one might write in some algebraic language.
Dialogue: 0,0:03:21.64,0:03:24.41,EN,,0,0,0,,It says things like a derivative of a constant is 0.
Dialogue: 0,0:03:25.13,0:03:29.09,EN,,0,0,0,,The derivative of the valuable with respect to which you are taking the derivative is 1.
Dialogue: 0,0:03:29.32,0:03:31.93,EN,,0,0,0,,The derivative of a constant times the function
Dialogue: 0,0:03:32.09,0:03:34.37,EN,,0,0,0,,is the constant times the derivative of the function,
Dialogue: 0,0:03:34.77,0:03:36.04,EN,,0,0,0,,and things like that.
Dialogue: 0,0:03:38.05,0:03:41.38,EN,,0,0,0,,These are exact expressions. These are not numerical approximations.
Dialogue: 0,0:03:42.96,0:03:44.52,EN,,0,0,0,,Can we make programs?
Dialogue: 0,0:03:44.52,0:03:52.24,EN,,0,0,0,,And, in fact, it's very easy to make programs that manipulate these expressions.
Dialogue: 0,0:03:56.38,0:03:59.52,EN,,0,0,0,,Well let's see. Let's look at these rules in some detail.
Dialogue: 0,0:04:01.08,0:04:05.22,EN,,0,0,0,,You all have seen these rules in your elementary calculus class at one time or another.
Dialogue: 0,0:04:05.98,0:04:12.12,EN,,0,0,0,,And you know from calculus that it's easy to produce derivatives of arbitrary expressions.
Dialogue: 0,0:04:12.53,0:04:16.05,EN,,0,0,0,,You also know from your elementary calculus that it's hard to produce integrals.
Dialogue: 0,0:04:16.98,0:04:19.37,EN,,0,0,0,,Yet integrals and derivatives are opposites of each other.
Dialogue: 0,0:04:19.52,0:04:21.28,EN,,0,0,0,,They're inverse operations.
Dialogue: 0,0:04:21.61,0:04:23.30,EN,,0,0,0,,And they have the same rules.
Dialogue: 0,0:04:24.16,0:04:29.68,EN,,0,0,0,,What is special about these rules that makes it possible for one
Dialogue: 0,0:04:29.68,0:04:33.65,EN,,0,0,0,,to produce derivatives easily and integrals why it's so hard?
Dialogue: 0,0:04:34.85,0:04:36.98,EN,,0,0,0,,Let's think about that very simply.
Dialogue: 0,0:04:37.40,0:04:38.38,EN,,0,0,0,,Look at these rules.
Dialogue: 0,0:04:39.36,0:04:43.06,EN,,0,0,0,,Every one of these rules, when used in the direction for taking derivatives,
Dialogue: 0,0:04:43.06,0:04:44.80,EN,,0,0,0,,which is in the direction of this arrow,
Dialogue: 0,0:04:46.68,0:04:49.16,EN,,0,0,0,,the left side is matched against your expression,
Dialogue: 0,0:04:49.16,0:04:53.05,EN,,0,0,0,,and the right side is the thing which is the derivative of that expression.
Dialogue: 0,0:04:54.02,0:04:55.65,EN,,0,0,0,,The arrow is going that way.
Dialogue: 0,0:04:57.37,0:05:00.45,EN,,0,0,0,,In each of these rules,
Dialogue: 0,0:05:01.24,0:05:03.72,EN,,0,0,0,,the expressions on the right-hand side of the rule
Dialogue: 0,0:05:03.72,0:05:06.56,EN,,0,0,0,,that are contained within derivatives are subexpressions,
Dialogue: 0,0:05:06.56,0:05:10.29,EN,,0,0,0,,are proper subexpressions, of the expression on the left-hand side.
Dialogue: 0,0:05:10.60,0:05:13.25,EN,,0,0,0,,So here we see the derivative of the sum,
Dialogue: 0,0:05:13.92,0:05:16.13,EN,,0,0,0,,witch is the expression on the left-hand side
Dialogue: 0,0:05:16.13,0:05:18.38,EN,,0,0,0,,is the sum of the derivatives of the pieces.
Dialogue: 0,0:05:20.08,0:05:24.49,EN,,0,0,0,,So the rule of moving to the right are reduction rules.
Dialogue: 0,0:05:25.02,0:05:26.61,EN,,0,0,0,,The problem becomes easier.
Dialogue: 0,0:05:27.56,0:05:31.48,EN,,0,0,0,,I make, I turn a big complicated problem it's lots of smaller problems
Dialogue: 0,0:05:32.44,0:05:35.76,EN,,0,0,0,,and then combine the results, a perfect place for recursion to work.
Dialogue: 0,0:05:36.58,0:05:40.85,EN,,0,0,0,,If I'm going in the other direction like this,
Dialogue: 0,0:05:41.81,0:05:45.13,EN,,0,0,0,,if I'm trying to produce integrals, well there are several problems you see here.
Dialogue: 0,0:05:45.24,0:05:49.09,EN,,0,0,0,,First of all, if I try to integrate an expression like a sum,
Dialogue: 0,0:05:49.21,0:05:50.81,EN,,0,0,0,,more than one rule matches.
Dialogue: 0,0:05:50.81,0:05:52.10,EN,,0,0,0,,Here's one that matches.
Dialogue: 0,0:05:52.48,0:05:53.65,EN,,0,0,0,,Here's one that matches.
Dialogue: 0,0:05:54.81,0:05:57.09,EN,,0,0,0,,I don't know which one to take. And they may be different.
Dialogue: 0,0:05:57.70,0:06:00.00,EN,,0,0,0,,I may get to explore different things.
Dialogue: 0,0:06:00.25,0:06:03.64,EN,,0,0,0,,Also, the expressions become larger in that direction.
Dialogue: 0,0:06:04.53,0:06:06.30,EN,,0,0,0,,And when the expressions become larger,
Dialogue: 0,0:06:06.30,0:06:10.56,EN,,0,0,0,,then there's no guarantee that any particular path I choose will terminate,
Dialogue: 0,0:06:10.94,0:06:13.46,EN,,0,0,0,,because we will only terminate by accidental cancellation.
Dialogue: 0,0:06:14.24,0:06:18.05,EN,,0,0,0,,So that's why integrals are complicated searches and hard to do.
Dialogue: 0,0:06:19.12,0:06:20.96,EN,,0,0,0,,Right now I don't want to do anything as hard as that.
Dialogue: 0,0:06:21.49,0:06:23.06,EN,,0,0,0,,Let's work on derivatives for a while.
Dialogue: 0,0:06:24.14,0:06:28.13,EN,,0,0,0,,Well, these rules are ones you know for the most part hopefully.
Dialogue: 0,0:06:28.78,0:06:31.88,EN,,0,0,0,,So let's see if we can write a program which is these rules.
Dialogue: 0,0:06:32.22,0:06:33.72,EN,,0,0,0,,And that should be very easy.
Dialogue: 0,0:06:34.89,0:06:36.21,EN,,0,0,0,,Just write the program.
Dialogue: 0,0:06:36.69,0:06:39.29,EN,,0,0,0,,See, because while I showed you is that it's a reduction rule,
Dialogue: 0,0:06:39.29,0:06:41.29,EN,,0,0,0,,it's something appropriate for a recursion.
Dialogue: 0,0:06:43.08,0:06:45.72,EN,,0,0,0,,And, of course, what we have for each of these rules is we have a case
Dialogue: 0,0:06:46.66,0:06:47.78,EN,,0,0,0,,in some case analysis.
Dialogue: 0,0:06:48.58,0:06:50.36,EN,,0,0,0,,So I'm just going to write this program down.
Dialogue: 0,0:06:52.88,0:06:57.69,EN,,0,0,0,,Now, of course, I'm going to be saying something you have to believe. Right?
Dialogue: 0,0:06:57.69,0:07:00.33,EN,,0,0,0,,What you have to believe is I can represent these algebraic expressions,
Dialogue: 0,0:07:00.68,0:07:03.88,EN,,0,0,0,,that I can grab their parts, that I can put them together.
Dialogue: 0,0:07:04.24,0:07:06.49,EN,,0,0,0,,We've invented list structures so that you can do that.
Dialogue: 0,0:07:07.52,0:07:09.14,EN,,0,0,0,,But you don't want to worry about that now.
Dialogue: 0,0:07:09.66,0:07:12.45,EN,,0,0,0,,Right now I'm going to write the program that encapsulates these rules
Dialogue: 0,0:07:12.76,0:07:15.85,EN,,0,0,0,,independent of the representation of the algebraic expressions.
Dialogue: 0,0:07:20.42,0:07:28.84,EN,,0,0,0,,You have a derivative of an expression with respect to a variable.
Dialogue: 0,0:07:30.50,0:07:33.08,EN,,0,0,0,,This is a different thing than the derivative of the function.
Dialogue: 0,0:07:34.82,0:07:38.61,EN,,0,0,0,,That's what we saw last time, that numerical approximation.
Dialogue: 0,0:07:39.00,0:07:40.82,EN,,0,0,0,,It's something you can't open up a function.
Dialogue: 0,0:07:40.82,0:07:41.89,EN,,0,0,0,,It's just the answers.
Dialogue: 0,0:07:43.09,0:07:45.18,EN,,0,0,0,,The derivative of an expression is the way it's written.
Dialogue: 0,0:07:45.74,0:07:47.85,EN,,0,0,0,,And therefore it's a syntactic phenomenon.
Dialogue: 0,0:07:48.29,0:07:51.62,EN,,0,0,0,,And so a lot of what we're going to be doing today is worrying about syntax,
Dialogue: 0,0:07:52.33,0:07:54.12,EN,,0,0,0,,syntax of expressions and things like that.
Dialogue: 0,0:07:54.70,0:07:55.93,EN,,0,0,0,,Well, there's a case analysis.
Dialogue: 0,0:07:57.50,0:08:01.08,EN,,0,0,0,,Anytime we do anything complicated thereby a recursion,
Dialogue: 0,0:08:01.08,0:08:02.64,EN,,0,0,0,,we presumably need a case analysis.
Dialogue: 0,0:08:03.62,0:08:05.16,EN,,0,0,0,,It's the essential way to begin.
Dialogue: 0,0:08:05.16,0:08:07.40,EN,,0,0,0,,And that's usually a conditional of some large kind.
Dialogue: 0,0:08:08.08,0:08:09.97,EN,,0,0,0,,Well, what are their possibilities?
Dialogue: 0,0:08:09.97,0:08:12.53,EN,,0,0,0,,the first rule that you saw is this something a constant?
Dialogue: 0,0:08:16.50,0:08:17.50,EN,,0,0,0,,And what I'm asking is,
Dialogue: 0,0:08:17.50,0:08:22.22,EN,,0,0,0,,is the expression a constant with respect to the variable given?
Dialogue: 0,0:08:24.90,0:08:27.08,EN,,0,0,0,,If so, the result is 0,
Dialogue: 0,0:08:27.50,0:08:30.10,EN,,0,0,0,,because the derivative represents the rate of change of something.
Dialogue: 0,0:08:31.76,0:08:32.65,EN,,0,0,0,,If, however,
Dialogue: 0,0:08:32.89,0:08:40.69,EN,,0,0,0,,the expression that I'm taking the derivative of is the variable I'm varying,
Dialogue: 0,0:08:41.72,0:08:50.42,EN,,0,0,0,,then this is the same variable, the expression var,
Dialogue: 0,0:08:51.14,0:08:54.52,EN,,0,0,0,,then the rate of change of the expression with respect to the variable is 1.
Dialogue: 0,0:08:55.50,0:08:56.54,EN,,0,0,0,,It's the same 1.
Dialogue: 0,0:08:58.90,0:09:00.77,EN,,0,0,0,,Well now there are a couple of other possibilities.
Dialogue: 0,0:09:01.33,0:09:03.14,EN,,0,0,0,,It could, for example, be a sum.
Dialogue: 0,0:09:03.86,0:09:05.88,EN,,0,0,0,,Well, I don't know how I'm going to express sums yet.
Dialogue: 0,0:09:06.09,0:09:08.25,EN,,0,0,0,,Actually I do. But I haven't told you yet.
Dialogue: 0,0:09:10.34,0:09:11.78,EN,,0,0,0,,But is it a sum?
Dialogue: 0,0:09:12.48,0:09:14.48,EN,,0,0,0,,I'm imagining that there's some way of telling.
Dialogue: 0,0:09:15.30,0:09:19.44,EN,,0,0,0,,I'm doing a dispatch on the type of the expression here,
Dialogue: 0,0:09:20.77,0:09:23.57,EN,,0,0,0,,absolutely essential in building languages.
Dialogue: 0,0:09:24.72,0:09:26.37,EN,,0,0,0,,Cause languages are made out of different expressions.
Dialogue: 0,0:09:26.48,0:09:27.54,EN,,0,0,0,,And soon we're going to see that
Dialogue: 0,0:09:27.84,0:09:31.02,EN,,0,0,0,,in our more powerful methods of building languages on languages.
Dialogue: 0,0:09:32.53,0:09:34.02,EN,,0,0,0,,Is an expression a sum?
Dialogue: 0,0:09:35.45,0:09:38.82,EN,,0,0,0,,If it's a sum, well, we know the rule for derivative of the sum
Dialogue: 0,0:09:38.82,0:09:41.33,EN,,0,0,0,,is the sum of the derivatives of the parts.
Dialogue: 0,0:09:42.13,0:09:44.32,EN,,0,0,0,,One of them is called the addend and the other is the augend.
Dialogue: 0,0:09:44.32,0:09:46.80,EN,,0,0,0,,But I don't have enough space on the blackboard to such long names.
Dialogue: 0,0:09:46.80,0:09:48.40,EN,,0,0,0,,So I'll call them A1 and A2.
Dialogue: 0,0:09:49.04,0:09:50.37,EN,,0,0,0,,I want to make a sum.
Dialogue: 0,0:09:53.53,0:09:55.68,EN,,0,0,0,,Do you remember which is the sub for head or the menu end?
Dialogue: 0,0:09:57.14,0:10:01.09,EN,,0,0,0,,Or was it the dividend and the divisor or something like that?
Dialogue: 0,0:10:01.65,0:10:08.48,EN,,0,0,0,,Make sum of the derivative of the A1, I'll call it.
Dialogue: 0,0:10:08.48,0:10:13.29,EN,,0,0,0,,It's the addend of the expression with respect to the variable,
Dialogue: 0,0:10:14.84,0:10:22.76,EN,,0,0,0,,and the derivative of the A2 of the expression,
Dialogue: 0,0:10:24.12,0:10:28.25,EN,,0,0,0,,those the two arguments, the addition. Respect to the variable.
Dialogue: 0,0:10:32.36,0:10:34.93,EN,,0,0,0,,And another rule that we know is product rule,
Dialogue: 0,0:10:35.20,0:10:37.44,EN,,0,0,0,,which is, if the expression is a product.
Dialogue: 0,0:10:43.21,0:10:46.10,EN,,0,0,0,,By the way, it's a good idea when you're defining things,
Dialogue: 0,0:10:46.96,0:10:48.32,EN,,0,0,0,,when you're defining predicates,
Dialogue: 0,0:10:48.85,0:10:50.96,EN,,0,0,0,,to give them a name that ends in a question mark.
Dialogue: 0,0:10:51.08,0:10:52.89,EN,,0,0,0,,This question mark doesn't mean anything.
Dialogue: 0,0:10:53.10,0:10:54.50,EN,,0,0,0,,It's for us as an agreement.
Dialogue: 0,0:10:54.61,0:10:58.94,EN,,0,0,0,,It's a conventional interface between humans so you can read my programs more easily.
Dialogue: 0,0:11:00.05,0:11:01.96,EN,,0,0,0,,So I want you to, when you write programs,
Dialogue: 0,0:11:01.96,0:11:03.73,EN,,0,0,0,,if you define a predicate procedure,
Dialogue: 0,0:11:04.01,0:11:05.77,EN,,0,0,0,,that's something that returns true of false,
Dialogue: 0,0:11:05.94,0:11:07.84,EN,,0,0,0,,it should have a name which ends in question mark.
Dialogue: 0,0:11:08.02,0:11:10.34,EN,,0,0,0,,The lisp doesn't care. I care.
Dialogue: 0,0:11:11.62,0:11:13.14,EN,,0,0,0,,I want to make a sum.
Dialogue: 0,0:11:13.14,0:11:17.49,EN,,0,0,0,,Because the product, the derivative of a product is the sum
Dialogue: 0,0:11:17.94,0:11:19.64,EN,,0,0,0,,of the first times the derivative of the second plus
Dialogue: 0,0:11:19.66,0:11:20.70,EN,,0,0,0,,the second times the derivative of the first.
Dialogue: 0,0:11:23.54,0:11:27.06,EN,,0,0,0,,Make a sum of two things,
Dialogue: 0,0:11:29.64,0:11:38.33,EN,,0,0,0,,a product of, well, I'm going to say the M1 of the expression,
Dialogue: 0,0:11:39.85,0:11:48.97,EN,,0,0,0,,and the derivative of the M2 of the expression with respect to the variable,
Dialogue: 0,0:11:51.90,0:12:06.28,EN,,0,0,0,,and the product of the derivative of M1,
Dialogue: 0,0:12:07.10,0:12:11.92,EN,,0,0,0,,the multiplier of the expression, with respect to the variable.
Dialogue: 0,0:12:13.32,0:12:18.05,EN,,0,0,0,,And the product of that and the multiplicand, M2, of the expression.
Dialogue: 0,0:12:20.64,0:12:24.89,EN,,0,0,0,,Make that product. Make the sum. Close that case.
Dialogue: 0,0:12:24.96,0:12:28.02,EN,,0,0,0,,And, of course, I could add as many cases as I like here
Dialogue: 0,0:12:28.32,0:12:30.82,EN,,0,0,0,,for a complete set of rules you might find in a calculus book.
Dialogue: 0,0:12:34.80,0:12:39.45,EN,,0,0,0,,So this is what it takes to encapsulate those rules.
Dialogue: 0,0:12:41.53,0:12:43.90,EN,,0,0,0,,And you see, you have to realize there's a lot of wishful thinking here.
Dialogue: 0,0:12:44.54,0:12:47.56,EN,,0,0,0,,I haven't told you anything about how I'm going to make these representations.
Dialogue: 0,0:12:48.46,0:12:51.92,EN,,0,0,0,,Now, once I've decided that this is my set of rules,
Dialogue: 0,0:12:52.52,0:12:55.20,EN,,0,0,0,,I think it's time to play with the representation.
Dialogue: 0,0:12:55.66,0:12:56.69,EN,,0,0,0,,Let's attack that.
Dialogue: 0,0:12:57.96,0:13:00.00,EN,,0,0,0,,Well, first of all, I'm going to play a pun.
Dialogue: 0,0:13:00.90,0:13:02.12,EN,,0,0,0,,It's an important pun.
Dialogue: 0,0:13:02.74,0:13:06.56,EN,,0,0,0,,It's a key to a sort of powerful idea.
Dialogue: 0,0:13:09.62,0:13:14.41,EN,,0,0,0,,If I want to represent sums, and products, and differences, and quotients, and things like that,
Dialogue: 0,0:13:15.22,0:13:18.62,EN,,0,0,0,,why not use the same language as I'm writing my program in?
Dialogue: 0,0:13:20.50,0:13:23.64,EN,,0,0,0,,I write my program it algebraic expressions that look like
Dialogue: 0,0:13:23.98,0:13:30.45,EN,,0,0,0,,the sum of the product on a and the product of x and x,
Dialogue: 0,0:13:32.60,0:13:33.80,EN,,0,0,0,,and things like that.
Dialogue: 0,0:13:34.28,0:13:38.50,EN,,0,0,0,,And the product of b and x and c, whatever,
Dialogue: 0,0:13:38.50,0:13:39.97,EN,,0,0,0,,make that a sum of the product.
Dialogue: 0,0:13:40.77,0:13:44.09,EN,,0,0,0,,Right now I don't want to have procedures with unknown numbers of arguments,
Dialogue: 0,0:13:44.93,0:13:48.46,EN,,0,0,0,,a product of b and x and c.
Dialogue: 0,0:13:51.42,0:13:52.44,EN,,0,0,0,,This is list structure.
Dialogue: 0,0:13:54.12,0:13:55.74,EN,,0,0,0,,And the reason why this is nice,
Dialogue: 0,0:13:55.90,0:13:58.33,EN,,0,0,0,,is because any one of these objects has a property.
Dialogue: 0,0:13:58.92,0:14:01.53,EN,,0,0,0,,I know where, know where the car is.
Dialogue: 0,0:14:01.96,0:14:03.21,EN,,0,0,0,,The car is the operator.
Dialogue: 0,0:14:03.92,0:14:06.38,EN,,0,0,0,,And the operands are the successive cdrs
Dialogue: 0,0:14:07.22,0:14:10.36,EN,,0,0,0,,the successive cars of the cdrs of the list that this is.
Dialogue: 0,0:14:12.48,0:14:13.88,EN,,0,0,0,,It makes it very convenient.
Dialogue: 0,0:14:14.01,0:14:16.40,EN,,0,0,0,,Ir have to parse it. It's been done for me.
Dialogue: 0,0:14:17.42,0:14:20.01,EN,,0,0,0,,I'm using the embedding in Lisp to advantage.
Dialogue: 0,0:14:22.66,0:14:23.77,EN,,0,0,0,,So, for example,
Dialogue: 0,0:14:25.08,0:14:33.97,EN,,0,0,0,,Let's start using list structure to write down the representation that I'm implicitly assuming here.
Dialogue: 0,0:14:35.25,0:14:38.34,EN,,0,0,0,,Well I have to define various things that are implied in this representation.
Dialogue: 0,0:14:38.54,0:14:40.90,EN,,0,0,0,,Like I have to find out how to do a constant,
Dialogue: 0,0:14:41.21,0:14:42.30,EN,,0,0,0,,how you do same variable.
Dialogue: 0,0:14:42.40,0:14:45.04,EN,,0,0,0,,Let's do those first. That's pretty easy enough.
Dialogue: 0,0:14:45.78,0:14:47.70,EN,,0,0,0,,Now I'm going to be introducing lots of primitives here,
Dialogue: 0,0:14:48.60,0:14:50.50,EN,,0,0,0,,because these are the primitives that come with list structure.
Dialogue: 0,0:14:51.98,0:14:53.46,EN,,0,0,0,,OK, you define a constant.
Dialogue: 0,0:15:02.25,0:15:04.29,EN,,0,0,0,,And what I mean by a constant,
Dialogue: 0,0:15:04.29,0:15:07.73,EN,,0,0,0,,an expression is constant with respect to a variable.
Dialogue: 0,0:15:09.05,0:15:11.60,EN,,0,0,0,,is that the expression is something simple.
Dialogue: 0,0:15:11.60,0:15:14.46,EN,,0,0,0,,I can't take it into pieces, and yet it isn't that variable.
Dialogue: 0,0:15:16.58,0:15:18.78,EN,,0,0,0,,I can't break it up, and yet it isn't that variable.
Dialogue: 0,0:15:18.90,0:15:25.12,EN,,0,0,0,,That does not mean that there may be other expressions that are more complicated that are constants.
Dialogue: 0,0:15:25.20,0:15:28.92,EN,,0,0,0,,It's just that I'm going to look at the primitive constants in this way.
Dialogue: 0,0:15:29.74,0:15:33.41,EN,,0,0,0,,So what this is, is it says that's it's the and.
Dialogue: 0,0:15:34.02,0:15:37.82,EN,,0,0,0,,I can combine predicate expressions which return true or false with and.
Dialogue: 0,0:15:38.62,0:15:46.82,EN,,0,0,0,,Something atomic, The expression is atomic, meaning it cannot be broken into parts.
Dialogue: 0,0:15:46.82,0:15:48.53,EN,,0,0,0,,It doesn't have a car and a cdr.
Dialogue: 0,0:15:49.45,0:15:50.21,EN,,0,0,0,,It's not a list.
Dialogue: 0,0:15:50.76,0:15:52.94,EN,,0,0,0,,And it's a special test built into the system.
Dialogue: 0,0:15:53.97,0:16:04.66,EN,,0,0,0,,And it's not identically equal to that variable.
Dialogue: 0,0:16:06.82,0:16:13.36,EN,,0,0,0,,I'm representing my variables by things that are symbols which cannot be broken into pieces,
Dialogue: 0,0:16:13.90,0:16:17.22,EN,,0,0,0,,things like x, and y, things like this.
Dialogue: 0,0:16:19.74,0:16:22.37,EN,,0,0,0,,Whereas, of course, something like this can be broken up into pieces.
Dialogue: 0,0:16:24.74,0:16:46.40,EN,,0,0,0,,And the same variable of an expression with respect to a variable is,
Dialogue: 0,0:16:46.40,0:16:48.40,EN,,0,0,0,,in fact, an atomic expression.
Dialogue: 0,0:16:48.77,0:16:59.61,EN,,0,0,0,,I want to have an atomic expression, which is identical.
Dialogue: 0,0:17:07.90,0:17:11.68,EN,,0,0,0,,I don't want to look inside this, this stuff anymore.
Dialogue: 0,0:17:12.52,0:17:15.56,EN,,0,0,0,,These are primitive maybe.
Dialogue: 0,0:17:15.77,0:17:17.08,EN,,0,0,0,,But it doesn't matter.
Dialogue: 0,0:17:17.78,0:17:21.74,EN,,0,0,0,,I'm defining... I'm using things that are given to me with a language.
Dialogue: 0,0:17:22.42,0:17:24.04,EN,,0,0,0,,I'm not terribly interest in them.
Dialogue: 0,0:17:24.42,0:17:26.04,EN,,0,0,0,,Now how do we deal with sums?
Dialogue: 0,0:17:26.60,0:17:28.80,EN,,0,0,0,,Ah, something very interesting will happen.
Dialogue: 0,0:17:28.98,0:17:33.12,EN,,0,0,0,,A sum is something which is not atomic and begins with the plus symbol.
Dialogue: 0,0:17:35.16,0:17:36.17,EN,,0,0,0,,That's what it means.
Dialogue: 0,0:17:36.65,0:17:39.77,EN,,0,0,0,,So here, I will define.
Dialogue: 0,0:17:45.46,0:17:57.77,EN,,0,0,0,,An expression is a sum if and it's not atomic
Dialogue: 0,0:18:04.57,0:18:15.45,EN,,0,0,0,,and it's head, it's beginning, its car of the expression is the symbol plus.
Dialogue: 0,0:18:19.74,0:18:24.04,EN,,0,0,0,,Now you're about to see something you haven't seen before, this quotation.
Dialogue: 0,0:18:25.89,0:18:28.22,EN,,0,0,0,,Why do I have that quotation there?
Dialogue: 0,0:18:29.48,0:18:30.52,EN,,0,0,0,,PROFESSOR: Say your name,
Dialogue: 0,0:18:30.68,0:18:31.41,EN,,0,0,0,,AUDIENCE: Susanna.
Dialogue: 0,0:18:31.41,0:18:32.01,EN,,0,0,0,,PROFESSOR: Louder.
Dialogue: 0,0:18:32.01,0:18:32.72,EN,,0,0,0,,AUDIENCE: Susanna
Dialogue: 0,0:18:33.25,0:18:34.21,EN,,0,0,0,,PROFESSOR: Say your name.
Dialogue: 0,0:18:34.21,0:18:34.85,EN,,0,0,0,,AUDIENCE: Your name.
Dialogue: 0,0:18:34.92,0:18:35.68,EN,,0,0,0,,PROFESSOR: Louder.
Dialogue: 0,0:18:35.77,0:18:36.61,EN,,0,0,0,,AUDIENCE: Your name.
Dialogue: 0,0:18:36.82,0:18:37.50,EN,,0,0,0,,PROFESSOR: OK.
Dialogue: 0,0:18:38.28,0:18:44.56,EN,,0,0,0,,What I'm showing you here is that the words of English are ambiguous.
Dialogue: 0,0:18:45.50,0:18:50.76,EN,,0,0,0,,I was saying, say your name.
Dialogue: 0,0:18:51.97,0:18:57.21,EN,,0,0,0,,I was also possibly saying say, your name.
Dialogue: 0,0:19:00.72,0:19:02.98,EN,,0,0,0,,But that cannot be distinguished in speech.
Dialogue: 0,0:19:03.89,0:19:08.01,EN,,0,0,0,,However, we do have a notation in writing,
Dialogue: 0,0:19:08.18,0:19:12.46,EN,,0,0,0,,which is quotation for distinguishing these two possible meanings.
Dialogue: 0,0:19:14.00,0:19:15.64,EN,,0,0,0,,In particular, over here,
Dialogue: 0,0:19:16.49,0:19:20.84,EN,,0,0,0,,in Lisp we have a notation for distinguishing these meanings.
Dialogue: 0,0:19:21.34,0:19:24.45,EN,,0,0,0,,If I were to just write a plus here, a plus symbol,
Dialogue: 0,0:19:24.64,0:19:28.52,EN,,0,0,0,,I would be asking, is the first element of the expression,
Dialogue: 0,0:19:29.06,0:19:33.61,EN,,0,0,0,,is the operator position of the expression, the addition operator?
Dialogue: 0,0:19:34.65,0:19:35.54,EN,,0,0,0,,I don't know.
Dialogue: 0,0:19:36.22,0:19:38.16,EN,,0,0,0,,I would have to have written the addition operator there,
Dialogue: 0,0:19:39.37,0:19:40.44,EN,,0,0,0,,which I can't write.
Dialogue: 0,0:19:41.34,0:19:45.88,EN,,0,0,0,,However, this way I'm asking, is this the symbolic object plus,
Dialogue: 0,0:19:45.98,0:19:48.14,EN,,0,0,0,,which normally stands for the addition operator?
Dialogue: 0,0:19:49.57,0:19:51.92,EN,,0,0,0,,That's what I want. That's the question I want to ask.
Dialogue: 0,0:19:52.92,0:19:54.45,EN,,0,0,0,,Now before I go any further,
Dialogue: 0,0:19:54.45,0:19:57.81,EN,,0,0,0,,I want to point out the quotation is a very complex concept,
Dialogue: 0,0:19:58.85,0:20:01.84,EN,,0,0,0,,and adding it to a language causes a great deal of troubles.
Dialogue: 0,0:20:03.57,0:20:05.04,EN,,0,0,0,,Consider the next slide.
Dialogue: 0,0:20:06.38,0:20:09.49,EN,,0,0,0,,Here's a deduction which we should all agree with.
Dialogue: 0,0:20:11.62,0:20:17.04,EN,,0,0,0,,We have, Alyssa is smart and Alyssa is George's mother.
Dialogue: 0,0:20:17.40,0:20:20.60,EN,,0,0,0,,This is an equality, is.
Dialogue: 0,0:20:22.13,0:20:26.30,EN,,0,0,0,,From those two, we can deduce that George's mother is smart.
Dialogue: 0,0:20:27.32,0:20:33.16,EN,,0,0,0,,Because we can always substitute equals for equals in expressions.
Dialogue: 0,0:20:34.09,0:20:35.16,EN,,0,0,0,,Or can we?
Dialogue: 0,0:20:36.52,0:20:40.37,EN,,0,0,0,,Here's a case where we have "Chicago" has seven letters.
Dialogue: 0,0:20:41.12,0:20:44.86,EN,,0,0,0,,The quotation means that I'm discussing the word Chicago,
Dialogue: 0,0:20:44.86,0:20:46.86,EN,,0,0,0,,not what the word represents.
Dialogue: 0,0:20:49.82,0:20:52.77,EN,,0,0,0,,Here I have that Chicago is the biggest city in Illinois.
Dialogue: 0,0:20:54.61,0:20:55.80,EN,,0,0,0,,As a consequence of this,
Dialogue: 0,0:20:55.80,0:20:59.09,EN,,0,0,0,,I would like to deduce that the biggest city in Illinois has seven letters.
Dialogue: 0,0:20:59.32,0:21:01.06,EN,,0,0,0,,But that's manifestly false.
Dialogue: 0,0:21:05.16,0:21:07.17,EN,,0,0,0,,Wow, it works.
Dialogue: 0,0:21:09.29,0:21:12.24,EN,,0,0,0,,OK, so once we have things like that,
Dialogue: 0,0:21:12.48,0:21:14.49,EN,,0,0,0,,our language gets much more complicated.
Dialogue: 0,0:21:14.49,0:21:18.34,EN,,0,0,0,,Because it's no longer true that things we tend to like to do with languages,
Dialogue: 0,0:21:18.34,0:21:20.76,EN,,0,0,0,,like substituting equals for equals and getting right answers,
Dialogue: 0,0:21:21.29,0:21:23.50,EN,,0,0,0,,are going to work without being very careful.
Dialogue: 0,0:21:24.49,0:21:27.34,EN,,0,0,0,,We can't substitute into what's called referentially opaque contexts,
Dialogue: 0,0:21:27.89,0:21:32.64,EN,,0,0,0,,of which a quotation is the prototypical type of referentially opaque context.
Dialogue: 0,0:21:33.17,0:21:35.28,EN,,0,0,0,,If you know what that means, you can consult a philosopher.
Dialogue: 0,0:21:35.42,0:21:37.02,EN,,0,0,0,,Presumably there is one in the room.
Dialogue: 0,0:21:37.53,0:21:41.32,EN,,0,0,0,,In any case, let's continue now,
Dialogue: 0,0:21:41.32,0:21:44.98,EN,,0,0,0,,now that we at least have an operational understanding of a 2000-year-old issue
Dialogue: 0,0:21:45.26,0:21:48.13,EN,,0,0,0,,that has to do with name, and mention, and all sorts of things like that.
Dialogue: 0,0:21:52.32,0:22:01.60,EN,,0,0,0,,I have to define what I mean, how to make a sum of two things, an a1 and a2.
Dialogue: 0,0:22:02.12,0:22:03.62,EN,,0,0,0,,And I'm going to do this very simply.
Dialogue: 0,0:22:03.62,0:22:11.96,EN,,0,0,0,,It's a list of the symbol plus, and a1, and a2.
Dialogue: 0,0:22:13.86,0:22:17.37,EN,,0,0,0,,And I can determine the first element.
Dialogue: 0,0:22:21.84,0:22:25.32,EN,,0,0,0,,Define a1 to be cadr.
Dialogue: 0,0:22:33.88,0:22:35.90,EN,,0,0,0,,I've just introduced another primitive.
Dialogue: 0,0:22:36.17,0:22:39.10,EN,,0,0,0,,This is the car of the cdr of something.
Dialogue: 0,0:22:39.80,0:22:44.53,EN,,0,0,0,,You might want to know why car and cdr are names of these primitives,
Dialogue: 0,0:22:44.66,0:22:48.42,EN,,0,0,0,,and why they've survived, even though they're much better ideas like left and right.
Dialogue: 0,0:22:48.76,0:22:50.44,EN,,0,0,0,,We could have called them things like that.
Dialogue: 0,0:22:51.28,0:22:56.25,EN,,0,0,0,,Well, first of all, the names come from the fact that in the great past, when Lisp was invented,
Dialogue: 0,0:22:56.36,0:23:00.80,EN,,0,0,0,,I suppose in '58 or something, it was on a 704 or something like that,
Dialogue: 0,0:23:00.80,0:23:05.41,EN,,0,0,0,,which had a machine. It was a machine that had an address register and a decrement register.
Dialogue: 0,0:23:05.41,0:23:08.17,EN,,0,0,0,,And these were the contents of the address register and the decrement register.
Dialogue: 0,0:23:08.17,0:23:09.37,EN,,0,0,0,,So it's an historical accident.
Dialogue: 0,0:23:09.64,0:23:11.28,EN,,0,0,0,,Now why have these names survived?
Dialogue: 0,0:23:11.74,0:23:14.76,EN,,0,0,0,,It's because Lisp programmers like to talk to each other over the phone.
Dialogue: 0,0:23:15.68,0:23:19.60,EN,,0,0,0,,And if you want to have a long sequence of cars and cdrs you might say, cdaddedr,
Dialogue: 0,0:23:21.01,0:23:22.32,EN,,0,0,0,,which can be understood.
Dialogue: 0,0:23:22.32,0:23:27.02,EN,,0,0,0,,But left of right or right of left is not so clear if you get good at it.
Dialogue: 0,0:23:27.60,0:23:30.02,EN,,0,0,0,,So that's why we have these words.
Dialogue: 0,0:23:30.54,0:23:34.14,EN,,0,0,0,,All of them up to four deep are defined typically in a Lisp system.
Dialogue: 0,0:23:38.66,0:23:47.05,EN,,0,0,0,,A2 to be-- and, of course, you can see that if I looked at one of these expressions
Dialogue: 0,0:23:47.36,0:23:52.14,EN,,0,0,0,,like the sum of 3 and 5,
Dialogue: 0,0:23:52.58,0:24:10.45,EN,,0,0,0,,what that is is a list containing the symbol plus, and a number 3, and a number 5.
Dialogue: 0,0:24:11.72,0:24:15.18,EN,,0,0,0,,Then the car is the symbol plus.
Dialogue: 0,0:24:16.13,0:24:18.21,EN,,0,0,0,,The car of the cdr.
Dialogue: 0,0:24:18.21,0:24:20.21,EN,,0,0,0,,Well I take the cdr and then I take the car.
Dialogue: 0,0:24:20.21,0:24:22.21,EN,,0,0,0,,And that's how I get to the 3. That's the first argument.
Dialogue: 0,0:24:22.52,0:24:25.69,EN,,0,0,0,,And the car of the cdr of the cdr gets me to this one, the 5.
Dialogue: 0,0:24:28.69,0:24:33.66,EN,,0,0,0,,And similarly, of course, I can define what's going on with products.
Dialogue: 0,0:24:35.22,0:24:36.56,EN,,0,0,0,,Let's do that very quickly.
Dialogue: 0,0:24:48.97,0:24:50.64,EN,,0,0,0,,Is the expression a product?
Dialogue: 0,0:24:51.05,0:24:54.69,EN,,0,0,0,,Yes if and if it's true, that's it's not atomic
Dialogue: 0,0:25:01.41,0:25:14.14,EN,,0,0,0,,and it's EQ quote, the asterisk symbol, which is the operator for multiplication.
Dialogue: 0,0:25:15.64,0:25:32.00,EN,,0,0,0,,Make product of an M1 and an M2 to be list,
Dialogue: 0,0:25:34.42,0:25:39.30,EN,,0,0,0,,quote, the asterisk operation and M1 and M2.
Dialogue: 0,0:25:40.82,0:25:56.81,EN,,0,0,0,,And I define M1 to be cadr and M2 to be caddr.
Dialogue: 0,0:26:00.09,0:26:02.38,EN,,0,0,0,,You get to be a good Lisp programmer because you start talking that way.
Dialogue: 0,0:26:02.53,0:26:05.53,EN,,0,0,0,,You can cdr thing down lists and cons them up and so on.
Dialogue: 0,0:26:06.29,0:26:10.10,EN,,0,0,0,,Now, now that we have essentially a complete program for finding derivatives,
Dialogue: 0,0:26:10.10,0:26:11.70,EN,,0,0,0,,you can add more rules if you like.
Dialogue: 0,0:26:12.21,0:26:13.93,EN,,0,0,0,,What kind of behavior do we get out of it?
Dialogue: 0,0:26:14.64,0:26:16.77,EN,,0,0,0,,I'll have to clear that x.
Dialogue: 0,0:26:17.80,0:26:20.82,EN,,0,0,0,,Well, supposing I define foo here
Dialogue: 0,0:26:22.16,0:26:30.38,EN,,0,0,0,,to be the sum of the product of ax square and bx plus c.
Dialogue: 0,0:26:30.54,0:26:32.08,EN,,0,0,0,,That's the same thing we see here
Dialogue: 0,0:26:32.08,0:26:36.36,EN,,0,0,0,,as the algebraic expression written in the more conventional notation over there.
Dialogue: 0,0:26:37.84,0:26:41.60,EN,,0,0,0,,Well, the derivative of foo with respect to x, which we can see over here,
Dialogue: 0,0:26:43.46,0:26:45.26,EN,,0,0,0,,is this horrible, horrendous mess.
Dialogue: 0,0:26:46.16,0:26:49.22,EN,,0,0,0,,I would like it to be 2ax plus b.
Dialogue: 0,0:26:50.68,0:26:53.44,EN,,0,0,0,,But it's not. It's equivalent to it.
Dialogue: 0,0:26:54.58,0:26:55.22,EN,,0,0,0,,What is it?
Dialogue: 0,0:26:55.97,0:26:59.96,EN,,0,0,0,,I have here, what do I have?
Dialogue: 0,0:27:00.50,0:27:04.30,EN,,0,0,0,,I have the derivative of the product of x and x.
Dialogue: 0,0:27:04.69,0:27:10.53,EN,,0,0,0,,Over here is, of course, the sum of x times 1 and 1 times x.
Dialogue: 0,0:27:12.73,0:27:15.66,EN,,0,0,0,,Now, well, it's the first times the derivative of the second plus the second times the derivative of the first. It's right.
Dialogue: 0,0:27:17.22,0:27:28.37,EN,,0,0,0,,That's 2x of course. a times 2x is 2ax plus 0X square doesn't count plus B over here plus a bunch of 0's.
Dialogue: 0,0:27:28.96,0:27:30.12,EN,,0,0,0,,Well the answer is right.
Dialogue: 0,0:27:30.12,0:27:35.14,EN,,0,0,0,,But I give people take off points on an exam for that, sadly enough.
Dialogue: 0,0:27:35.56,0:27:37.26,EN,,0,0,0,,Let's worry about that in the next segment.
Dialogue: 0,0:27:37.68,0:27:38.61,EN,,0,0,0,,Are there any questions?
Dialogue: 0,0:27:42.77,0:27:43.45,EN,,0,0,0,,Yes?
Dialogue: 0,0:27:43.89,0:27:46.69,EN,,0,0,0,,AUDIENCE: If you had left the quote when you put the plus,
Dialogue: 0,0:27:46.69,0:27:50.82,EN,,0,0,0,,then would that be referring to the procedure plus
Dialogue: 0,0:27:50.82,0:27:55.42,EN,,0,0,0,,and could you do a comparison between that procedure and some other procedure if you wanted to?
Dialogue: 0,0:27:56.16,0:27:57.08,EN,,0,0,0,,PROFESSOR: Yes. Good question.
Dialogue: 0,0:27:57.45,0:28:02.26,EN,,0,0,0,,If I had left this quotation off at this point,
Dialogue: 0,0:28:03.88,0:28:07.13,EN,,0,0,0,,Okay? If I had left that quotation off at that point,
Dialogue: 0,0:28:07.33,0:28:14.20,EN,,0,0,0,,then I would be referring here to the procedure which is the thing that plus is defined to be.
Dialogue: 0,0:28:15.38,0:28:24.88,EN,,0,0,0,,And indeed, I could compare some procedures with each other for identity.
Dialogue: 0,0:28:24.88,0:28:27.45,EN,,0,0,0,,Now what that means is not clear right now.
Dialogue: 0,0:28:27.85,0:28:29.37,EN,,0,0,0,,I don't like to think about it.
Dialogue: 0,0:28:29.89,0:28:32.40,EN,,0,0,0,,Because I don't know exactly what it would need to compare procedures.
Dialogue: 0,0:28:32.40,0:28:34.40,EN,,0,0,0,,There are reasons why that may make no sense at all.
Dialogue: 0,0:28:35.52,0:28:37.53,EN,,0,0,0,,However, the symbols, we understand.
Dialogue: 0,0:28:38.54,0:28:40.56,EN,,0,0,0,,And so that's why I put that quote in.
Dialogue: 0,0:28:41.16,0:28:43.70,EN,,0,0,0,,I want to talk about the symbol that's apparent on the page.
Dialogue: 0,0:28:46.16,0:28:46.92,EN,,0,0,0,,Any other questions?
Dialogue: 0,0:28:48.52,0:28:51.86,EN,,0,0,0,,OK. Thank you. Let's take a break.
Dialogue: 0,0:28:55.12,0:29:00.66,EN,,0,0,0,,[JESU, JOY OF MAN'S DESIRING]
Dialogue: 0,0:29:00.68,0:29:04.34,Declare,,0,0,0,,{\an2\fad(500,500)}The Structure And Interpretation of Computer Programs
Dialogue: 0,0:29:04.34,0:29:06.68,Declare,,0,0,0,,{\an2\fad(500,500)}By: Prof. Harold Abelson && Gerald Jay Sussman
Dialogue: 0,0:29:12.21,0:29:19.17,Declare,,0,0,0,,{\an2\fad(500,500)}The Structure And Interpretation of Computer Programs
Dialogue: 0,0:29:20.09,0:29:24.14,Declare,,0,0,0,,{\an2\fad(500,500)}Symbolic Differentiation: Quotation
Dialogue: 0,0:29:29.86,0:29:30.92,EN,,0,0,0,,PROFESSOR: Well, let's see.
Dialogue: 0,0:29:31.46,0:29:37.76,EN,,0,0,0,,We've just developed a fairly plausible program for computing the derivatives of algebraic expressions.
Dialogue: 0,0:29:38.20,0:29:41.56,EN,,0,0,0,,It's an incomplete program, if you would like to add more rules.
Dialogue: 0,0:29:42.13,0:29:47.74,EN,,0,0,0,,And perhaps you might extend it to deal with uses of addition with any number of arguments
Dialogue: 0,0:29:47.76,0:29:49.70,EN,,0,0,0,,and multiplication with any of the number of arguments.
Dialogue: 0,0:29:49.89,0:29:51.38,EN,,0,0,0,,And that's all rather easy.
Dialogue: 0,0:29:52.73,0:29:56.93,EN,,0,0,0,,However, there was a little fly in that ointment.
Dialogue: 0,0:29:57.48,0:30:02.37,EN,,0,0,0,,We go back to this slide.
Dialogue: 0,0:30:02.94,0:30:08.60,EN,,0,0,0,,We see that the expressions that we get are rather bad.
Dialogue: 0,0:30:08.88,0:30:11.01,EN,,0,0,0,,This is a rather bad expression.
Dialogue: 0,0:30:11.46,0:30:13.10,EN,,0,0,0,,How do we get such an expression?
Dialogue: 0,0:30:13.84,0:30:15.50,EN,,0,0,0,,Why do we have that expression?
Dialogue: 0,0:30:16.84,0:30:18.74,EN,,0,0,0,,Let's look at this expression in some detail.
Dialogue: 0,0:30:18.92,0:30:20.76,EN,,0,0,0,,Let's find out where all the pieces come from.
Dialogue: 0,0:30:21.69,0:30:24.56,EN,,0,0,0,,As we see here, we have a sum--
Dialogue: 0,0:30:24.56,0:30:26.56,EN,,0,0,0,,just what I showed you at the end of the last time--
Dialogue: 0,0:30:27.12,0:30:29.09,EN,,0,0,0,,of X times 1 plus 1 time X.
Dialogue: 0,0:30:29.58,0:30:31.38,EN,,0,0,0,,That is a derivative of this product.
Dialogue: 0,0:30:32.52,0:30:36.41,EN,,0,0,0,,The product of a times that, where a does not depend upon x,
Dialogue: 0,0:30:36.41,0:30:38.41,EN,,0,0,0,,and therefore is constant with respect to x,
Dialogue: 0,0:30:39.04,0:30:44.53,EN,,0,0,0,,is this sum, which goes from here all the way through here and through here.
Dialogue: 0,0:30:44.80,0:30:48.89,EN,,0,0,0,,Because it is the first thing times the derivative of the second
Dialogue: 0,0:30:49.57,0:30:54.45,EN,,0,0,0,,plus the derivative of the first times the second
Dialogue: 0,0:30:54.66,0:30:59.06,EN,,0,0,0,,as the program we wrote on the blackboard indicated we should do.
Dialogue: 0,0:31:00.65,0:31:05.36,EN,,0,0,0,,And, of course, the product of bx over here
Dialogue: 0,0:31:05.49,0:31:09.81,EN,,0,0,0,,manifests itself as B times 1 plus 0 times X
Dialogue: 0,0:31:10.81,0:31:16.06,EN,,0,0,0,,because we see that B does not depend upon X.
Dialogue: 0,0:31:16.46,0:31:18.56,EN,,0,0,0,,And so the derivative of B is this 0,
Dialogue: 0,0:31:18.77,0:31:21.48,EN,,0,0,0,,and the derivative of X with respect itself is the 1.
Dialogue: 0,0:31:23.06,0:31:28.64,EN,,0,0,0,,And, of course, the derivative of the sums over here turn into these two sums of the derivatives of the parts.
Dialogue: 0,0:31:29.37,0:31:33.50,EN,,0,0,0,,So what we're seeing here is exactly the thing I was trying to tell you about
Dialogue: 0,0:31:33.66,0:31:35.89,EN,,0,0,0,,with Fibonacci numbers a while ago,
Dialogue: 0,0:31:37.77,0:31:39.49,EN,,0,0,0,,that the form of the process
Dialogue: 0,0:31:41.38,0:31:46.44,EN,,0,0,0,,is expanded as low as from the local rules that you see in the procedure,
Dialogue: 0,0:31:48.05,0:31:52.57,EN,,0,0,0,,that the procedure represents a set of local rules for the expansion of this process.
Dialogue: 0,0:31:53.36,0:32:00.09,EN,,0,0,0,,And here, the process left behind some stuff, which is the answer.
Dialogue: 0,0:32:00.25,0:32:06.26,EN,,0,0,0,,And it was constructed by the walk it takes of the tree structure, which is the expression.
Dialogue: 0,0:32:08.41,0:32:12.61,EN,,0,0,0,,So every part in the answer we see here derives from some part of the problem.
Dialogue: 0,0:32:14.46,0:32:17.78,EN,,0,0,0,,Now, we can look at, for example, the derivative of foo,
Dialogue: 0,0:32:17.78,0:32:19.65,EN,,0,0,0,,which is ax square plus bx plus c,
Dialogue: 0,0:32:19.84,0:32:23.05,EN,,0,0,0,,with respect to other things, like here, for example,
Dialogue: 0,0:32:24.14,0:32:27.48,EN,,0,0,0,,we can see that the derivative of foo with respect to a.
Dialogue: 0,0:32:28.10,0:32:31.77,EN,,0,0,0,,And it's very similar. It's, in fact, the identical algebraic expression,
Dialogue: 0,0:32:32.45,0:32:35.24,EN,,0,0,0,,except for the fact that theses 0's and 1's are in different places.
Dialogue: 0,0:32:36.06,0:32:38.60,EN,,0,0,0,,Because the only degree of freedom we have in this tree walk
Dialogue: 0,0:32:38.97,0:32:43.85,EN,,0,0,0,,is what's constant with respect to the variable we're taking the derivative with respect to
Dialogue: 0,0:32:44.28,0:32:45.81,EN,,0,0,0,,and what's the same variable.
Dialogue: 0,0:32:48.26,0:32:52.09,EN,,0,0,0,,In other words, if we go back to this blackboard and we look,
Dialogue: 0,0:32:52.65,0:32:57.49,EN,,0,0,0,,we have no choice what to do when we take the derivative of the sum or a product.
Dialogue: 0,0:32:58.08,0:33:04.48,EN,,0,0,0,,The only interesting place here is, is the expression the variable,
Dialogue: 0,0:33:04.80,0:33:10.10,EN,,0,0,0,,or is the expression a constant with respect to that variable for very, very small expressions?
Dialogue: 0,0:33:10.36,0:33:12.41,EN,,0,0,0,,In which case we get various 1's and 0's,
Dialogue: 0,0:33:12.69,0:33:14.49,EN,,0,0,0,,which if we go back to this slide,
Dialogue: 0,0:33:15.12,0:33:18.16,EN,,0,0,0,,we can see that the 0's that appear here, for example,
Dialogue: 0,0:33:18.37,0:33:22.74,EN,,0,0,0,,this 1 over here in derivative of foo with respect to A,
Dialogue: 0,0:33:22.96,0:33:24.86,EN,,0,0,0,,which gets us an X square,
Dialogue: 0,0:33:24.96,0:33:32.53,EN,,0,0,0,,because that 1 gets the multiply of X and X into the answer, that 1 is 0.
Dialogue: 0,0:33:32.64,0:33:34.89,EN,,0,0,0,,Over here, we're not taking the derivative of foo with respect to c.
Dialogue: 0,0:33:36.78,0:33:39.30,EN,,0,0,0,,But the shapes of these expressions are the same.
Dialogue: 0,0:33:40.54,0:33:43.96,EN,,0,0,0,,See all those shapes. They're the same.
Dialogue: 0,0:33:50.37,0:33:52.28,EN,,0,0,0,,Well is there anything wrong with our rules?
Dialogue: 0,0:33:53.58,0:33:55.02,EN,,0,0,0,,No. They're the right rules.
Dialogue: 0,0:33:56.12,0:33:57.77,EN,,0,0,0,,We've been through this one before.
Dialogue: 0,0:33:58.06,0:34:03.53,EN,,0,0,0,,One of the things you're going to begin to discover is that there aren't too many good ideas.
Dialogue: 0,0:34:06.32,0:34:09.74,EN,,0,0,0,,When we were looking at rational numbers yesterday,
Dialogue: 0,0:34:12.12,0:34:14.48,EN,,0,0,0,,the problem was that we got 6/8 rather then 3/4.
Dialogue: 0,0:34:14.97,0:34:16.49,EN,,0,0,0,,The answer was unsimplified.
Dialogue: 0,0:34:18.09,0:34:20.90,EN,,0,0,0,,The problem, of course, is very similar.
Dialogue: 0,0:34:21.18,0:34:25.41,EN,,0,0,0,,There are things I'd like to be identical by simplification that don't become identical.
Dialogue: 0,0:34:27.57,0:34:31.89,EN,,0,0,0,,And yet the rules for doing addition a multiplication of rational numbers were correct.
Dialogue: 0,0:34:33.97,0:34:37.41,EN,,0,0,0,,So the way we might solve this problem is do the thing we did last time, which always works.
Dialogue: 0,0:34:37.78,0:34:39.89,EN,,0,0,0,,If something worked last time it ought to work again.
Dialogue: 0,0:34:40.53,0:34:42.05,EN,,0,0,0,,It's changed representation.
Dialogue: 0,0:34:43.13,0:34:46.44,EN,,0,0,0,,Perhaps in the representation we could put in a simplification step
Dialogue: 0,0:34:47.88,0:34:49.78,EN,,0,0,0,,that produces a simplified representation.
Dialogue: 0,0:34:50.17,0:34:51.73,EN,,0,0,0,,This may not always work, of course.
Dialogue: 0,0:34:52.49,0:34:54.14,EN,,0,0,0,,I'm not trying to say that it always works.
Dialogue: 0,0:34:55.12,0:35:00.44,EN,,0,0,0,,But it's one of the pieces of artillery we have in our war against complexity.
Dialogue: 0,0:35:01.46,0:35:03.85,EN,,0,0,0,,You see, because we solved our problem very carefully.
Dialogue: 0,0:35:04.30,0:35:07.20,EN,,0,0,0,,What we've done, is we've divided the world in several parts.
Dialogue: 0,0:35:07.57,0:35:08.73,EN,,0,0,0,,There are derivatives rules
Dialogue: 0,0:35:11.32,0:35:15.80,EN,,0,0,0,,and general rules for algebra of some sort at this level of detail.
Dialogue: 0,0:35:16.38,0:35:21.22,EN,,0,0,0,,and i have an abstraction barrier.
Dialogue: 0,0:35:22.48,0:35:33.49,EN,,0,0,0,,And i have the representation of the algebraic expressions, list structure.
Dialogue: 0,0:35:37.33,0:35:42.56,EN,,0,0,0,,And in this barrier, I have the interface procedures.
Dialogue: 0,0:35:43.25,0:35:49.82,EN,,0,0,0,,I have constant, and things like same-var.
Dialogue: 0,0:35:54.60,0:35:58.72,EN,,0,0,0,,I have things like sum, make-sum.
Dialogue: 0,0:36:02.22,0:36:05.57,EN,,0,0,0,,I have A1, A2.
Dialogue: 0,0:36:06.60,0:36:08.58,EN,,0,0,0,,I have products and things like that,
Dialogue: 0,0:36:08.74,0:36:11.90,EN,,0,0,0,,all the other things I might need for various kinds of algebraic expressions.
Dialogue: 0,0:36:12.94,0:36:19.14,EN,,0,0,0,,Making this barrier allows me to arbitrarily change the representation
Dialogue: 0,0:36:20.14,0:36:23.20,EN,,0,0,0,,without changing the rules that are written in terms of that representation.
Dialogue: 0,0:36:25.04,0:36:29.08,EN,,0,0,0,,So if I can make the problem go away by changing representation,
Dialogue: 0,0:36:30.38,0:36:34.52,EN,,0,0,0,,the composition of the problem into these two parts has helped me a great deal.
Dialogue: 0,0:36:35.65,0:36:37.54,EN,,0,0,0,,So let's take a very simple case of this.
Dialogue: 0,0:36:38.82,0:36:40.08,EN,,0,0,0,,What was one of the problems?
Dialogue: 0,0:36:40.26,0:36:43.61,EN,,0,0,0,,Let's go back to this transparency again.
Dialogue: 0,0:36:44.50,0:36:47.34,EN,,0,0,0,,And we see here, oh yes, there's horrible things
Dialogue: 0,0:36:47.62,0:36:51.86,EN,,0,0,0,,like here is the sum of an expression and 0.
Dialogue: 0,0:36:53.14,0:36:56.66,EN,,0,0,0,,Well that's no reason to think of it as anything other than the expression itself.
Dialogue: 0,0:36:57.21,0:37:01.90,EN,,0,0,0,,Why should the summation operation have made up this edition?
Dialogue: 0,0:37:03.38,0:37:04.57,EN,,0,0,0,,It can be smarter than that.
Dialogue: 0,0:37:05.56,0:37:10.08,EN,,0,0,0,,Or here, for example, is a multiplication of something by 1.
Dialogue: 0,0:37:11.16,0:37:12.29,EN,,0,0,0,,It's another thing like that.
Dialogue: 0,0:37:12.86,0:37:15.68,EN,,0,0,0,,Or here is a product of something with 0, which is certainly 0.
Dialogue: 0,0:37:17.86,0:37:19.52,EN,,0,0,0,,So we won't have to make this construction.
Dialogue: 0,0:37:21.44,0:37:22.62,EN,,0,0,0,,So why don't we just do that?
Dialogue: 0,0:37:23.66,0:37:27.96,EN,,0,0,0,,We need to change the way the representation works, almost here.
Dialogue: 0,0:37:37.40,0:37:41.84,EN,,0,0,0,,Make-sum to be.
Dialogue: 0,0:37:42.05,0:37:43.76,EN,,0,0,0,,Well, now it's not something so simple.
Dialogue: 0,0:37:44.00,0:37:50.40,EN,,0,0,0,,I'm not going to make a list containing the symbol plus and things unless I need to.
Dialogue: 0,0:37:51.72,0:37:53.05,EN,,0,0,0,,Well, what are the possibilities?
Dialogue: 0,0:37:54.56,0:37:58.53,EN,,0,0,0,,If...I have some sort of cases here.
Dialogue: 0,0:37:59.38,0:38:08.20,EN,,0,0,0,,If I have numbers, if a1 is a number--
Dialogue: 0,0:38:09.05,0:38:10.93,EN,,0,0,0,,and here's another primitive I've just introduced,
Dialogue: 0,0:38:10.93,0:38:13.18,EN,,0,0,0,,it's possible to tell whether something's number--
Dialogue: 0,0:38:15.38,0:38:23.82,EN,,0,0,0,,and if number A2, meaning they're not symbolic expressions,
Dialogue: 0,0:38:24.45,0:38:26.20,EN,,0,0,0,,then why not do the addition now?
Dialogue: 0,0:38:26.45,0:38:29.92,EN,,0,0,0,,The result is just a plus of A1 and A2.
Dialogue: 0,0:38:32.32,0:38:33.98,EN,,0,0,0,,I'm not asking if these represent numbers.
Dialogue: 0,0:38:33.98,0:38:35.98,EN,,0,0,0,,Of course all of these symbols represent numbers.
Dialogue: 0,0:38:37.33,0:38:41.22,EN,,0,0,0,,I'm talking about whether the one I've got is the number 3 right now.
Dialogue: 0,0:38:43.40,0:38:44.40,EN,,0,0,0,,And, for example,
Dialogue: 0,0:38:48.77,0:38:59.61,EN,,0,0,0,,supposing A1 is a number, and it's equal to 0,
Dialogue: 0,0:39:04.20,0:39:06.38,EN,,0,0,0,,well then the answer is just A2.
Dialogue: 0,0:39:06.93,0:39:08.68,EN,,0,0,0,,There is no reason to make anything up.
Dialogue: 0,0:39:10.98,0:39:23.41,EN,,0,0,0,,And if A2 is a number, and equal A2 0,
Dialogue: 0,0:39:27.16,0:39:28.90,EN,,0,0,0,,then the result is A1.
Dialogue: 0,0:39:30.04,0:39:33.65,EN,,0,0,0,,And only if I can't figure out something better to do with this situation,
Dialogue: 0,0:39:34.13,0:39:35.61,EN,,0,0,0,,well, I can construct a list.
Dialogue: 0,0:39:37.86,0:39:42.86,EN,,0,0,0,,Otherwise I want the representation to be the list
Dialogue: 0,0:39:44.13,0:39:52.33,EN,,0,0,0,,containing the quoted symbol plus, and A1, and A2.
Dialogue: 0,0:39:58.66,0:40:01.65,EN,,0,0,0,,And, of course, a very similar thing can be done for products.
Dialogue: 0,0:40:03.01,0:40:05.04,EN,,0,0,0,,And I think I'll avoid boring you with them.
Dialogue: 0,0:40:05.44,0:40:07.24,EN,,0,0,0,,I was going to write it on the blackboard.
Dialogue: 0,0:40:07.65,0:40:09.80,EN,,0,0,0,,I don't think it's necessary. You know what to do.
Dialogue: 0,0:40:10.76,0:40:11.61,EN,,0,0,0,,It's very simple.
Dialogue: 0,0:40:12.86,0:40:19.89,EN,,0,0,0,,But now, let's just see the kind of results we get out of changing our program in this way.
Dialogue: 0,0:40:21.68,0:40:27.88,EN,,0,0,0,,Well, here's the derivatives after having just changed the constructors for expressions.
Dialogue: 0,0:40:28.98,0:40:32.21,EN,,0,0,0,,The same foo, aX square plus bX plus c,
Dialogue: 0,0:40:33.28,0:40:40.70,EN,,0,0,0,,and what I get is nothing more than the derivative of that is 2aX plus B.
Dialogue: 0,0:40:40.70,0:40:42.10,EN,,0,0,0,,Well, it's not completely simplified.
Dialogue: 0,0:40:42.60,0:40:44.53,EN,,0,0,0,,I would like to collect common terms and sums.
Dialogue: 0,0:40:45.06,0:40:46.08,EN,,0,0,0,,Well, that's more work.
Dialogue: 0,0:40:47.12,0:40:51.86,EN,,0,0,0,,And, of course, programs to do this sort of thing are huge and complicated.
Dialogue: 0,0:40:52.28,0:40:55.28,EN,,0,0,0,,Algebraic simplification, it's a very complicated mess.
Dialogue: 0,0:40:56.37,0:41:00.13,EN,,0,0,0,,There's a very famous program you may have heard of called Maxima developed at MIT in the past,
Dialogue: 0,0:41:00.42,0:41:03.14,EN,,0,0,0,,which is 5,000 pages of Lisp code,
Dialogue: 0,0:41:03.92,0:41:06.50,EN,,0,0,0,,mostly the algebraic simplification operations.
Dialogue: 0,0:41:08.08,0:41:12.21,EN,,0,0,0,,There we see the derivative of foo.
Dialogue: 0,0:41:12.21,0:41:16.86,EN,,0,0,0,,In fact, alias is something I wouldn't take off more than 1 point for on an elementary calculus class.
Dialogue: 0,0:41:18.38,0:41:22.49,EN,,0,0,0,,And the derivative of foo with respect to a, well it's gone down to X times X,
Dialogue: 0,0:41:22.80,0:41:23.80,EN,,0,0,0,,which isn't so bad.
Dialogue: 0,0:41:24.74,0:41:27.53,EN,,0,0,0,,And the derivative of foo with respect to b is just X itself.
Dialogue: 0,0:41:28.06,0:41:30.12,EN,,0,0,0,,And the derivative of foo with respect to c comes out 1.
Dialogue: 0,0:41:30.70,0:41:32.04,EN,,0,0,0,,So I'm pretty pleased with this.
Dialogue: 0,0:41:34.10,0:41:39.01,EN,,0,0,0,,What you've seen is, of course, a little bit contrived, carefully organized example
Dialogue: 0,0:41:39.56,0:41:42.60,EN,,0,0,0,,to show you how we can manipulate algebraic expressions,
Dialogue: 0,0:41:42.96,0:41:47.93,EN,,0,0,0,,how we do that abstractly in terms of abstract syntax rather than concrete syntax
Dialogue: 0,0:41:49.21,0:41:56.29,EN,,0,0,0,,and how we can use the abstraction to control what goes on in building these expressions.
Dialogue: 0,0:41:57.80,0:42:00.41,EN,,0,0,0,,But the real story isn't just such a simple thing as that.
Dialogue: 0,0:42:01.00,0:42:04.45,EN,,0,0,0,,The real story is, in fact, that I'm manipulating these expressions.
Dialogue: 0,0:42:04.45,0:42:06.72,EN,,0,0,0,,And the expressions are the same expressions--
Dialogue: 0,0:42:06.72,0:42:07.97,EN,,0,0,0,,going back to the slide--
Dialogue: 0,0:42:08.08,0:42:10.52,EN,,0,0,0,,as the ones that are Lisp expressions.
Dialogue: 0,0:42:12.02,0:42:12.97,EN,,0,0,0,,There's a pun here.
Dialogue: 0,0:42:13.82,0:42:21.49,EN,,0,0,0,,I've chosen my representation to be the same as the representation in my language of similar things.
Dialogue: 0,0:42:22.89,0:42:26.52,EN,,0,0,0,,By doing so, I've invoked a necessity.
Dialogue: 0,0:42:26.90,0:42:30.34,EN,,0,0,0,,I created the necessity to have things like quotation
Dialogue: 0,0:42:30.97,0:42:38.17,EN,,0,0,0,,because of the fact that my language is capable of writing expressions that talk about expressions of the language.
Dialogue: 0,0:42:39.76,0:42:43.22,EN,,0,0,0,,I need to have something that says, this is an expression I'm talking about
Dialogue: 0,0:42:43.76,0:42:46.13,EN,,0,0,0,,rather than this expression is talking about something,
Dialogue: 0,0:42:47.20,0:42:48.44,EN,,0,0,0,,and I want to talk about that.
Dialogue: 0,0:42:51.34,0:42:55.36,EN,,0,0,0,,So quotation stops and says, I'm talking about this expression itself.
Dialogue: 0,0:42:57.97,0:43:00.85,EN,,0,0,0,,Now, given that power,
Dialogue: 0,0:43:01.58,0:43:03.82,EN,,0,0,0,,if I can manipulate expressions of the language,
Dialogue: 0,0:43:04.80,0:43:09.00,EN,,0,0,0,,I can begin to build even much more powerful layers upon layers of languages.
Dialogue: 0,0:43:09.77,0:43:12.64,EN,,0,0,0,,Because I can write languages that not only are embedded in Lisp
Dialogue: 0,0:43:13.46,0:43:14.80,EN,,0,0,0,,or whatever language you start with,
Dialogue: 0,0:43:15.26,0:43:17.76,EN,,0,0,0,,but languages that are completely different,
Dialogue: 0,0:43:18.58,0:43:22.24,EN,,0,0,0,,that are just, if we say, interpreted in Lisp or something like that.
Dialogue: 0,0:43:23.17,0:43:25.46,EN,,0,0,0,,We'll get to understand those words more in the future.
Dialogue: 0,0:43:26.56,0:43:32.09,EN,,0,0,0,,But right now I just want to leave you with the fact that we've hit a line
Dialogue: 0,0:43:32.36,0:43:34.98,EN,,0,0,0,,which gives us tremendous power.
Dialogue: 0,0:43:36.00,0:43:37.82,EN,,0,0,0,,And this point we've bought a sledgehammer.
Dialogue: 0,0:43:38.17,0:43:40.92,EN,,0,0,0,,We have to be careful to what flies when we apply it.
Dialogue: 0,0:43:42.17,0:43:43.00,EN,,0,0,0,,Thank you.
Dialogue: 0,0:00:00.00,0:00:02.32,Declare,,0,0,0,,{\an2\fad(500,500)}Learning-SICP学习小组\N倾情制作
Dialogue: 0,0:00:02.57,0:00:11.10,title,,0,0,0,,{\fad(600,800)\pos(324,32)}计算机程序的构造和解释
Dialogue: 0,0:00:02.57,0:00:11.10,staff,,0,0,0,,{\fad(600,800)\pos(534.666,404)}字幕&时间轴\N邓雄飞\N(Dysprosium)
Dialogue: 0,0:00:02.57,0:00:11.10,staff,,0,0,0,,{\fad(600,800)\pos(110.666,403.334)}后期&特效\N邓雄飞\N(Dysprosium)
Dialogue: 0,0:00:02.57,0:00:11.10,staff,,0,0,0,,{\fad(600,800)\pos(574.667,277.333)}校对\N邓雄飞
Dialogue: 0,0:00:02.57,0:00:11.10,staff,,0,0,0,,{\fad(600,800)\pos(89.334,273.333)}特别感谢\N裘宗燕教授
Dialogue: 0,0:00:11.24,0:00:14.46,Declare,,0,0,0,,{\an2\fad(500,500)}符号化求导系统,引用
Dialogue: 0,0:00:19.10,0:00:23.41,Default,,0,0,0,,教授:嗯 Harold教授讲解了如何构造健壮的系统
Dialogue: 0,0:00:23.80,0:00:26.17,Default,,0,0,0,,关键点就是
Dialogue: 0,0:00:26.81,0:00:30.20,Default,,0,0,0,,我想你们大多还没吃透其中的要点
Dialogue: 0,0:00:30.20,0:00:33.77,Default,,0,0,0,,要点就是 为了让系统具有健壮性
Dialogue: 0,0:00:33.93,0:00:36.48,Default,,0,0,0,,应该让它对小变化不敏感
Dialogue: 0,0:00:36.60,0:00:37.37,Default,,0,0,0,,也就是说
Dialogue: 0,0:00:37.37,0:00:40.90,Default,,0,0,0,,问题中的小改变只会导致解决方案的小改动
Dialogue: 0,0:00:41.32,0:00:42.90,Default,,0,0,0,,系统应该是连续的
Dialogue: 0,0:00:42.90,0:00:45.94,Default,,0,0,0,,在问题空间中 解的空间是连续的
Dialogue: 0,0:00:46.25,0:00:48.76,Default,,0,0,0,,Harold教授给你们解释过
Dialogue: 0,0:00:49.46,0:00:54.78,Default,,0,0,0,,与其在问题分解出的子问题上 求解具体问题
Dialogue: 0,0:00:55.08,0:00:56.78,Default,,0,0,0,,你不如解决一类问题
Dialogue: 0,0:00:56.78,0:01:00.40,Default,,0,0,0,,也就是你想要解决的具体问题的“邻居”
Dialogue: 0,0:01:01.40,0:01:04.76,Default,,0,0,0,,解决之道便是在该层次上构造一门语言
Dialogue: 0,0:01:04.76,0:01:10.33,Default,,0,0,0,,使得我们可以用这门语言来表述这类问题
Dialogue: 0,0:01:11.37,0:01:15.09,Default,,0,0,0,,因此 当着手解决的问题再发生变动时
Dialogue: 0,0:01:15.09,0:01:19.29,Default,,0,0,0,,通常 你只需要在已构造好的解决方案上做出微小改动
Dialogue: 0,0:01:19.29,0:01:22.26,Default,,0,0,0,,因为在你所考虑的层次上
Dialogue: 0,0:01:22.26,0:01:24.26,Default,,0,0,0,,有一门语言可以表达
Dialogue: 0,0:01:24.80,0:01:28.14,Default,,0,0,0,,类似问题的各种解法
Dialogue: 0,0:01:30.04,0:01:33.74,Default,,0,0,0,,呃... 这是一个重要思想的萌芽
Dialogue: 0,0:01:34.40,0:01:38.61,Default,,0,0,0,,该思想的重要性也使得计算机科学比
Dialogue: 0,0:01:38.61,0:01:42.37,Default,,0,0,0,,其它大多数工程学科还要强大
Dialogue: 0,0:01:43.38,0:01:44.73,Default,,0,0,0,,目前为止 我们学习的是
Dialogue: 0,0:01:44.73,0:01:48.78,Default,,0,0,0,,类似于 如何使用语言内置元素
Dialogue: 0,0:01:49.26,0:01:53.36,Default,,0,0,0,,当然 内置元素的力量一部分来源于
Dialogue: 0,0:01:54.12,0:01:56.86,Default,,0,0,0,,像这个一样的过程 我昨天给你们展示过了
Dialogue: 0,0:01:57.37,0:02:02.13,Default,,0,0,0,,这里 是一份求导程序 昨天给你们描述过了
Dialogue: 0,0:02:02.13,0:02:05.92,Default,,0,0,0,,这个过程以一个过程为参数
Dialogue: 0,0:02:06.00,0:02:07.92,Default,,0,0,0,,并返回一个过程
Dialogue: 0,0:02:09.61,0:02:12.65,Default,,0,0,0,,用这样的东西棒极了
Dialogue: 0,0:02:12.65,0:02:14.65,Default,,0,0,0,,你可以像创建PUSH组合子那样构造
Dialogue: 0,0:02:14.65,0:02:16.86,Default,,0,0,0,,可以像上节课看到的哪些奇妙东西那样
Dialogue: 0,0:02:17.68,0:02:20.54,Default,,0,0,0,,现在 我要来打个太极
Dialogue: 0,0:02:21.56,0:02:25.90,Default,,0,0,0,,这个程序混淆了过程和数据
Dialogue: 0,0:02:26.56,0:02:27.81,Default,,0,0,0,,虽然程度不算太重
Dialogue: 0,0:02:28.42,0:02:30.90,Default,,0,0,0,,而我们将要严重地混淆两者
Dialogue: 0,0:02:31.18,0:02:32.44,Default,,0,0,0,,最好的做法就是
Dialogue: 0,0:02:32.44,0:02:37.62,Default,,0,0,0,,参与到过程自身所描述的代数表达式的操作中
Dialogue: 0,0:02:39.73,0:02:45.58,Default,,0,0,0,,所以 这里我不会讨论这张幻灯片上的东西
Dialogue: 0,0:02:45.89,0:02:49.72,Default,,0,0,0,,一个通过操作过程的求导程序
Dialogue: 0,0:02:49.72,0:02:51.94,Default,,0,0,0,,这只是一个数值化方法而已
Dialogue: 0,0:02:51.94,0:02:58.93,Default,,0,0,0,,你们所看到的是 通过数值方法来近似的求导程序
Dialogue: 0,0:02:59.29,0:03:00.44,Default,,0,0,0,,也就是这里的东西了
Dialogue: 0,0:03:00.86,0:03:04.93,Default,,0,0,0,,事实上 我想讨论的是这些东西
Dialogue: 0,0:03:06.05,0:03:11.33,Default,,0,0,0,,这是一份从微积分书中摘录的法则
Dialogue: 0,0:03:12.09,0:03:16.17,Default,,0,0,0,,这对表达式求导的法则
Dialogue: 0,0:03:16.70,0:03:20.58,Default,,0,0,0,,只不过是用代数语言书写的
Dialogue: 0,0:03:21.64,0:03:24.41,Default,,0,0,0,,法则说 常数的导数是0
Dialogue: 0,0:03:25.13,0:03:29.09,Default,,0,0,0,,而代表你所讨论的那个数的变量导数为1
Dialogue: 0,0:03:29.32,0:03:31.93,Default,,0,0,0,,常数乘以函数的导数
Dialogue: 0,0:03:32.09,0:03:34.37,Default,,0,0,0,,其值是常数的值乘以函数导数的值
Dialogue: 0,0:03:34.77,0:03:36.04,Default,,0,0,0,,就是这个意思
Dialogue: 0,0:03:38.05,0:03:41.38,Default,,0,0,0,,这些都是精确的表达式 而非数值近似
Dialogue: 0,0:03:42.96,0:03:44.52,Default,,0,0,0,,我们还能编写程序吗?
Dialogue: 0,0:03:44.52,0:03:52.24,Default,,0,0,0,,事实上 编写处理这些表达式的程序非常容易
Dialogue: 0,0:03:56.38,0:03:59.52,Default,,0,0,0,,让我们仔细地看看这些法则
Dialogue: 0,0:04:01.08,0:04:05.22,Default,,0,0,0,,你们曾经在初等微积分课上学过这些法则了
Dialogue: 0,0:04:05.98,0:04:12.12,Default,,0,0,0,,你们知道 微积分中对多元表达式求导很容易
Dialogue: 0,0:04:12.53,0:04:16.05,Default,,0,0,0,,在微积分课上 你们也知道计算积分不容易
Dialogue: 0,0:04:16.98,0:04:19.37,Default,,0,0,0,,虽然积分和求导相对
Dialogue: 0,0:04:19.52,0:04:21.28,Default,,0,0,0,,它俩互为逆运算
Dialogue: 0,0:04:21.61,0:04:23.30,Default,,0,0,0,,但它们有同样的法则
Dialogue: 0,0:04:24.16,0:04:29.68,Default,,0,0,0,,但这些法则中又有什么特殊的东西
Dialogue: 0,0:04:29.68,0:04:33.65,Default,,0,0,0,,使得求导容易 求积分就困难呢?
Dialogue: 0,0:04:34.85,0:04:36.98,Default,,0,0,0,,我们浅显地想一想
Dialogue: 0,0:04:37.40,0:04:38.38,Default,,0,0,0,,仔细考察法则
Dialogue: 0,0:04:39.36,0:04:43.06,Default,,0,0,0,,对于每条法则来说 你求导数时的方向
Dialogue: 0,0:04:43.06,0:04:44.80,Default,,0,0,0,,这个箭头的方向
Dialogue: 0,0:04:46.68,0:04:49.16,Default,,0,0,0,,法则的左边与你的表达式相匹配
Dialogue: 0,0:04:49.16,0:04:53.05,Default,,0,0,0,,法则的右边就是表达式的导数
Dialogue: 0,0:04:54.02,0:04:55.65,Default,,0,0,0,,箭头是这个方向的
Dialogue: 0,0:04:57.37,0:05:00.45,Default,,0,0,0,,每条法则中
Dialogue: 0,0:05:01.24,0:05:03.72,Default,,0,0,0,,法则右边的表达式
Dialogue: 0,0:05:03.72,0:05:06.56,Default,,0,0,0,,都是求导过程中的子表达式
Dialogue: 0,0:05:06.56,0:05:10.29,Default,,0,0,0,,都是左边式子的合法子表达式
Dialogue: 0,0:05:10.60,0:05:13.25,Default,,0,0,0,,这里 我们发现 和的导数
Dialogue: 0,0:05:13.92,0:05:16.13,Default,,0,0,0,,也就是左边式子的导数
Dialogue: 0,0:05:16.13,0:05:18.38,Default,,0,0,0,,就是两部分导数之和
Dialogue: 0,0:05:20.08,0:05:24.49,Default,,0,0,0,,法则从左至右的方向是“归约规则”
Dialogue: 0,0:05:25.02,0:05:26.61,Default,,0,0,0,,问题变简单了
Dialogue: 0,0:05:27.56,0:05:31.48,Default,,0,0,0,,我把一个复杂的问题 转化成了许多小点儿的问题
Dialogue: 0,0:05:32.44,0:05:35.76,Default,,0,0,0,,然后把结果组合起来 这里用递归可以完美地解决
Dialogue: 0,0:05:36.58,0:05:40.85,Default,,0,0,0,,但如果我从另外的方向来思考
Dialogue: 0,0:05:41.81,0:05:45.13,Default,,0,0,0,,如果我想求积分的话 你会发现有很多问题
Dialogue: 0,0:05:45.24,0:05:49.09,Default,,0,0,0,,就比如 如果我想求一个和的积分
Dialogue: 0,0:05:49.21,0:05:50.81,Default,,0,0,0,,就会匹配多条法则
Dialogue: 0,0:05:50.81,0:05:52.10,Default,,0,0,0,,这条匹配
Dialogue: 0,0:05:52.48,0:05:53.65,Default,,0,0,0,,这条也匹配
Dialogue: 0,0:05:54.81,0:05:57.09,Default,,0,0,0,,我不知道该用哪个——它们之间可能不一样
Dialogue: 0,0:05:57.70,0:06:00.00,Default,,0,0,0,,我得考察两者的不同之处
Dialogue: 0,0:06:00.25,0:06:03.64,Default,,0,0,0,,所以 在这个方向上 表达式变复杂了
Dialogue: 0,0:06:04.53,0:06:06.30,Default,,0,0,0,,当表达式变复杂时
Dialogue: 0,0:06:06.30,0:06:10.56,Default,,0,0,0,,就没法保证我所选的路径一定能终止了
Dialogue: 0,0:06:10.94,0:06:13.46,Default,,0,0,0,,因为唯一的可能是偶然的约分
Dialogue: 0,0:06:14.24,0:06:18.05,Default,,0,0,0,,这也就是为什么 积分是一种复杂的搜索 而难以完成
Dialogue: 0,0:06:19.12,0:06:20.96,Default,,0,0,0,,现在我不想处理这么复杂的东西
Dialogue: 0,0:06:21.49,0:06:23.06,Default,,0,0,0,,我们先来讨论求导数
Dialogue: 0,0:06:24.14,0:06:28.13,Default,,0,0,0,,好吧 我就假设你们都大致了解这些法则了
Dialogue: 0,0:06:28.78,0:06:31.88,Default,,0,0,0,,让我们来看看能不能用程序表达这些法则
Dialogue: 0,0:06:32.22,0:06:33.72,Default,,0,0,0,,这应该很容易
Dialogue: 0,0:06:34.89,0:06:36.21,Default,,0,0,0,,信手拈来
Dialogue: 0,0:06:36.69,0:06:39.29,Default,,0,0,0,,因为 我给你们展示的是“归约规则”
Dialogue: 0,0:06:39.29,0:06:41.29,Default,,0,0,0,,这样用递归来编写会比较合适
Dialogue: 0,0:06:43.08,0:06:45.72,Default,,0,0,0,,当然 对每条法则来说就是一种情况
Dialogue: 0,0:06:46.66,0:06:47.78,Default,,0,0,0,,我们做“分情况分析”
Dialogue: 0,0:06:48.58,0:06:50.36,Default,,0,0,0,,我就这么写了
Dialogue: 0,0:06:52.88,0:06:57.69,Default,,0,0,0,,当然 我得先让大家达成共识 对吧?
Dialogue: 0,0:06:57.69,0:07:00.33,Default,,0,0,0,,你们应该意识到到我可以表示这些代数式
Dialogue: 0,0:07:00.68,0:07:03.88,Default,,0,0,0,,我可以从中抽取式子 也可以将它们组合起来
Dialogue: 0,0:07:04.24,0:07:06.49,Default,,0,0,0,,我们发明了表结构来解决这个问题
Dialogue: 0,0:07:07.52,0:07:09.14,Default,,0,0,0,,但现在我们不必关心
Dialogue: 0,0:07:09.66,0:07:12.45,Default,,0,0,0,,现在 我要编写一个程序来封装这些法则
Dialogue: 0,0:07:12.76,0:07:15.85,Default,,0,0,0,,但它不依赖于代数表达式的表示法
Dialogue: 0,0:07:20.42,0:07:28.84,Default,,0,0,0,,(DERIV EXP VAR)表示表达式EXP关于变量VAR的导数
Dialogue: 0,0:07:30.50,0:07:33.08,Default,,0,0,0,,这和函数的导数是不一样的
Dialogue: 0,0:07:34.82,0:07:38.61,Default,,0,0,0,,那个是我们上节课看到的数值近似
Dialogue: 0,0:07:39.00,0:07:40.82,Default,,0,0,0,,并不能看到函数内部
Dialogue: 0,0:07:40.82,0:07:41.89,Default,,0,0,0,,它只是一个数值
Dialogue: 0,0:07:43.09,0:07:45.18,Default,,0,0,0,,表达式的导数也是一个表达式
Dialogue: 0,0:07:45.74,0:07:47.85,Default,,0,0,0,,因此 这只是一个语法问题
Dialogue: 0,0:07:48.29,0:07:51.62,Default,,0,0,0,,我们今天要做的大多数工作 就是讨论语法
Dialogue: 0,0:07:52.33,0:07:54.12,Default,,0,0,0,,表达式的语法或类似
Dialogue: 0,0:07:54.70,0:07:55.93,Default,,0,0,0,,首先要做“分情况分析”
Dialogue: 0,0:07:57.50,0:08:01.08,Default,,0,0,0,,任何时候我们处理复杂事物 需要递归求解时
Dialogue: 0,0:08:01.08,0:08:02.64,Default,,0,0,0,,我们很可能需要“按情况分析”
Dialogue: 0,0:08:03.62,0:08:05.16,Default,,0,0,0,,通常都是这样开始的
Dialogue: 0,0:08:05.16,0:08:07.40,Default,,0,0,0,,复杂的问题都是用“按情况分析”
Dialogue: 0,0:08:08.08,0:08:09.97,Default,,0,0,0,,那么 有哪些可能(的情况)呢?
Dialogue: 0,0:08:09.97,0:08:12.53,Default,,0,0,0,,第一条法则说 如果你遇到一个常数
Dialogue: 0,0:08:16.50,0:08:17.50,Default,,0,0,0,,这里 我就是在判断
Dialogue: 0,0:08:17.50,0:08:22.22,Default,,0,0,0,,表达式EXP是否为给定变量VAR的常数(常量表达式)
Dialogue: 0,0:08:24.90,0:08:27.08,Default,,0,0,0,,是的话 结果就是0
Dialogue: 0,0:08:27.50,0:08:30.10,Default,,0,0,0,,因为导数表征的是某物的变化率
Dialogue: 0,0:08:31.76,0:08:32.65,Default,,0,0,0,,然而
Dialogue: 0,0:08:32.89,0:08:40.69,Default,,0,0,0,,如果我求导的表达式 与我关心的变量有关
Dialogue: 0,0:08:41.72,0:08:50.42,Default,,0,0,0,,如果判定表达式和变量相同
Dialogue: 0,0:08:51.14,0:08:54.52,Default,,0,0,0,,那么关于变量VAR的表达式EXP的变化率就是1
Dialogue: 0,0:08:55.50,0:08:56.54,Default,,0,0,0,,它俩相同 结果是1
Dialogue: 0,0:08:58.90,0:09:00.77,Default,,0,0,0,,当然 还可能有其它的可能性
Dialogue: 0,0:09:01.33,0:09:03.14,Default,,0,0,0,,比如说 它可能是一个和式
Dialogue: 0,0:09:03.86,0:09:05.88,Default,,0,0,0,,呃 我现在还完全知道该如何表示和式
Dialogue: 0,0:09:06.09,0:09:08.25,Default,,0,0,0,,事实上我可以 只是我还没有告诉你们
Dialogue: 0,0:09:10.34,0:09:11.78,Default,,0,0,0,,如果表达式是和式
Dialogue: 0,0:09:12.48,0:09:14.48,Default,,0,0,0,,我就假想有一种方式可以判别(和式)
Dialogue: 0,0:09:15.30,0:09:19.44,Default,,0,0,0,,这里 我要做一个表达式的类型分派
Dialogue: 0,0:09:20.77,0:09:23.57,Default,,0,0,0,,这是在构建语言时绝对必要的
Dialogue: 0,0:09:24.72,0:09:26.37,Default,,0,0,0,,因为语言由不同的表达式构成
Dialogue: 0,0:09:26.48,0:09:27.54,Default,,0,0,0,,我们马上就将看到
Dialogue: 0,0:09:27.84,0:09:31.02,Default,,0,0,0,,如何用更强大的方法 用语言去构建语言
Dialogue: 0,0:09:32.53,0:09:34.02,Default,,0,0,0,,表达式是和式吗?
Dialogue: 0,0:09:35.45,0:09:38.82,Default,,0,0,0,,如果是的话 很好 我们已经知道和式的求导法则了
Dialogue: 0,0:09:38.82,0:09:41.33,Default,,0,0,0,,即是各部分导数之和
Dialogue: 0,0:09:42.13,0:09:44.32,Default,,0,0,0,,其中一个叫做加数 另一个叫做被加数
Dialogue: 0,0:09:44.32,0:09:46.80,Default,,0,0,0,,黑板上没那么多空间写这么长的名字了
Dialogue: 0,0:09:46.80,0:09:48.40,Default,,0,0,0,,我就姑且把它们叫做 A1和A2
Dialogue: 0,0:09:49.04,0:09:50.37,Default,,0,0,0,,把它们求和
Dialogue: 0,0:09:53.53,0:09:55.68,Default,,0,0,0,,(意义不明)
Dialogue: 0,0:09:57.14,0:10:01.09,Default,,0,0,0,,是叫做被除数和除数一类的么?
Dialogue: 0,0:10:01.65,0:10:08.48,Default,,0,0,0,,将A1的导数...加上
Dialogue: 0,0:10:08.48,0:10:13.29,Default,,0,0,0,,这是关于变量VAR的表达式的加数
Dialogue: 0,0:10:14.84,0:10:22.76,Default,,0,0,0,,与A2的导数相加
Dialogue: 0,0:10:24.12,0:10:28.25,Default,,0,0,0,,这两个参数的和 变量是VAR
Dialogue: 0,0:10:32.36,0:10:34.93,Default,,0,0,0,,我们知道还有一条乘法的求导法则
Dialogue: 0,0:10:35.20,0:10:37.44,Default,,0,0,0,,也就是说 如果表达式是乘式
Dialogue: 0,0:10:43.21,0:10:46.10,Default,,0,0,0,,顺便说下 当你定义过程时 有个好习惯
Dialogue: 0,0:10:46.96,0:10:48.32,Default,,0,0,0,,就是在定义谓词时
Dialogue: 0,0:10:48.85,0:10:50.96,Default,,0,0,0,,将谓词名以问号结尾
Dialogue: 0,0:10:51.08,0:10:52.89,Default,,0,0,0,,问号本身不代表什么
Dialogue: 0,0:10:53.10,0:10:54.50,Default,,0,0,0,,但这是俗成的约定
Dialogue: 0,0:10:54.61,0:10:58.94,Default,,0,0,0,,这是人们之间约定的接口 以方便他人阅读你的脚本
Dialogue: 0,0:11:00.05,0:11:01.96,Default,,0,0,0,,我希望你在写程序的时候
Dialogue: 0,0:11:01.96,0:11:03.73,Default,,0,0,0,,当你定义谓词的时候
Dialogue: 0,0:11:04.01,0:11:05.77,Default,,0,0,0,,就是那些返回TRUE或FALSE的过程
Dialogue: 0,0:11:05.94,0:11:07.84,Default,,0,0,0,,你应该使它们的名字以问号结尾
Dialogue: 0,0:11:08.02,0:11:10.34,Default,,0,0,0,,这对Lisp无异 但对人类友好
Dialogue: 0,0:11:11.62,0:11:13.14,Default,,0,0,0,,我需要求和
Dialogue: 0,0:11:13.14,0:11:17.49,Default,,0,0,0,,因为积的导数就是...
Dialogue: 0,0:11:17.94,0:11:19.64,Default,,0,0,0,,M1*DERIV(M2)
Dialogue: 0,0:11:19.66,0:11:20.70,Default,,0,0,0,,+DERIV(M1)*M2
Dialogue: 0,0:11:23.54,0:11:27.06,Default,,0,0,0,,两者加起来
Dialogue: 0,0:11:29.64,0:11:38.33,Default,,0,0,0,,求积... 呃 就用表达式中的M1来表示(被乘数)好了
Dialogue: 0,0:11:39.85,0:11:48.97,Default,,0,0,0,,表达式中M2关于变量VAR的导数
Dialogue: 0,0:11:51.90,0:12:06.28,Default,,0,0,0,,以及 M1关于变量VAR的导数乘以
Dialogue: 0,0:12:07.10,0:12:11.92,Default,,0,0,0,,M1是这里的被乘数
Dialogue: 0,0:12:13.32,0:12:18.05,Default,,0,0,0,,乘数是表达式中的M2
Dialogue: 0,0:12:20.64,0:12:24.89,Default,,0,0,0,,求积完毕、求和完毕、乘式分析完毕
Dialogue: 0,0:12:24.96,0:12:28.02,Default,,0,0,0,,当然 在这里我可以添加更多的情况
Dialogue: 0,0:12:28.32,0:12:30.82,Default,,0,0,0,,微积分书中的完整法则
Dialogue: 0,0:12:34.80,0:12:39.45,Default,,0,0,0,,我们就是这么来封装这些法则的
Dialogue: 0,0:12:41.53,0:12:43.90,Default,,0,0,0,,如你所见 我们这里用到了大量的“按愿望思维”
Dialogue: 0,0:12:44.54,0:12:47.56,Default,,0,0,0,,我们还没有说这些(表达式)是如何表示的
Dialogue: 0,0:12:48.46,0:12:51.92,Default,,0,0,0,,现在 一旦我将其定为我的一套法则
Dialogue: 0,0:12:52.52,0:12:55.20,Default,,0,0,0,,我想是时候考虑表示法了
Dialogue: 0,0:12:55.66,0:12:56.69,Default,,0,0,0,,我们来拿捏拿捏
Dialogue: 0,0:12:57.96,0:13:00.00,Default,,0,0,0,,首先 我要用到一种“双关”思想
Dialogue: 0,0:13:00.90,0:13:02.12,Default,,0,0,0,,这种“双关”思想非常重要
Dialogue: 0,0:13:02.74,0:13:06.56,Default,,0,0,0,,它是一种强有力思想的关键
Dialogue: 0,0:13:09.62,0:13:14.41,Default,,0,0,0,,如果我想表达诸如和、积、差、商的东西
Dialogue: 0,0:13:15.22,0:13:18.62,Default,,0,0,0,,为什么不用和我程序一样的语言呢?
Dialogue: 0,0:13:20.50,0:13:23.64,Default,,0,0,0,,我程序中 代数表达式是形如
Dialogue: 0,0:13:23.98,0:13:30.45,Default,,0,0,0,,(+ (* A (* X X))
Dialogue: 0,0:13:32.60,0:13:33.80,Default,,0,0,0,,和与之类似的
Dialogue: 0,0:13:34.28,0:13:38.50,Default,,0,0,0,,(* B X)以及C
Dialogue: 0,0:13:38.50,0:13:39.97,Default,,0,0,0,,把它们加起来
Dialogue: 0,0:13:40.77,0:13:44.09,Default,,0,0,0,,现在 我的过程还不能处理多元参数
Dialogue: 0,0:13:44.93,0:13:48.46,Default,,0,0,0,,(+ (* B X) C)
Dialogue: 0,0:13:51.42,0:13:52.44,Default,,0,0,0,,这是表结构
Dialogue: 0,0:13:54.12,0:13:55.74,Default,,0,0,0,,这么做很棒 是因为
Dialogue: 0,0:13:55.90,0:13:58.33,Default,,0,0,0,,是因为这些对象都有一种性质
Dialogue: 0,0:13:58.92,0:14:01.53,Default,,0,0,0,,我知道它们的CAR部分是什么
Dialogue: 0,0:14:01.96,0:14:03.21,Default,,0,0,0,,CAR部分就是运算符
Dialogue: 0,0:14:03.92,0:14:06.38,Default,,0,0,0,,运算数是相继的CDR部分
Dialogue: 0,0:14:07.22,0:14:10.36,Default,,0,0,0,,也就是不断取表CDR部分的CAR部分
Dialogue: 0,0:14:12.48,0:14:13.88,Default,,0,0,0,,这样就使它很方便了
Dialogue: 0,0:14:14.01,0:14:16.40,Default,,0,0,0,,我需要去解析它 但它已经帮我完成了
Dialogue: 0,0:14:17.42,0:14:20.01,Default,,0,0,0,,我利用了Lisp中的内建元素
Dialogue: 0,0:14:22.66,0:14:23.77,Default,,0,0,0,,举个例子
Dialogue: 0,0:14:25.08,0:14:33.97,Default,,0,0,0,,我们用表结构来表示我所暗示的表示法吧!
Dialogue: 0,0:14:35.25,0:14:38.34,Default,,0,0,0,,我需要定义一些东西 这都暗含在这种表示法中
Dialogue: 0,0:14:38.54,0:14:40.90,Default,,0,0,0,,比如如何判定是否为常量
Dialogue: 0,0:14:41.21,0:14:42.30,Default,,0,0,0,,又怎么判断是同一个变量
Dialogue: 0,0:14:42.40,0:14:45.04,Default,,0,0,0,,我们先完成这些吧 都相当简单
Dialogue: 0,0:14:45.78,0:14:47.70,Default,,0,0,0,,这里 我要介绍一些基本过程
Dialogue: 0,0:14:48.60,0:14:50.50,Default,,0,0,0,,因为它们都是与表结构相关的
Dialogue: 0,0:14:51.98,0:14:53.46,Default,,0,0,0,,CONSTANT?谓词定义为
Dialogue: 0,0:15:02.25,0:15:04.29,Default,,0,0,0,,我所谓的常量
Dialogue: 0,0:15:04.29,0:15:07.73,Default,,0,0,0,,表达式关于变量VAR是一个常量
Dialogue: 0,0:15:09.05,0:15:11.60,Default,,0,0,0,,是一些简单的表达式
Dialogue: 0,0:15:11.60,0:15:14.46,Default,,0,0,0,,我无法再细化它 但它也不是我们关心的变量
Dialogue: 0,0:15:16.58,0:15:18.78,Default,,0,0,0,,我无法分解它 但它也不是我们关心的变量
Dialogue: 0,0:15:18.90,0:15:25.12,Default,,0,0,0,,这也并不是说 一些复杂的表达式就不是常量表达式
Dialogue: 0,0:15:25.20,0:15:28.92,Default,,0,0,0,,我只是想用这种方式考察基本常量
Dialogue: 0,0:15:29.74,0:15:33.41,Default,,0,0,0,,因此 这个谓词是几个条件的合取
Dialogue: 0,0:15:34.02,0:15:37.82,Default,,0,0,0,,AND语句允许用户组合返回TRUE或者FALSE的谓词
Dialogue: 0,0:15:38.62,0:15:46.82,Default,,0,0,0,,表达式是原子的么?--原子表达式不可以再被细分
Dialogue: 0,0:15:46.82,0:15:48.53,Default,,0,0,0,,它没有CAR部分和CDR部分
Dialogue: 0,0:15:49.45,0:15:50.21,Default,,0,0,0,,它不是表
Dialogue: 0,0:15:50.76,0:15:52.94,Default,,0,0,0,,系统中内建有特殊测试
Dialogue: 0,0:15:53.97,0:16:04.66,Default,,0,0,0,,并且表达式EXP和变量VAR在EQ?的语义下不相等
Dialogue: 0,0:16:06.82,0:16:13.36,Default,,0,0,0,,我用不能被分解的符号来表示变量
Dialogue: 0,0:16:13.90,0:16:17.22,Default,,0,0,0,,比如'X 'Y 和像这样的
Dialogue: 0,0:16:19.74,0:16:22.37,Default,,0,0,0,,当然 像这样的组合式就可以再被细分
Dialogue: 0,0:16:24.74,0:16:46.40,Default,,0,0,0,,(SAME-VAR? EXP VAR)定义为
Dialogue: 0,0:16:46.40,0:16:48.40,Default,,0,0,0,,实际上 一条原子表达式……
Dialogue: 0,0:16:48.77,0:16:59.61,Default,,0,0,0,,该表达式与讨论变量相同
Dialogue: 0,0:17:07.90,0:17:11.68,Default,,0,0,0,,我不想深入讨论这些过程内部
Dialogue: 0,0:17:12.52,0:17:15.56,Default,,0,0,0,,把这些当作基本过程
Dialogue: 0,0:17:15.77,0:17:17.08,Default,,0,0,0,,这无关紧要
Dialogue: 0,0:17:17.78,0:17:21.74,Default,,0,0,0,,我用的是语言内置的功能
Dialogue: 0,0:17:22.42,0:17:24.04,Default,,0,0,0,,我并不关心这些(具体实现)
Dialogue: 0,0:17:24.42,0:17:26.04,Default,,0,0,0,,现在 我们要如何处理和式呢?
Dialogue: 0,0:17:26.60,0:17:28.80,Default,,0,0,0,,啊哈 好戏就要上演了
Dialogue: 0,0:17:28.98,0:17:33.12,Default,,0,0,0,,和式不是原子的 它以‘+’号打头
Dialogue: 0,0:17:35.16,0:17:36.17,Default,,0,0,0,,就是这个意思
Dialogue: 0,0:17:36.65,0:17:39.77,Default,,0,0,0,,这里 我定义
Dialogue: 0,0:17:45.46,0:17:57.77,Default,,0,0,0,,表达式为和式 当它不是原子表达式
Dialogue: 0,0:18:04.57,0:18:15.45,Default,,0,0,0,,并且它的开头 表达式的CAR部分是个‘+’号
Dialogue: 0,0:18:19.74,0:18:24.04,Default,,0,0,0,,我将要引入一个你们从未见过的东西--这个引号
Dialogue: 0,0:18:25.89,0:18:28.22,Default,,0,0,0,,我这里为什么要用引号呢?
Dialogue: 0,0:18:29.48,0:18:30.52,Default,,0,0,0,,教授:说你的名字
Dialogue: 0,0:18:30.68,0:18:31.41,Default,,0,0,0,,观众:Susanna
Dialogue: 0,0:18:31.41,0:18:32.01,Default,,0,0,0,,教授:大点声儿
Dialogue: 0,0:18:32.01,0:18:32.72,Default,,0,0,0,,观众:Susanna
Dialogue: 0,0:18:33.25,0:18:34.21,Default,,0,0,0,,教授:说“你的名字”
Dialogue: 0,0:18:34.21,0:18:34.85,Default,,0,0,0,,观众:“你的名字”
Dialogue: 0,0:18:34.92,0:18:35.68,Default,,0,0,0,,教授:大点声儿
Dialogue: 0,0:18:35.77,0:18:36.61,Default,,0,0,0,,观众:“你的名字”
Dialogue: 0,0:18:36.82,0:18:37.50,Default,,0,0,0,,教授:对了
Dialogue: 0,0:18:38.28,0:18:44.56,Default,,0,0,0,,在这里我想告诉大家 英语词汇是有歧义的
Dialogue: 0,0:18:45.50,0:18:50.76,Default,,0,0,0,,我可能说 “说你的名字”
Dialogue: 0,0:18:51.97,0:18:57.21,Default,,0,0,0,,我也可能说 “说‘你的名字’”
Dialogue: 0,0:19:00.72,0:19:02.98,Default,,0,0,0,,光从说话上还无法分辨
Dialogue: 0,0:19:03.89,0:19:08.01,Default,,0,0,0,,然而书面上 我们有专门的记号--引号
Dialogue: 0,0:19:08.18,0:19:12.46,Default,,0,0,0,,用来区别这两种可能的意思
Dialogue: 0,0:19:14.00,0:19:15.64,Default,,0,0,0,,具体来说 这里
Dialogue: 0,0:19:16.49,0:19:20.84,Default,,0,0,0,,在Lisp中有用于区别这些语义的记号
Dialogue: 0,0:19:21.34,0:19:24.45,Default,,0,0,0,,如果我只是写下一个加号
Dialogue: 0,0:19:24.64,0:19:28.52,Default,,0,0,0,,我会问系统 表达式的首元素
Dialogue: 0,0:19:29.06,0:19:33.61,Default,,0,0,0,,也就是表达式的运算符 是加运算符(一个过程)么?
Dialogue: 0,0:19:34.65,0:19:35.54,Default,,0,0,0,,我并不知道
Dialogue: 0,0:19:36.22,0:19:38.16,Default,,0,0,0,,我本应该在那里写一个加运算符的
Dialogue: 0,0:19:39.37,0:19:40.44,Default,,0,0,0,,但我无法那样做
Dialogue: 0,0:19:41.34,0:19:45.88,Default,,0,0,0,,而这种方式则是问 这个符号对象是否为
Dialogue: 0,0:19:45.98,0:19:48.14,Default,,0,0,0,,代表加运算符的符号
Dialogue: 0,0:19:49.57,0:19:51.92,Default,,0,0,0,,这才是我想要问和知道的问题
Dialogue: 0,0:19:52.92,0:19:54.45,Default,,0,0,0,,在我们深入讨论之前
Dialogue: 0,0:19:54.45,0:19:57.81,Default,,0,0,0,,我想要指出 “引用”是一个复杂的概念
Dialogue: 0,0:19:58.85,0:20:01.84,Default,,0,0,0,,语言中引入这个概念将会造成许多麻烦
Dialogue: 0,0:20:03.57,0:20:05.04,Default,,0,0,0,,请看下面这张幻灯片
Dialogue: 0,0:20:06.38,0:20:09.49,Default,,0,0,0,,这里这个推论没有问题
Dialogue: 0,0:20:11.62,0:20:17.04,Default,,0,0,0,,这是说 Alyssa聪明而Alyssa是George的妈妈
Dialogue: 0,0:20:17.40,0:20:20.60,Default,,0,0,0,,通过IS建立了一个等式
Dialogue: 0,0:20:22.13,0:20:26.30,Default,,0,0,0,,我们可以从这两个陈述推论出 George妈妈很聪明
Dialogue: 0,0:20:27.32,0:20:33.16,Default,,0,0,0,,这是因为我们总可以在表达式中等价替换
Dialogue: 0,0:20:34.09,0:20:35.16,Default,,0,0,0,,真是这样吗?
Dialogue: 0,0:20:36.52,0:20:40.37,Default,,0,0,0,,这个例子说 “Chicago”有七个字母
Dialogue: 0,0:20:41.12,0:20:44.86,Default,,0,0,0,,引用则是强调我讨论的是单词“Chicago”
Dialogue: 0,0:20:44.86,0:20:46.86,Default,,0,0,0,,而不是单词所代表的意思
Dialogue: 0,0:20:49.82,0:20:52.77,Default,,0,0,0,,这里说 Chicago是Illinois州最大的城市
Dialogue: 0,0:20:54.61,0:20:55.80,Default,,0,0,0,,而(代换的)结果是……
Dialogue: 0,0:20:55.80,0:20:59.09,Default,,0,0,0,,我可能会得到 Illinois州最大的城市有七个字母
Dialogue: 0,0:20:59.32,0:21:01.06,Default,,0,0,0,,这显然是错的
Dialogue: 0,0:21:05.16,0:21:07.17,Default,,0,0,0,,喔!手写笔好使了
Dialogue: 0,0:21:09.29,0:21:12.24,Default,,0,0,0,,所以 一旦我们有了(引用)这样的东西
Dialogue: 0,0:21:12.48,0:21:14.49,Default,,0,0,0,,我们的语言就会变得复杂
Dialogue: 0,0:21:14.49,0:21:18.34,Default,,0,0,0,,因为我们对于语言的一些操作就不再正确
Dialogue: 0,0:21:18.34,0:21:20.76,Default,,0,0,0,,比如通过等价代换来得到正确答案
Dialogue: 0,0:21:21.29,0:21:23.50,Default,,0,0,0,,如果不小心地操作就会出错
Dialogue: 0,0:21:24.49,0:21:27.34,Default,,0,0,0,,在一个引用不透明的上下文中 我们无法进行代换
Dialogue: 0,0:21:27.89,0:21:32.64,Default,,0,0,0,,引用就是引用不透明上下文的典型
Dialogue: 0,0:21:33.17,0:21:35.28,Default,,0,0,0,,如果你知道那是什么意思……你可以成为一位哲学家
Dialogue: 0,0:21:35.42,0:21:37.02,Default,,0,0,0,,或许我们之中就有一位
Dialogue: 0,0:21:37.53,0:21:41.32,Default,,0,0,0,,言归正传 我们继续
Dialogue: 0,0:21:41.32,0:21:44.98,Default,,0,0,0,,现在我们对一个有2000年历史的问题至少有了操作上的理解
Dialogue: 0,0:21:45.26,0:21:48.13,Default,,0,0,0,,关于名称、提及和等等类似的问题
Dialogue: 0,0:21:52.32,0:22:01.60,Default,,0,0,0,,我得定义如何把两个数加起来 (DEFINE (MAKE-SUM A1 A2))
Dialogue: 0,0:22:02.12,0:22:03.62,Default,,0,0,0,,我简单实现一下
Dialogue: 0,0:22:03.62,0:22:11.96,Default,,0,0,0,,'+、A1、A2构成列表
Dialogue: 0,0:22:13.86,0:22:17.37,Default,,0,0,0,,我可以决定如何取出第一个元素
Dialogue: 0,0:22:21.84,0:22:25.32,Default,,0,0,0,,(DEFINE A1 CADR)
Dialogue: 0,0:22:33.88,0:22:35.90,Default,,0,0,0,,这里又给大家介绍了一个基本过程
Dialogue: 0,0:22:36.17,0:22:39.10,Default,,0,0,0,,这个是取出某物CDR部分的CAR部分
Dialogue: 0,0:22:39.80,0:22:44.53,Default,,0,0,0,,大家或许会好奇 这些基本过程为什么叫做CAR和CDR
Dialogue: 0,0:22:44.66,0:22:48.42,Default,,0,0,0,,而且传承了下来 尽管叫做LEFT和RIGHT会好一点
Dialogue: 0,0:22:48.76,0:22:50.44,Default,,0,0,0,,我们本可以那样叫的
Dialogue: 0,0:22:51.28,0:22:56.25,Default,,0,0,0,,呃 其实 这个名字来自于很久以前 当发明Lisp时
Dialogue: 0,0:22:56.36,0:23:00.80,Default,,0,0,0,,我想大概是58年的样子 是在类似于704之类的机子上实现的
Dialogue: 0,0:23:00.80,0:23:05.41,Default,,0,0,0,,这个机器有个地址寄存器和减量寄存器
Dialogue: 0,0:23:05.41,0:23:08.17,Default,,0,0,0,,而这些就是地址寄存器和减量寄存器的值
Dialogue: 0,0:23:08.17,0:23:09.37,Default,,0,0,0,,所以这是历史遗留问题
Dialogue: 0,0:23:09.64,0:23:11.28,Default,,0,0,0,,但是这些名字为什么又延续下来了呢?
Dialogue: 0,0:23:11.74,0:23:14.76,Default,,0,0,0,,这是因为Lisp程序员喜欢用电话交流
Dialogue: 0,0:23:15.68,0:23:19.60,Default,,0,0,0,,要是你有一长串的CAR和CDR序列 你就可能说“CDADDEDR”
Dialogue: 0,0:23:21.01,0:23:22.32,Default,,0,0,0,,这是可以理解的
Dialogue: 0,0:23:22.32,0:23:27.02,Default,,0,0,0,,但是左边的右边的右边的左边就不是那么清楚了
Dialogue: 0,0:23:27.60,0:23:30.02,Default,,0,0,0,,这就是我们为什么有这些黑话
Dialogue: 0,0:23:30.54,0:23:34.14,Default,,0,0,0,,典型的Lisp系统 默认定义到第四层
Dialogue: 0,0:23:38.66,0:23:47.05,Default,,0,0,0,,而定义A2为……当然 如果我们考察这些表达式中的一个
Dialogue: 0,0:23:47.36,0:23:52.14,Default,,0,0,0,,比如(+ 3 5)
Dialogue: 0,0:23:52.58,0:24:10.45,Default,,0,0,0,,这个实际上是一个包含有'+、数3和数5的表
Dialogue: 0,0:24:11.72,0:24:15.18,Default,,0,0,0,,表的CAR部分是'+
Dialogue: 0,0:24:16.13,0:24:18.21,Default,,0,0,0,,CDR部分的CAR部分
Dialogue: 0,0:24:18.21,0:24:20.21,Default,,0,0,0,,也就是先取CDR部分 然后再取CAR部分
Dialogue: 0,0:24:20.21,0:24:22.21,Default,,0,0,0,,这就是我如何取得3的 也就是第一个参数
Dialogue: 0,0:24:22.52,0:24:25.69,Default,,0,0,0,,CDR的CDR部分的CAR部分 就是这个……数5
Dialogue: 0,0:24:28.69,0:24:33.66,Default,,0,0,0,,当然类似地 对于乘式我可以这样定义
Dialogue: 0,0:24:35.22,0:24:36.56,Default,,0,0,0,,我快速地演示一下
Dialogue: 0,0:24:48.97,0:24:50.64,Default,,0,0,0,,(DEFINE (PRODUCT? EXP))
Dialogue: 0,0:24:51.05,0:24:54.69,Default,,0,0,0,,如果它不是原子的 而且
Dialogue: 0,0:25:01.41,0:25:14.14,Default,,0,0,0,,EXP的CAR部分与用于表示乘法的符号'*在 EQ?的语义下相等
Dialogue: 0,0:25:15.64,0:25:32.00,Default,,0,0,0,,(DEFINE (MAKE-PRODUCT M1 M2))
Dialogue: 0,0:25:34.42,0:25:39.30,Default,,0,0,0,,(LIST '* M1 M2)
Dialogue: 0,0:25:40.82,0:25:56.81,Default,,0,0,0,,并定义M1为CADR M2为CADDR
Dialogue: 0,0:26:00.09,0:26:02.38,Default,,0,0,0,,当你说行话的时候 你就上道了
Dialogue: 0,0:26:02.53,0:26:05.53,Default,,0,0,0,,你可以取表的CDR 也可以把它们组合起来
Dialogue: 0,0:26:06.29,0:26:10.10,Default,,0,0,0,,现在 我们有了原理上完整的求导程序了
Dialogue: 0,0:26:10.10,0:26:11.70,Default,,0,0,0,,如果需要的话 你也可以添加更多的规则
Dialogue: 0,0:26:12.21,0:26:13.93,Default,,0,0,0,,它又要怎么用呢?
Dialogue: 0,0:26:14.64,0:26:16.77,Default,,0,0,0,,我先把这个笔迹清了
Dialogue: 0,0:26:17.80,0:26:20.82,Default,,0,0,0,,恩 假设我在这里定义FOO为
Dialogue: 0,0:26:22.16,0:26:30.38,Default,,0,0,0,,定义FOO为A*X^2+B*X+C
Dialogue: 0,0:26:30.54,0:26:32.08,Default,,0,0,0,,跟我们这里看到的是一样的
Dialogue: 0,0:26:32.08,0:26:36.36,Default,,0,0,0,,这里是用更习见的记号书写的代数表达式
Dialogue: 0,0:26:37.84,0:26:41.60,Default,,0,0,0,,那么 表达式FOO关于X的导数 结果在这里
Dialogue: 0,0:26:43.46,0:26:45.26,Default,,0,0,0,,真是乱得一团糟
Dialogue: 0,0:26:46.16,0:26:49.22,Default,,0,0,0,,我期望答案是2*A*X+B
Dialogue: 0,0:26:50.68,0:26:53.44,Default,,0,0,0,,虽然与结果等价 但它并不是我们希望的结果
Dialogue: 0,0:26:54.58,0:26:55.22,Default,,0,0,0,,这是什么呢?
Dialogue: 0,0:26:55.97,0:26:59.96,Default,,0,0,0,,我们最初有什么?
Dialogue: 0,0:27:00.50,0:27:04.30,Default,,0,0,0,,我求X*X的导数
Dialogue: 0,0:27:04.69,0:27:10.53,Default,,0,0,0,,答案是X*1+1*X 这当然没错
Dialogue: 0,0:27:12.73,0:27:15.66,Default,,0,0,0,,这就是乘数的导数乘以被乘数加上乘数乘以被乘数的导数
Dialogue: 0,0:27:17.22,0:27:28.37,Default,,0,0,0,,那就是2X、A*2X就是2AX、0X^2省去 再加上0和这里的一大堆0
Dialogue: 0,0:27:28.96,0:27:30.12,Default,,0,0,0,,答案是对的
Dialogue: 0,0:27:30.12,0:27:35.14,Default,,0,0,0,,当我们还需要用户额外检验一下 真是糟糕投了
Dialogue: 0,0:27:35.56,0:27:37.26,Default,,0,0,0,,我们下一节再考虑这个内容
Dialogue: 0,0:27:37.68,0:27:38.61,Default,,0,0,0,,有疑问吗?
Dialogue: 0,0:27:42.77,0:27:43.45,Default,,0,0,0,,请说
Dialogue: 0,0:27:43.89,0:27:46.69,Default,,0,0,0,,观众:写加号时不加引号
Dialogue: 0,0:27:46.69,0:27:50.82,Default,,0,0,0,,是表示引用加那个过程么?
Dialogue: 0,0:27:50.82,0:27:55.42,Default,,0,0,0,,如果有需要的话 是否能在两个过程之间进行比较
Dialogue: 0,0:27:56.16,0:27:57.08,Default,,0,0,0,,教授:问得好!
Dialogue: 0,0:27:57.45,0:28:02.26,Default,,0,0,0,,如果我这里不用左引号将这个引住
Dialogue: 0,0:28:03.88,0:28:07.13,Default,,0,0,0,,如果我这里不用引号
Dialogue: 0,0:28:07.33,0:28:14.20,Default,,0,0,0,,那么这里我就会引用定义好的加法过程
Dialogue: 0,0:28:15.38,0:28:24.88,Default,,0,0,0,,实际上 我可以比较两个过程是否同一
Dialogue: 0,0:28:24.88,0:28:27.45,Default,,0,0,0,,现在很难从语义上解释
Dialogue: 0,0:28:27.85,0:28:29.37,Default,,0,0,0,,我现在不想考虑这个问题
Dialogue: 0,0:28:29.89,0:28:32.40,Default,,0,0,0,,因为我不知道比较过程需要什么
Dialogue: 0,0:28:32.40,0:28:34.40,Default,,0,0,0,,这样做没有意义是有很多原因的
Dialogue: 0,0:28:35.52,0:28:37.53,Default,,0,0,0,,然而 这些符号我们是可以理解的
Dialogue: 0,0:28:38.54,0:28:40.56,Default,,0,0,0,,这也是我为什么我要将它们引住
Dialogue: 0,0:28:41.16,0:28:43.70,Default,,0,0,0,,我想讨论出现在这些代码中的符号
Dialogue: 0,0:28:46.16,0:28:46.92,Default,,0,0,0,,还有什么问题么?
Dialogue: 0,0:28:48.52,0:28:51.86,Default,,0,0,0,,好吧 休息一下 谢谢大家
Dialogue: 0,0:28:55.12,0:29:00.66,Default,,0,0,0,,[音乐]
Dialogue: 0,0:29:00.68,0:29:04.34,Declare,,0,0,0,,{\an2\fad(500,500)}《计算机程序的构造和解释》
Dialogue: 0,0:29:04.34,0:29:06.68,Declare,,0,0,0,,{\an2\fad(500,500)}讲师: 哈罗德·艾伯森教授 及 格兰德·杰·萨斯曼教授
Dialogue: 0,0:29:12.21,0:29:19.17,Declare,,0,0,0,,{\an2\fad(500,500)}《计算机程序的构造和解释》
Dialogue: 0,0:29:20.09,0:29:24.14,Declare,,0,0,0,,{\an2\fad(500,500)}符号化导数系统、引用
Dialogue: 0,0:29:29.86,0:29:30.92,Default,,0,0,0,,教授:好 我们继续
Dialogue: 0,0:29:31.46,0:29:37.76,Default,,0,0,0,,我们编写了一个貌似可行的代数表达式求导程序
Dialogue: 0,0:29:38.20,0:29:41.56,Default,,0,0,0,,这个程序是不完整的 你需要添加一些规则
Dialogue: 0,0:29:42.13,0:29:47.74,Default,,0,0,0,,你可能需要加强这个系统 使得它能够处理
Dialogue: 0,0:29:47.76,0:29:49.70,Default,,0,0,0,,多元加法和多元乘法
Dialogue: 0,0:29:49.89,0:29:51.38,Default,,0,0,0,,这些都相当简单
Dialogue: 0,0:29:52.73,0:29:56.93,Default,,0,0,0,,但这里面也有一些瑕疵
Dialogue: 0,0:29:57.48,0:30:02.37,Default,,0,0,0,,回到这张幻灯片来
Dialogue: 0,0:30:02.94,0:30:08.60,Default,,0,0,0,,我们发现 得到的表达式相当乱
Dialogue: 0,0:30:08.88,0:30:11.01,Default,,0,0,0,,这个表达式非常糟糕
Dialogue: 0,0:30:11.46,0:30:13.10,Default,,0,0,0,,我们是怎么得到这样的表达式的?
Dialogue: 0,0:30:13.84,0:30:15.50,Default,,0,0,0,,为什么是这样呢?
Dialogue: 0,0:30:16.84,0:30:18.74,Default,,0,0,0,,我们详细地分析一下这个表达式
Dialogue: 0,0:30:18.92,0:30:20.76,Default,,0,0,0,,找出这些片段都是出自哪里
Dialogue: 0,0:30:21.69,0:30:24.56,Default,,0,0,0,,如我们所见 这里的和式
Dialogue: 0,0:30:24.56,0:30:26.56,Default,,0,0,0,,也就是上一小节中给你们提到的
Dialogue: 0,0:30:27.12,0:30:29.09,Default,,0,0,0,,(+ (* X 1) (* 1 X))
Dialogue: 0,0:30:29.58,0:30:31.38,Default,,0,0,0,,是这个乘式的导数
Dialogue: 0,0:30:32.52,0:30:36.41,Default,,0,0,0,,也就是A乘上这个的积 这里A不是X的函数
Dialogue: 0,0:30:36.41,0:30:38.41,Default,,0,0,0,,因此A关于X是一个常数
Dialogue: 0,0:30:39.04,0:30:44.53,Default,,0,0,0,,导数为这个和式 从这里到这里 再到这里
Dialogue: 0,0:30:44.80,0:30:48.89,Default,,0,0,0,,因为这个是乘数乘以被乘数的导数
Dialogue: 0,0:30:49.57,0:30:54.45,Default,,0,0,0,,加上被乘数乘以乘数的导数
Dialogue: 0,0:30:54.66,0:30:59.06,Default,,0,0,0,,我们在黑板上的程序告诉我们确实是这样的
Dialogue: 0,0:31:00.65,0:31:05.36,Default,,0,0,0,,当然 这里B乘以X的积
Dialogue: 0,0:31:05.49,0:31:09.81,Default,,0,0,0,,被化成了 B*1+0*X
Dialogue: 0,0:31:10.81,0:31:16.06,Default,,0,0,0,,因为B不是X的函数
Dialogue: 0,0:31:16.46,0:31:18.56,Default,,0,0,0,,因此B的导数为0
Dialogue: 0,0:31:18.77,0:31:21.48,Default,,0,0,0,,而X对自己求导则为1
Dialogue: 0,0:31:23.06,0:31:28.64,Default,,0,0,0,,这里的加法化成了 这两个导数的和
Dialogue: 0,0:31:29.37,0:31:33.50,Default,,0,0,0,,所以这里 我想告诉你和之前一样的东西
Dialogue: 0,0:31:33.66,0:31:35.89,Default,,0,0,0,,也就是在讲斐波那契数那时候
Dialogue: 0,0:31:37.77,0:31:39.49,Default,,0,0,0,,所谓的 “过程的形状”
Dialogue: 0,0:31:41.38,0:31:46.44,Default,,0,0,0,,就是通过局部的规则向低层次展开
Dialogue: 0,0:31:48.05,0:31:52.57,Default,,0,0,0,,也就是过程代表了一系列用于演进过程局部规则
Dialogue: 0,0:31:53.36,0:32:00.09,Default,,0,0,0,,这里 过程还遗留了一些东西--也就是答案
Dialogue: 0,0:32:00.25,0:32:06.26,Default,,0,0,0,,这是通过遍历表达式的树结构构造出来的
Dialogue: 0,0:32:08.41,0:32:12.61,Default,,0,0,0,,答案中的每个部分对应问题中的某个部分
Dialogue: 0,0:32:14.46,0:32:17.78,Default,,0,0,0,,比如说 现在我们考察FOO的导数
Dialogue: 0,0:32:17.78,0:32:19.65,Default,,0,0,0,,也就是AX^2+BX+C
Dialogue: 0,0:32:19.84,0:32:23.05,Default,,0,0,0,,并另令自变量 比如像这里
Dialogue: 0,0:32:24.14,0:32:27.48,Default,,0,0,0,,我们令A为自变量 求FOO的导数
Dialogue: 0,0:32:28.10,0:32:31.77,Default,,0,0,0,,这都非常相似 实际上 它们是同样的代数表达式
Dialogue: 0,0:32:32.45,0:32:35.24,Default,,0,0,0,,只是它们之中0和1的位置不一样罢了
Dialogue: 0,0:32:36.06,0:32:38.60,Default,,0,0,0,,这是因为在这个树结构的遍历中
Dialogue: 0,0:32:38.97,0:32:43.85,Default,,0,0,0,,只可能是CONSTANT?和SAME-VAR?会因变量的不同
Dialogue: 0,0:32:44.28,0:32:45.81,Default,,0,0,0,,而造成不同结果
Dialogue: 0,0:32:48.26,0:32:52.09,Default,,0,0,0,,回到黑板上来再看看
Dialogue: 0,0:32:52.65,0:32:57.49,Default,,0,0,0,,我们在求和式或乘式的导数时根本没有发挥的余地
Dialogue: 0,0:32:58.08,0:33:04.48,Default,,0,0,0,,真正可以做文章的地方 则是表达式和自变量
Dialogue: 0,0:33:04.80,0:33:10.10,Default,,0,0,0,,以及对于那些短小的表达式 是否为关于自变量的常量
Dialogue: 0,0:33:10.36,0:33:12.41,Default,,0,0,0,,就是这些地方导致了不同的0和1的产生
Dialogue: 0,0:33:12.69,0:33:14.49,Default,,0,0,0,,回过头来看这张幻灯
Dialogue: 0,0:33:15.12,0:33:18.16,Default,,0,0,0,,这里就出现了“0”
Dialogue: 0,0:33:18.37,0:33:22.74,Default,,0,0,0,,这里是求FOO(A)的导数时得到的“1”
Dialogue: 0,0:33:22.96,0:33:24.86,Default,,0,0,0,,我们得到了X^2
Dialogue: 0,0:33:24.96,0:33:32.53,Default,,0,0,0,,这个1是X*X关于X的导数 关于B求导时1变成了0
Dialogue: 0,0:33:32.64,0:33:34.89,Default,,0,0,0,,这里 我们求FOO关于C的导数
Dialogue: 0,0:33:36.78,0:33:39.30,Default,,0,0,0,,但是这些表达式的轮廓是一致的
Dialogue: 0,0:33:40.54,0:33:43.96,Default,,0,0,0,,看看这些轮廓 都是相同的
Dialogue: 0,0:33:50.37,0:33:52.28,Default,,0,0,0,,那么 难道是我们的规则出了问题?
Dialogue: 0,0:33:53.58,0:33:55.02,Default,,0,0,0,,不 这些规则都对
Dialogue: 0,0:33:56.12,0:33:57.77,Default,,0,0,0,,我们曾经遇到过这种问题
Dialogue: 0,0:33:58.06,0:34:03.53,Default,,0,0,0,,你将会发现 这其中缺乏一些非常好的思想
Dialogue: 0,0:34:06.32,0:34:09.74,Default,,0,0,0,,昨天 我们在考察有理数时
Dialogue: 0,0:34:12.12,0:34:14.48,Default,,0,0,0,,想要得到3/4却得到6/8
Dialogue: 0,0:34:14.97,0:34:16.49,Default,,0,0,0,,答案没有化简
Dialogue: 0,0:34:18.09,0:34:20.90,Default,,0,0,0,,当然 当下的问题也非常类似
Dialogue: 0,0:34:21.18,0:34:25.41,Default,,0,0,0,,我想把不相同的表达式通过化简来使相同
Dialogue: 0,0:34:27.57,0:34:31.89,Default,,0,0,0,,当然 有理数加法和乘法的规则依然正确
Dialogue: 0,0:34:33.97,0:34:37.41,Default,,0,0,0,,因此这里 我们依葫芦画瓢
Dialogue: 0,0:34:37.78,0:34:39.89,Default,,0,0,0,,上次能行的办法 这次也没问题
Dialogue: 0,0:34:40.53,0:34:42.05,Default,,0,0,0,,也就是改换一下它的表示
Dialogue: 0,0:34:43.13,0:34:46.44,Default,,0,0,0,,或许在将其表示出来时我们可以进行
Dialogue: 0,0:34:47.88,0:34:49.78,Default,,0,0,0,,一步产生简化表示的步骤
Dialogue: 0,0:34:50.17,0:34:51.73,Default,,0,0,0,,当然啦 这也不是万用万灵
Dialogue: 0,0:34:52.49,0:34:54.14,Default,,0,0,0,,我也不想证明它是万能的
Dialogue: 0,0:34:55.12,0:35:00.44,Default,,0,0,0,,但这也是控制复杂度的一招妙计
Dialogue: 0,0:35:01.46,0:35:03.85,Default,,0,0,0,,我们小心翼翼地解决这些问题
Dialogue: 0,0:35:04.30,0:35:07.20,Default,,0,0,0,,我们所做的 就是把问题划分为几个部分
Dialogue: 0,0:35:07.57,0:35:08.73,Default,,0,0,0,,分别是求导规则
Dialogue: 0,0:35:11.32,0:35:15.80,Default,,0,0,0,,和在这种层面上的一般代数规则
Dialogue: 0,0:35:16.38,0:35:21.22,Default,,0,0,0,,然后就有一道抽象屏障
Dialogue: 0,0:35:22.48,0:35:33.49,Default,,0,0,0,,这里是代数表达式的表示--表结构
Dialogue: 0,0:35:37.33,0:35:42.56,Default,,0,0,0,,在这道屏障中 我定义了接口过程
Dialogue: 0,0:35:43.25,0:35:49.82,Default,,0,0,0,,比如 CONSTANT? SAME-VAR?
Dialogue: 0,0:35:54.60,0:35:58.72,Default,,0,0,0,,又比如 SUM? MAKE-SUM
Dialogue: 0,0:36:02.22,0:36:05.57,Default,,0,0,0,,还有 A1 A2
Dialogue: 0,0:36:06.60,0:36:08.58,Default,,0,0,0,,还有 PRODUCT? 之类的东西
Dialogue: 0,0:36:08.74,0:36:11.90,Default,,0,0,0,,我所需要的、针对各式代数表达式的东西
Dialogue: 0,0:36:12.94,0:36:19.14,Default,,0,0,0,,构筑这些屏障我可以随意地改换表示法
Dialogue: 0,0:36:20.14,0:36:23.20,Default,,0,0,0,,而不用改变在某种表示法下编写的规则
Dialogue: 0,0:36:25.04,0:36:29.08,Default,,0,0,0,,如果我能通过改变表示法来解决问题
Dialogue: 0,0:36:30.38,0:36:34.52,Default,,0,0,0,,那么把问题分解为两个部分则帮了我大忙
Dialogue: 0,0:36:35.65,0:36:37.54,Default,,0,0,0,,好吧 举一个非常简单的例子
Dialogue: 0,0:36:38.82,0:36:40.08,Default,,0,0,0,,我们的问题是什么?
Dialogue: 0,0:36:40.26,0:36:43.61,Default,,0,0,0,,回到这张幻灯片来
Dialogue: 0,0:36:44.50,0:36:47.34,Default,,0,0,0,,看这里 哦 这相当糟糕
Dialogue: 0,0:36:47.62,0:36:51.86,Default,,0,0,0,,这里是一个表达式与“0”的和
Dialogue: 0,0:36:53.14,0:36:56.66,Default,,0,0,0,,毋庸置疑这应该是该表达式本身
Dialogue: 0,0:36:57.21,0:37:01.90,Default,,0,0,0,,为什么这里还会有加号?
Dialogue: 0,0:37:03.38,0:37:04.57,Default,,0,0,0,,这其实可以更智能点
Dialogue: 0,0:37:05.56,0:37:10.08,Default,,0,0,0,,又比如说这里 是某表达式与“1”的积
Dialogue: 0,0:37:11.16,0:37:12.29,Default,,0,0,0,,这和之前一个道理
Dialogue: 0,0:37:12.86,0:37:15.68,Default,,0,0,0,,又像这里 与“0”相乘显然是“0”
Dialogue: 0,0:37:17.86,0:37:19.52,Default,,0,0,0,,因此我们也不用去构造这些式子了
Dialogue: 0,0:37:21.44,0:37:22.62,Default,,0,0,0,,我们为什么不这么做呢?
Dialogue: 0,0:37:23.66,0:37:27.96,Default,,0,0,0,,我们需要去修改表示法 基本上就是那里了
Dialogue: 0,0:37:37.40,0:37:41.84,Default,,0,0,0,,定义 MAKE-SUM 为
Dialogue: 0,0:37:42.05,0:37:43.76,Default,,0,0,0,,呃 现在就不是那么简单了
Dialogue: 0,0:37:44.00,0:37:50.40,Default,,0,0,0,,除非是有必要 否则我不会简单地把加号和式子组合成表
Dialogue: 0,0:37:51.72,0:37:53.05,Default,,0,0,0,,那么 还有哪些可能呢?
Dialogue: 0,0:37:54.56,0:37:58.53,Default,,0,0,0,,如果……这里有一些可能的情况
Dialogue: 0,0:37:59.38,0:38:08.20,Default,,0,0,0,,如果都是数值的话 如果A1是数值的话
Dialogue: 0,0:38:09.05,0:38:10.93,Default,,0,0,0,,这个基本过程我刚刚提到过
Dialogue: 0,0:38:10.93,0:38:13.18,Default,,0,0,0,,也就是用来检测参数是否为数值
Dialogue: 0,0:38:15.38,0:38:23.82,Default,,0,0,0,,并且A2也是数值的话 也就是A2不是符号表达式
Dialogue: 0,0:38:24.45,0:38:26.20,Default,,0,0,0,,那么我们就直接把它们加起来
Dialogue: 0,0:38:26.45,0:38:29.92,Default,,0,0,0,,结果就是A1加上A2的和
Dialogue: 0,0:38:32.32,0:38:33.98,Default,,0,0,0,,我并不是检查它们代表数值
Dialogue: 0,0:38:33.98,0:38:35.98,Default,,0,0,0,,这里所有的符号都代表数值
Dialogue: 0,0:38:37.33,0:38:41.22,Default,,0,0,0,,就比如 我想要考察的是这个东西是否为数值3
Dialogue: 0,0:38:43.40,0:38:44.40,Default,,0,0,0,,另一种情况
Dialogue: 0,0:38:48.77,0:38:59.61,Default,,0,0,0,,假设A1是数值 并且为0
Dialogue: 0,0:39:04.20,0:39:06.38,Default,,0,0,0,,那么答案就是A2
Dialogue: 0,0:39:06.93,0:39:08.68,Default,,0,0,0,,不用再构造什么
Dialogue: 0,0:39:10.98,0:39:23.41,Default,,0,0,0,,如果A2是数值 并且为0
Dialogue: 0,0:39:27.16,0:39:28.90,Default,,0,0,0,,那么答案就是A1
Dialogue: 0,0:39:30.04,0:39:33.65,Default,,0,0,0,,如果没有比这些更好的情况
Dialogue: 0,0:39:34.13,0:39:35.61,Default,,0,0,0,,我就需要构造一个表
Dialogue: 0,0:39:37.86,0:39:42.86,Default,,0,0,0,,构造一个用于表示答案的表
Dialogue: 0,0:39:44.13,0:39:52.33,Default,,0,0,0,,其中有 '+、A1和A2
Dialogue: 0,0:39:58.66,0:40:01.65,Default,,0,0,0,,当然 积的导数也可以类比此法
Dialogue: 0,0:40:03.01,0:40:05.04,Default,,0,0,0,,这里 我就不细讲了
Dialogue: 0,0:40:05.44,0:40:07.24,Default,,0,0,0,,我就直接在黑板上写出结果
Dialogue: 0,0:40:07.65,0:40:09.80,Default,,0,0,0,,这并不是很重要 你们已经了解它的思想了
Dialogue: 0,0:40:10.76,0:40:11.61,Default,,0,0,0,,非常简明
Dialogue: 0,0:40:12.86,0:40:19.89,Default,,0,0,0,,现在 我们来看看用这种方式改造程序后 效果如何
Dialogue: 0,0:40:21.68,0:40:27.88,Default,,0,0,0,,哦 这是修改表达式构造函数后的求导结果
Dialogue: 0,0:40:28.98,0:40:32.21,Default,,0,0,0,,对同样地FOO求导:AX^2+BX+C
Dialogue: 0,0:40:33.28,0:40:40.70,Default,,0,0,0,,我得到了 2AX+B
Dialogue: 0,0:40:40.70,0:40:42.10,Default,,0,0,0,,虽然它并没有化到最简
Dialogue: 0,0:40:42.60,0:40:44.53,Default,,0,0,0,,我应该合并同类项和求和
Dialogue: 0,0:40:45.06,0:40:46.08,Default,,0,0,0,,但这又是另外一回事了
Dialogue: 0,0:40:47.12,0:40:51.86,Default,,0,0,0,,当然啦 完成这个功能的代码就大而复杂了
Dialogue: 0,0:40:52.28,0:40:55.28,Default,,0,0,0,,代数化简 是一项繁复的工作
Dialogue: 0,0:40:56.37,0:41:00.13,Default,,0,0,0,,你们可能听过MIT以前开发的一个非常出名的程序 MAXIMA
Dialogue: 0,0:41:00.42,0:41:03.14,Default,,0,0,0,,它有5000页的LISP代码
Dialogue: 0,0:41:03.92,0:41:06.50,Default,,0,0,0,,大部分是代数化简的操作
Dialogue: 0,0:41:08.08,0:41:12.21,Default,,0,0,0,,这里是FOO的导数
Dialogue: 0,0:41:12.21,0:41:16.86,Default,,0,0,0,,要是我的话 我会在初等微积分课上讲讲“改换主变量”这个东西
Dialogue: 0,0:41:18.38,0:41:22.49,Default,,0,0,0,,以A为自变量 FOO的导数则是X*X
Dialogue: 0,0:41:22.80,0:41:23.80,Default,,0,0,0,,看起来还不差
Dialogue: 0,0:41:24.74,0:41:27.53,Default,,0,0,0,,以B为自变量 FOO的导数则是X本身
Dialogue: 0,0:41:28.06,0:41:30.12,Default,,0,0,0,,以C为自变量 FOO的导数则为“1”
Dialogue: 0,0:41:30.70,0:41:32.04,Default,,0,0,0,,我对这些结果很满意
Dialogue: 0,0:41:34.10,0:41:39.01,Default,,0,0,0,,你所看到的 都是精心设计、仔细规划的例子
Dialogue: 0,0:41:39.56,0:41:42.60,Default,,0,0,0,,用以展示如何操作代数表达式
Dialogue: 0,0:41:42.96,0:41:47.93,Default,,0,0,0,,我们如何不用具体的语法 而用抽象的语法抽象地进行
Dialogue: 0,0:41:49.21,0:41:56.29,Default,,0,0,0,,以及我们如何使用抽象屏障控制构造这些表达式
Dialogue: 0,0:41:57.80,0:42:00.41,Default,,0,0,0,,真正的奥义并不是如此的简单
Dialogue: 0,0:42:01.00,0:42:04.45,Default,,0,0,0,,实际上 真正的奥义在于我在操作这些表达式时
Dialogue: 0,0:42:04.45,0:42:06.72,Default,,0,0,0,,代数表达式和代码表达式--
Dialogue: 0,0:42:06.72,0:42:07.97,Default,,0,0,0,,回过头来看看幻灯片
Dialogue: 0,0:42:08.08,0:42:10.52,Default,,0,0,0,,都是同一种Lisp表达式
Dialogue: 0,0:42:12.02,0:42:12.97,Default,,0,0,0,,这样一语双关 一石二鸟
Dialogue: 0,0:42:13.82,0:42:21.49,Default,,0,0,0,,我用表示代码相同的方法来作为我的表示法
Dialogue: 0,0:42:22.89,0:42:26.52,Default,,0,0,0,,为了要这样做 我得付出点代价
Dialogue: 0,0:42:26.90,0:42:30.34,Default,,0,0,0,,我需要使用类似于“引用”的东西
Dialogue: 0,0:42:30.97,0:42:38.17,Default,,0,0,0,,这是因为 我的语言可以编写讨论语言表达式的表达式
Dialogue: 0,0:42:39.76,0:42:43.22,Default,,0,0,0,,我需要有某种东西指出 这个是我需要讨论的表达式
Dialogue: 0,0:42:43.76,0:42:46.13,Default,,0,0,0,,而不是说 (去求)这个表达式的值
Dialogue: 0,0:42:47.20,0:42:48.44,Default,,0,0,0,,我想要的是前者
Dialogue: 0,0:42:51.34,0:42:55.36,Default,,0,0,0,,引用阻止表达式被求值 其语义为“就是表达式本身”
Dialogue: 0,0:42:57.97,0:43:00.85,Default,,0,0,0,,有了这种能力以后
Dialogue: 0,0:43:01.58,0:43:03.82,Default,,0,0,0,,如果我可以操作语言的表达式
Dialogue: 0,0:43:04.80,0:43:09.00,Default,,0,0,0,,我可以在语言层之上构建更加有力的层次
Dialogue: 0,0:43:09.77,0:43:12.64,Default,,0,0,0,,因为我可以编写不仅仅是内嵌于Lisp的语言
Dialogue: 0,0:43:13.46,0:43:14.80,Default,,0,0,0,,或者是其它的语言
Dialogue: 0,0:43:15.26,0:43:17.76,Default,,0,0,0,,我可以编写一种完全不同的语言
Dialogue: 0,0:43:18.58,0:43:22.24,Default,,0,0,0,,而其实质上则是被Lisp或其它语言所解释
Dialogue: 0,0:43:23.17,0:43:25.46,Default,,0,0,0,,我们以后还会对此有更深入的理解
Dialogue: 0,0:43:26.56,0:43:32.09,Default,,0,0,0,,我现在只是想让你们意识到
Dialogue: 0,0:43:32.36,0:43:34.98,Default,,0,0,0,,我们已经感触到了一种惊人的力量
Dialogue: 0,0:43:36.00,0:43:37.82,Default,,0,0,0,,现在我们有了方天画戟
Dialogue: 0,0:43:38.17,0:43:40.92,Default,,0,0,0,,当我们使用它时 也得万分小心
Dialogue: 0,0:43:42.17,0:43:43.00,Default,,0,0,0,,谢谢大家
Dialogue: 0,0:43:44.10,0:44:00.54,Declare,,0,0,0,,{\fad(500,500)}MIT OpenCourseWare\Nhttp://ocw.mit.edu
Dialogue: 0,0:43:44.10,0:44:00.54,Declare,,0,0,0,,{\an2\fad(500,500)}本项目主页\Nhttps://github.com/DeathKing/Learning-SICP
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Ruby
1
https://gitee.com/jacklisp/Learning-SICP.git
git@gitee.com:jacklisp/Learning-SICP.git
jacklisp
Learning-SICP
Learning-SICP
master

搜索帮助