We knew this was trying to do squaring, so intellectually we know we can square -4, it ought to be 16, but what happens here?
我们知道程序是用来求平方数的,那么按理说我们可以来求-4的平方,也就是16,但是程序结果是怎么样的呢?
If it moves a lot--either way from the mean-- then this number squared is a big number.
如果距离均值的变动很大,那么这个平方数也会很大
All right. I tried it on 2, I surely didn't expect a precise and exact answer to that but I got something, and if you square this, you'll find the answer kept pretty darn close to 2.
好,我试试求2的平方根,我当然不希望得到一个完全准确的答案了,但是我得到了一个近似值,试试将这个数平方一下,你会发现结果和2相当接近。
So, the number of nuclei, 119 if we were to sit and count these as well, is 119. So, we'll multiply that by just pi, r squared, to get that cross-section, and divide all of that by 1 . 39 meters squared.
如果你们数的话,原子核的数是,我们用它乘以πr的平方,得到横截面积,除以1。39平方米。
It weights big deviations a lot because the square of a big number is really big.
使偏离的权重更大,一个数的平方是一个更大的数
OK, once it gets to the end of that, what's it going to do? It's going to come down here and, oh. What's that doing? Well I cheated when I started. I said, somebody's giving me a perfect square, I'm looking for the square root of it. But suppose 15 I gave this thing 15, and asked it to run.
好,一旦到了循环的最后,程序会去做什么?程序会跳到这里来,噢,这是干什么的?好吧,当我开始的时候我有点小作弊的意思,我说过,我得到了一个完美的平方数,我要求这个数的平方根,但是假设下我得到的数是。
I'm given an integer that's a perfect square, and I want to write a little piece of code that's going to find the square root of it. All right so I'm cheating a little, I know it's a perfect square, somebody's given it to me, we'll come back in a second to generalizing it, so what would the steps be that I'd use to walk through it?
完美平方数的整数,我想写一段代码来求这个数的平方根,好,我这儿有点儿作弊了,我知道这是一个完美的平方数了,他们给我的,我们后面会讲怎么产生这个数的,那么我想解决这个问题,需要什么步骤呢?
And if I were to use that again, I'd just put it on your handout, I could go back and rewrite that thing that I had previously for finding the square roots of the perfect squares, just using the FOR loop. OK. What I want to do, though, is go on to-- or, sorry, go back to - my divisor example.
它可以是任意的集合,如果我又要去用这个方法的话,我会把它放在你们的课堂手册上的,我可以回过头去用FOR循环,重新写我们那个求平方数的程序,我想要做的是,是继续-哦抱歉,回到-我的除数那个例子。
应用推荐