So let me write that down, it's how much memory do I need to complete a computation.
让我把它写下来,当我计算的时候。
It's called Bio-Medical Computation.
叫做生物医学计算。
It's going to let us bury away the specifics of something, and treat that computation like a black box. And by black box, I mean, literally behaves like a mysterious little black box.
通过抽象我们可以将一些细节,掩埋起来并将这一段计算当成黑盒,说到黑盒我的意思就是,字面上的像一个神秘的小黑盒。
Then, there's a lot of computation going on to figure out what's the right answer.
将进行大量计算,以找到正确答案。
The mind reflects the workings of the brain just like computation reflects the working of a computer.
心理反映了大脑的活动,就像运算结果反映了计算机的运行一样
The body of that function looks exactly like the computation up above, except I'm simply using those in place of the specific message I had before.
方法体内部看起来,很像上面的计算过程,除了我用这些来替代了,原来的那些特殊信息。
And as long as that smaller computation reduces to another smaller computation, eventually I ought to get to the place where I'm down in that base case.
如果我不属于基础事件,那么我需要把它简化为更简单的计算,随着计算的不断简化,最终我能分解成基础事件。
We'll see later on, there are classes of computation that are inherently much more complex. We hate them, because they're costly, but they're sometimes inherently that way.
我们会稍后详细的讲讲这个,有许多内在更加复杂的种类的算法,我们痛恨它们,因为它们很耗时。
I can use that to return values, which I can then use elsewhere, which I did-- and if I just come back and highlight this-- inside of that computation.
我可以用它来返回值,然后我可以在别的地方使用这些返回值,正是我做的--如果我回过头来,在高亮一下这个--在这部分计算内部。
All right? If you run it, you have a sense of the upper bound, about how much time it's going to take to do this computation, so you're not going to get surprised by something showing up.
第一,这样做意味着没有意外了对不对?,你去运行程序,你已经大致知道运行时间的上限了,因此发生任何事情,你都不会吃惊了。
I can check it, so if this was part of some other computation, I want to know, did it find a perfect square or not?
我可以检验它,因此如果这是其它计算的一部分我想知道,它能否找到一个完全平方根呢?
And that leads to a lot of redundant computation.
这就导致了累赘计算。
Let me write a function, in fact the literal thing I would do is to say, identify the things that change, give each of them a variable name because I want to refer to them, and then write a function that captures the rest of that computation just with those variable names inside.
让我来写个方法,实际上我的意思是,辨别出变化的东西,然后给它们逐个命名以区分,然后写一个用来计算,这些变量的,包括计算过程的方法。
And that's what they would do: they would do that specific computation.
那就是它们能做的事儿:,它们能做那个特定的运算。
It should be the notion of, "What does it mean to do computation?"
这应该是这么一个概念:,“进行计算是什么意思呢?“
All right. That's what computation basically is about.
好了,这基本上就是关于计算相关的东西。
And I unwrap the computation to get back.
最后我便可以打开计算返回最初嵌套了。
I've captured it as a computation.
我把它到做计算来用。
This was one of the very first recorded bugs in the history of computation.
在关于计算的历史上,有一个最早记录的bug,如果你们。
The notion of recipes, the notion of computation, why you want to do this, what you're going to learn.
秘诀和计算的一些概念啊,以及我们为什么要学这些知识,和要学习的具体内容。
Reconfigure itself, emulate it, however you want to use the words, it's going to change how it does the computation.
重新配置它自己,模仿它,但是你想用一些文字,这就会改变它运算的方式。
And by that, I mean, not how much memory do I need to store the size of the input, it's really how much internal memory do I use up as I go through the computation?
需要占用多少内存,我意思并不是,存储输入需要多少内存,而是当我完成这个?
And I'll also remind you, and we're going to see this in the next example, we talked about looking at the worst case behavior. In these cases there's no best case worst case, it's just doing one computation.
我还要提醒大家的就是,我们也会在下一个例子里发现者一点,我们谈到了要去考虑最坏的情况,在下面这些例子里,没有好情况坏情况之分,就只是一次运算。
So even within this framework of, given a description of a computation as a set of steps, in the idea that I could build a circuit to do it, let me suggest for you what would be a wonderful circuit to build.
所以即使需要在将计算描述,当成一系列步骤中的一步,这个框架之内,我也完全可以建立一个线路,来完成那个想法,让我为你们假设能建造起,一个多么棒的线路吧。
OK, in a few minutes we're going to start talking then about what is computation, how are we going to start building those tools, but that's what you should take away, that's what you're going to gain out of this course by the time you're done.
好啦,我们会花一点儿时间,谈谈什么是计算,我们如何去建造这些工具,但是这些是你应该,在离开这个课堂时,应该学会的事儿。
But we think it's really important for the department to help everybody learn about computation, and that's what this course is about.
但是我们觉得让系里来帮助学生们,学习有关计算的知识是很重要的,这也是这门课所要传授给你们的内容。
And so what I see is that as I run this, I'm doing a lot of redundant computation.
因此我在这里,看到的是随着我的运行,我将会进行很多冗余的计算。
The other obvious one to do would be worst case. Again, over all possible inputs to this function, what's the most number of steps it takes to do the computation?
很明显另一种就是针对最坏的情况了,也就是在所有可能的输入,里面选出用的,步骤最多的那个输入?
It's the same computation. But this is a nice way of writing it, often called defensive programming.
这跟原来的计算过程没什么不同,但这是写代码的更优秀的一种方式。
应用推荐