This is saying, that's a class, true or sorry, an instance of a class, and I'm going to get the x value associated with it.
那么两个点是同一个点,我会返回,注意格式,这儿的意思是,它是一个类,噢对不起。
Otherwise, I'm going to get a new guess by taking g, x over g, adding them, 2 and dividing by two.
或者呢,我会有一个关于g的新猜想,就是X大于g,将二者相加,然后除以。
If I do x equals 42, I'm not going to put the 42 here, where am I going to put it?
如果,x,=,42,我不会把42放在这里,我把它放在哪里?
It's like I've got ESP or I'm some character out of the X-Men, Is that what it's called? The X-Men right?
好像我有超能力或者我是X-Men,是叫X-Men吧
I'm not asking Is this person stage Mr. X the same person stage as SK 2007.
我不是在问,这个阶段的X先生,和2007年的我是不是同一阶段。
For the x part, I'm going to write x = x0 + v0 t.
对于 x 分量,有 x = x0 + v0 ? t.
I'm plotting--this is the probability of various values of x/n.
这里是x/n等于各个值的概率
And when I create a binding, x I'm taking a variable name, in this case x, stored somewhere in a table, and I'm creating a link or a pointer from that name to that value.
当我创建一个绑定的时候,我有一个变量的名字,在这个例子中是,存在一个表中的某处,然后创建一个连接,或者指针从这个名字指向目标值。
So this first little piece of code right here says, ok you give me 2 points, I'll create another 1 of these lists and I'll simply take the x, sorry I shouldn't say x, I'm going to assume it's the x, the x-values are the two points, add them together, just right there, the y-values, add them together and return that list.
好,为了来认识到这一点,让我们来看一个简单的小例子,在你们的课堂手册上,你可以看到我写了一个小程序,它假设我得到了,这些点中的一些,我想对它们做一些操作,例如我想把它们加到一起,那么这里的第一小片,代码的意思是,好给我两个点,我会再创建一个数组。
I'm going to say, gee, p2 is the x value the same in both of them, and if it is, and the y value's the same, then this is the same point, I'm going to return true.
这样的数据对象,我会把它们命名为p1和,我会去查看,看看两个对象中,的x值是不是相同,如果相同的话,就去查看y值是否相同。
I said both the x- and y- coordinates are bigger, then I'm going to return something to it.
我说过如果x和y坐标,都是更大的。
malloc I'm going to now use this new, fancy function called malloc and I'm going to say x gets the return value of malloc of the size of an int.
我现在使用这个新的,别致的函数,然后我指明x,=,malloc的int型数据的大小,的返回值。
So when I type, I'm sorry, I shouldn't say type, c point although I would have typed it, p dot x, here's what basically happens.
处于特定点的实例的这个概念,我知道它来自于这个类,这个类,when,I,write,因此当我输入,抱歉,我不该说输入的,当我写,虽然我需要输入它,p,x的时候。
Let's call x the thing I'm trying to find the square root of. Let's start at 1. Square it.
让我们把求平方根的对象,这个数称为x,让我们从1开始。
It's going to run through the loop, accumulating the answers, but because I'm subtracting, x it's just going to keep making x more and more negative as it goes along, again it's off into an infinite loop.
它一直在循环,不断的累加答案,这是因为我一直在对x做减法,这使得作为负数的,变的越来越小,又进入一个无限循环了。
But here, if I decide I'm going to store things not in x and y, but with some other set of names, for example, I've gotta go back into these pieces of code that use the points, and change them. So I've lost modularity.
除了要改下借口,但是这里,如果我决定,我不把值放在x和y中,而是和其他一些变量名进行绑定,例如这样的话,我就得回到使用这个点的代码,那儿去做更改了。
Meaning, why in the world do I have to tell the reader that I'm binding x to the value three? All right?
意思就是,我为什么要,告诉代码阅读者,要把x绑定到3这个值上呢?,对不对?
And I think in the polar one I said, if, what did I do there, I said, yeah, again if the x and y are greater than the other one, I'm going to return them to it.
然后我要返回一些值,我认为在极坐标的形式下我说过,如果,我在这里做了什么来着,我说过,对,再说一次,如果x和y坐标。
X I'm passing an X, and yet I'm also assigning the return value to X. So just intuitively what's going to be the effect of this one line of code?
我传一个X,之后我把返回值赋值给,很明显,这一行代码,将会产生什么作用?
The first statement right here, that's just an assignment statement, I'm giving some value to x.
第一个声明在这里,这仅仅是一个赋值声明,我赋值给x一个值。
I'm passing as input the value in X, which is two.
我把那个值当输入传给X,那个值是。
I'm binding x, y, and iters left to some values.
我将x,y和iters,left绑定到一些值上。
If you say, "Add the vectors, " I would just add the x to the x and the y to the y and I'm keeping track of what the sum is.
如果你们说 " 将矢量相加 ",我就把同为 x 轴方向的分量相加,同为 y 轴方向的分量相加,然后就能得出这两个矢量的和是多少了
Then, if n = 100--now I'm going to label this x differently, I'm now going to show the normal bell-shaped curve and I'm going to do this from 0 to .4.
如果n=100,现在我得重新标x值,我现在要画正态分布的钟形曲线了,在这儿用0到0.4
And I'm actually going to change it.
看看x坐标和y坐标。
So, what we have found out so far, I'm purposely going from x to y because I want you to know that the unknown variable can be called an x or can be called a y.
到目前为止,我们有这些结论,我特地把x换成y,因为我想让你们明白,未知变量既可以写成x,也可以写成y
Take these two equations, put an equal sign between them, replace this PR throughout with X, I'm going to have one equation and one unknown and that even the math phobics in the audience did in high school.
在这两个方程中间加个等号,将这里的Pr换成X,就会得到一个等式和一个未知数,剩下的问题,大家高中的时候就该回做了吧
Now in fact, this may come as a surprise to you, I don't have ESP, I'm not a character out of the X-Men, so you can't actually see brain waves emitting from my head, and my reasoning doesn't affect your reasoning.
事实上,这绝对是不可能的,我没有超能力,我也不是X-Men,所以你根本看不到我大脑发出的脑波,我的推理不会影响到你
Yeah. Suppose I choose it right down there I guess 0. Well, the tangent there will not even have an x intercept. So I'm really going to be dead in the water.
好,如果我选猜想数为0,好吧,这个点的切线甚至和x轴都没交点,所以在这儿这一原则,真的不起作用了。
I'm doing a test there to say, x if the string x is less than the value of b, and x does not appear before b as strings, then I was going to do, oh, a couple of things, because they're at the same block level.
我正在做一个测试来看看,字符串,是不是小于b的值,而且x不在b之前作为字符串出现,如果是真的话我就要做,一系列的操作,因为他们是在同一个块等级上。
应用推荐