Right, having done that, we can certainly get to more complicated things, so for example, suppose I look at that expression.
好,说完了这一点,我们就可以讲些复杂些的话题了,例如,假设我看到了这个表达式。
And here, too, it's just a little baby program in that I'm hardcoding the expression 17 divided by 13.
然后这里,这只是一个子程序,在那里面我硬编码了表达式“17除以13“
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.
正如字面意义上说的,从这个函数返回,然后取得下一个表达式的值,并把这个值作为整个计算的结果返回。
It's really amazing that what Newton did in the case of gravity was to find the expression for this.
这一点非常神奇,牛顿在引力方面的研究,只是为了找出这个的表达式
So what we're going to do is set these two things equal to each other, put in stars here.
我们只需要令这两个表达式相等,在这里标注上*号
It's a very important point, if you see the very simple math that I'm showing up here.
这一点要特别注意,看看这个简单的数学表达式。
I can substitute dq from this expression in here.
代入这个表达式的这里。
And now, if I'm touching mouse pointer, we saw that Boolean expression before, play sound meow, wait a couple of seconds, and then just keep checking.
现在,如果我们碰下鼠标指针,起初我们看到一个布尔表达式,播放猫叫的声音,等几秒钟,然后如刚才那样做检测。
And this puzzle piece here colored in blue because it's a Boolean expression is just something that--whose answer is either a yes or no, 0 true or false, one or zero.
这个拼图染成蓝色,因为它是布尔表达式,它的结果只可能是肯定或否定,对或错,1或者。
which I just did there, -mystring in fact, let me type it in-- mystring, with an equal sign, which is saying, assign or bind to that name the value of the following expression.
也就是这里我做的,实际上,让我输入,然后是个蹬好,意思就是说,把这个名字绑定到,后面表达式的值上去。
That code says the following: the IF says, I've got an expression, I'm going to evaluate it.
代码的含义是这样的:,我有一个表达式,我会去对这个表达式求值。
And so, in fact, if I wanted the other version of it, in fact, if I do this right, 23 it's going to give me 23 because it does the multiplication first, if I wanted the other version of it, Python I need to tell it that, by using, excuse me, parentheses.
因此,实际上,如果我想换种做法,实际上,如果我去执行这个表达式,返回值是3,因为乘法会被优先执行,如果我需要换种做法,我需要告诉,用括号来告诉它。
So, Newton did not ever tell you what the expression for force is in a given context.
牛顿从来也没有告诉过你,在这种情况下力的表达式
I want you not to memorize every formula the book gives you for this problem.
我希望你们不要机械性地记忆,书上所给的这个问题的表达式
Now, you've already seen how entropy depends on temperature.
如何来求熵的表达式,现在你已经知道熵对温度的依赖关系。
We can start having complex expressions, you can imagine we can have things are lots of parens, and all sorts of things in it. Yes, question.
我们可以开始写复杂点的表达式了,你可以想象,我们有一个很多括号的表达式,里面有各种各样的东西,什么问题。
I know you'd like to give me other things, other expression, somebody give me a number.
表达式什么的,谁给我一个数字?,没有么?谢谢!很不错的数字。
What I'm doing, by the way, here is I'm simply typing in expressions to that interpreter.
顺路说一下,我正在做的就是给计算器传入,一个表达式。
What do you think should happen if I evaluate that expression?
你认为我对表达式求值的话,会发生什么?
The answer was, find a mathematical expression depending on the number of inputs.
很不错,答案是,找到一个通过输入数字,计算出来的数字表达式。
What I'm going to do here is I'm going to substitute in for prices.
接下来我要用表达式来替换价格
If you have not seen the calculus that I'm about to use on the board, or more likely, if you've forgotten it since high school, don't panic.
如果你们没有见过我将要,在板书上写的表达式,或者说,高中毕业你们就忘了,没关系
So, for example, there's an expression.
那么,例如,这里有个表达式。
Well, there's a formula that's been used by bond traders for hundreds of years and it's a traditional expression, which goes from the discount rate to the price.
这里有个债券交易商,用了上百年的公式,这是个传统表达式,它能用折扣率算得价格
And I'm going to rewrite it now with that P expanded out.
我把它代入到这个表达式然后展开
What I have now is the following: I can write expressions, do combinations of things to get out values, I can store them away, I can print them up.
我已经讲过如下内容:,如何写表达式,如果把东西混合然后得到结果值,我可以将其保存,也可以将其显示。
x It says, take the name x and create a binding for that name to the value of the sub-expression and in fact to do this, to stress a point, let's do that.
它的意思是,创建了一个名字,然后创建了对于这个名字,和子表达式的值的绑定,实际上这么做,我们是为了,要强调一个点,让我们来说说这个点。
I just want to remind you, if I wanted to, for example, type in an expression like that, notice the syntactical form, it's an expression, a number, followed by an operand, followed by another expression.
我想要提醒下大家,如果你想要,例如,输入一个这样的表达式,注意语法形式,这是个表达式,一个数字,后面是一个运算对象,后面是另外一个表达式。
In there, I want to make this distinction, this nuance: the evaluator is still going to be taking those expressions and using its rules to get a value, but it's not going to print them back out.
在这里,我想要做这么一个,细微差别:运算器依然会,对表达式,进行求值,但是不会,显示结果值。
Scratch This Boolean expression allows you to say to scratch if you are touching the mouse pointer, the little arrow, do something. How do we do something?
布尔表达式允许你告诉,当你触碰到鼠标指针,也就是小箭头,程序就相应地做一些事情?
应用推荐