What lambda that does, it creates on the fly a function, as the program runs. That I can then pass around.
这里的入是在函数运行的时候,由一个函数创建的,然后我会传递这个值。
By putting it in a function bug if I find a bug and I change my program I can just run the function again.
把我输入的值放到一个函数里,如果以后我在程序中发现了一个,并对程序进行更改的话,我可以直接。
So, for example, if we were looking at the actual wave function, we would say that these parts here have a positive amplitude, and in here we have a negative amplitude.
我们看,一个波函数,我们说,它这部分幅值,为正,这部分幅值为负,当我们看。
Delta u, delta H, familiar state functions, q w changes in their values, q, w, heat and work.
U,△H,很熟悉的态函数,它们的值在变化;
It's totally legit to cull a function, get back a value, do nothing with it other than compare it to another value.
挑选一个函数是完全合法的,返回一个值,用它来做些事情而不是用它与其它的值比较。
I'm using the fact that when you take a cosine and change the angle inside the cosine, it doesn't care. whereas, if you go to the sine and change the angle inside the sine, it becomes minus sine.
我用了一个结论,当你使用余弦函数时,改变角度的正负,函数值不变,而对于正弦函数,改变角度的符号,则函数值也会变号
R is a function of n and takes on discrete values.
在这儿r是n的函数,取的是不连续的值。
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.
正如字面意义上说的,从这个函数返回,然后取得下一个表达式的值,并把这个值作为整个计算的结果返回。
OK, so, the thing about a state function is that the function has a value for initial conditions and at final conditions.
态函数的特点是,在初始状态有一个值,在末状态也有一个值。
No matter where you specify your electron is in terms of those two angles, it doesn't matter the angular part of your wave function is going to be the same.
不论你将,这两个角度,取成什么值,波函数的角向部分,都是,相同的。
PROFESSOR: And so in this case, it's using the same piece, but it's returning that middle value that says they're actually the same.
教授:那么实际在这个例子中,我们用的是同一个函数,它返回了中间的值也就是,0来表明着两个参数。
It's a state function. If we know the enthalpy of the products minus the enthalpy of the reactants, right. It's a state function.
如果我们知道生成物的焓减,去反应物的焓的值,它是个态函数,原则上我们可以做到。
And the reason that we now on the second line have the equal sign is because this function GetString has what's called a return value.
我们之所以,在第二行代码GetString前面加上等号,是因为这个函数会带回一个,返回值。
> So void, again, is my way of saying swap does not return anything.
>,void,再次强调下,这是一种,说明函数不返回任何值的方式。
You've got a picture of somebody's face, it's a million pixels. Each pixel has a range of values from zero to 256. I want to hash a face with some function into an integer.
你有一个人的脸部照片,它有一百万个像素,每个像素的值范围在0到256之间,我想用某个函数将一张脸部照片。
And then I could also do a Gaussian one here, with the mean of and the standard deviation of volatility divided by 2.
然后我在这里再写一个高斯分布的函数,它的浮动值的平均值和,标准偏差值都除了2。
I don't know what the names of the variables are, I don't care, I can basically suppress away that detail.
在solve函数中使用了些什么值,我不知道里面的变量的名称,我可以简单的跳过这些细节。
So, what this means is that when we're looking at an actual wave function, we're treating it as a wave, right, so waves can have both magnitude, but they can also have a direction, so they can be either positive or negative.
这意味着,当我们看一个波函数时,我们把它看做一个波,波不仅有幅值,还有方向,所以它们可正可负,如果。
So this function increment takes nothing, returns nothing, and yet it does something.
所以increment函数不带入参,也不返回值,它也没做什么。
You can also have angular notes, and when we talk about an anglar node, what we're talking about is values of theta or values of phi at which the wave function, and therefore, the wave function squared, or the probability density are going to be equal to zero.
我们也可以有角向节点,当我们说道一个角向节点时,我们指的是在某个theta的值,或者phi的值的地方,波函数以及波函数的平方,或者概率密度等于零。
You have to with C, as with a lot of programming language, say what you return.
在C语言和大部分语言中,你必须说明函数的返回值。
n So the velocity is given by this product of the quantum number n Planck constant 2 pi mass of the electron time the radius of the orbit, which itself is a function of n.
速度是量子数,普朗克常数2π乘以轨道半径的值,它自身也是n的函数。
The only thing that you have to put in the function prototype, ; again, is three things; one, the name of the function; the return value; and its arguments.
你唯一要加入到函数原型中的东西,是有三个东西,一,函数的名字;,返回值,和它的参数。
PROFESSOR2: So it's not really a Boolean-valued function.
教授2:因此这并不是一个,真正的布尔值的函数。
So functions and return values.
函数和返回值。
And again, a related problem that people run into is side-effects. You call a function and it returns a value, but maybe it, on purpose or on accident, modifies one of the actual parameters.
另外,一个人们常碰到的相关问题,就是副作用,你调用一个函数它返回一个值,但是故意或者无意的,它可能会修改一个实参的值。
Inside of swap itself, I'm printing out the values, if temporarily.
在swap函数里,我打印出,它们的值,如果临时的。
应用推荐