So let me write that down, it's how much memory do I need to complete a computation.
让我把它写下来,当我计算的时候。
It's called Bio-Medical Computation.
叫做生物医学计算。
Literally, return the control from this function, and take the value of the next expression, and return that as the value of the whole computation.
正如字面意义上说的,从这个函数返回,然后取得下一个表达式的值,并把这个值作为整个计算的结果返回。
Then, there's a lot of computation going on to figure out what's the right answer.
将进行大量计算,以找到正确答案。
I only give, I don't know, about 10% or 20% for getting the right number in a computation. I tell my graders, if the student demonstrates minimal acceptable proficiency that student has to get a passing score.
我只是给,我不知道,10%或者20%的随机概率得到合适的数字,我告诉我的学生们,如果有人想证明,最小可接受的熟练,就是学生们得到一个及格的分数。
For all students, what we want to do is we want to give you an understanding of the role computation can and cannot play in tackling technical problems.
对所有学生来讲,我们想做的就是,给你们关于计算在能否解决技术问题中,所扮演角色的,认识。
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.
通过抽象我们可以将一些细节,掩埋起来并将这一段计算当成黑盒,说到黑盒我的意思就是,字面上的像一个神秘的小黑盒。
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?
我可以检验它,因此如果这是其它计算的一部分我想知道,它能否找到一个完全平方根呢?
The real issue is to figure out how to build constructs out of this that tackle particular problems, but the fundamental basics of computation are just captured in that set of mechanisms.
坏消息是当然这不是真的,真正的问题是怎么来,构建解决特定的问题的这些结构,但是运算的最基本的东西,仅仅体现在机制集里。
One of the things we want to help you do is identify the different classes of algorithms, what their costs are, and how you can map problems into the most efficient class to do the computation.
我们想要教会你们的事情之一就是,学会辨别不同种类的算法,它们的代价是怎么样的,以及怎么样把问题映射到,最有效的算法种类中去做计算。
it's looking first to see am I in the base case, which I'm done. If I'm not I'm just going to reduce this to a smaller computation.
注意这个计算是干什么的,它先判断我是否属于基础事件,这个我已经做过了。
Second thing we saw is, that using this as a computation, I can return multiple values.
我们看到的第二件事是把它用作计算,我可以返回多个值。
OK. Today, for the rest of the lecture, we're going to take a break from the topic of algorithms, and computation, and things of the sort. And do something pretty pragmatic.
好,今天剩下的时间里,我们不再讲算法,计算和排序这些话题了,我们会做一些非常实用的事,我们主要的讲讲测试。
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.
最后我便可以打开计算返回最初嵌套了。
And here's the basis of the computation.
这就是计算的基础。
I've captured it as a computation.
我把它到做计算来用。
Second thing we've got to worry about is, what's a basic step? All right, if I bury a whole lot of computation inside of something, I can say, wow, this program, you know, runs in one step. Unfortunately, that one step calls the Oracle at Delphi and gets an answer back. Maybe not quite what you want.
我们需要担心的第二件事情就是,什么该作为一个基本的步骤呢?,如果我把一大堆的计算过程放到里面,我可以说,噢,这个程序你知道的,一步就完成了,不幸的是,这一步可能要靠预言家才能得到答案,这可能跟你想要的结果不太相同吧。
What we're saying is, in order to do computation, we want to describe recipes, we want to describe this sequence of steps built on some primitives, and we want to describe the flow of control that goes through those sequence of steps as we carry on So the last thing we need before we can start talking about real programming is, we need to describe those recipes.
我们在说,为了做计算,我们想描述一个方法,想描述建立在,相同基本类型上的步骤序列,而且我们想描述经过我们设计的,步骤的序列的,控制流程,因此我们开始谈论真正的编程之前,的最后一件事是,我们需要描述一下那些方法。
Because in doing that, Python would then have a value that it could pass on into some other part of a computation, and if it wasn't what I wanted, I might be a long ways downstream in the computation before I actually hit some result that makes no sense.
因为如果这样做的话,Python会将,输入的值传递到下面的,一些运算中去,如果这个值的类型不是我想要的,我可能会在得到,一个毫无意义的结果之前,经历一个很长时间的,计算过程。
This was one of the very first recorded bugs in the history of computation.
在关于计算的历史上,有一个最早记录的bug,如果你们。
应用推荐