For his mathematical project, he compared two ways to estimate the square root of an integer, a number with no fractional parts.
VOA: special.2011.03.24
Because I might have written some code in which I'm expecting that integer particular variable to have an integer value.
因为我可能写了一些代码,来把一些,变量的类型,指定为。
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之间,我想用某个函数将一张脸部照片。
4 So even if the correct mathematical answer is 1.4 or whatever, when you divide an int by an int, you only have room in that variable, in the response for an actual integer.
所以即使那个正确的答案是4,或别的数值,当你用一个整型数除以一个整型数,在那个变量的返回值里,只有,存储一个整型数的空间。
Bohr said that the angular momentum, mvr where n is this integer counter h over 2 pi.
波尔提及到角动量,是被量化了的,mvr,is,quantized,这里的n等于一个整数乘以h除以2π
And unlike n, l can start all the way down at 0, and it increases by integer value, so we go 1, 2, 3, and all the way up.
不像n,l可以从0开始取,然后每次增加一个整数,所以我们可以去1,2,3,一直下去。
There's no decimal point; there's no point zero; there's no floating point value, it's just a hardcoded integer.
这里没有小数点,这里没有;,这里没有浮点数值,它只是一个整型数字。
Let me generalize this. In this case, my incrementer was just adding 1 to an integer, it's a pretty straightforward thing to do.
当我完成后,我不会再显示任何信息了,好,好,那么你们已经看过两个简单的例子了,让我来讲讲概念,在这个例子中。
Suppose I want to find all the divisors of some integer, I want to figure out what all the divisors are that go evenly into it.
也就是遍历所有的整数来寻找,一个数的平方根,让我们再来看一个例子吧,为了找出另外一种的解决方法。
So at the very top, I've coded up the same thing as before: "Give me an integer between one and ten," or rather, -- "give me an integer between one and ten" -- a little different this time.
所以在顶部,我像之前那样对同样的东西进行编码:,“给我一个1到10的整数“,或者,“给我一个1到10的整数“,这次有点不同。
> Okay. Well, this code allocates a new integer pointee and this part sets x to point to it.
>,好的,呃,这段代码分配一个新的整型指针数据,这部分让x指向它。
I give it some character. It gives me back an integer representing. It looks weird.
我输入一些字符,程序返回给我一个整数的表示。
I'm going to write a function to compute integer power exponents.
我要去写一个,计算一个整数幂指数的方法。
So with an integer, an int data type, you can store any number between 0 and 4 billion roughly.
只要有一个整数,一个int型的数据,就能储存任意一个,位于0到40亿之间的一个数。
Right, It's just squaring an integer, is what it's doing.
对了,这个程序就是,用来求一个整数的平方的。
It's doing integer division.
这是整数的除法。
Pick an integer, somebody.
多少个头?来个人选个整数。
So, for example: in this case, my list is a bunch of integers. And one of the things I could take advantage of, is I'm only going to need a finite amount of space to represent an integer.
列表是一系列整数,要注意的这里的优势能够,用有限的空间来表示整数,例如,如果我想要操作。
So for example, I can say, what are all the methods associated with the number,or the integer 1?
所有与数字,或者说整数,相关联的方法是哪些?,你可能已经认出一些来了?
And then, if I want to find out if something's there, I do the same thing. But notice now, hash is converting the input into an integer.
然后,我想查找出某些元素是否在列表中,我做同样的事,但是现在注意,哈希是将输入转化成一个整数,所以,其思想是什么?
I'd like an integer please, a colon, and a space just for aesthetic reasons.
我想要一个整型数,一个冒号,和一个,使其更美观的空格。
If you want to output an integer or other types as we'll see.
如果你想输出一个整数,我们将学习到的其他类型。
So hopefully there is indeed a way to fix this, but it looks as though the division operator, the single slash is division but -- and here's a curiosity about many programming languages -- because 17 is an integer and because 13 is an integer, why do I say that?
我的确希望有一个方法来修正这个错误,但是看起来,好像那个除法操作,那个斜杠是除法,但是--对于很多编程语言来说,是挺奇怪的--因为17是一个整数,13也是一个整数,为什么我这样说?
Give me an integer between 1 and 10."
给我一个1到10的正数“
So I'd like an integer please.
所以我想要一个整型数。
All right, first question. What values of x does it terminate? Again, assume x is an integer.
好,第一个问题,对于x的什么值程序,会最终终止,还是假设x为整数。
n It takes discrete values, multiples of some integer n, and the multiplication factor is the ratio of the Planck constant divided by 2 pi where n takes one, two, three and so on.
这些离散的值乘以整数,乘积因子,是普朗克常数除以2π,其中n可以取1,2,3,等等。
I print out -- and this is only wrapping - because of the big font -- I print out, "I demand that you give me a positive integer."
我打印出来--这个字符相互覆盖了,因为用的是大字体-,我打印:“我需要你给我一个正整数“
I demand that you give me a positive integer.
我要求你给我一个正整数。
Right, that divide is, if x is an integer and two is an integer, what's it going to do?
好,这个除法意思是,如果x是个整数而2也是个整数,那么会怎么操作呢?
应用推荐