And so he said, if you start off with a male and a female, at the end of one month they have an offspring. Let's assume they have two offspring. At the end of the next month let's assume those offspring have offspring. Again a male and female.
在13世纪的时候想要计算兔子的数量,就是一个月大的兔子,再过一个月就可以进行交配,所以它说如果你一开始有一公一母两只兔子,在一个月末它们就可以生小兔子,让我们假设它们生了两只小兔子。
I don't know. If you've ever seen a movie - well, there are lots of movies that do this; one of the first movies that did this was "Who Killed Roger Rabbit?"
我不知道,如果你们看过那部电影,当然,有很多电影都描写过这一点,其中一部较早的,电影表现了这一手法--《谁谋杀了兔子罗杰》
It only works within species. So, in another experiment they put a rabbit in the other room and the chimpanzee would slap the lever repeatedly to make the rabbit scream in pain and jump.
这种结果只出现在同种动物上,在另一个实验里,他们在另一个房间放一只兔子,结果黑猩猩不停地拍杠杆,让兔子痛得上跳下窜,大声尖叫。
So it looks like a rabbit.
看上去像只兔子。
The question was how many rabbits do you have at the end of a year? At the end of two years? At the end of more than that number of years, and so. We can do this with the following level definition. We're going to let pairs of 0, the number of pairs at month 0, actually it would not be it would be 1.
在下一个月末的时候让我们假设,这2只小兔子也有了后代,同样是一公一母,问题是一年后你会有多少只小兔子?,两年后呢?更多年后呢?,我们可以用接下来的等级说明来解释,在第0个月有0对兔子。
Notice if I'm going to have two different sub problems I need to have two base cases here to catch this. And if I only had one it would error out. And as a consequence, I can go off and ask about rabbits. Let's see.
我需要定义两个基础事件来处理它,如果我只有一个基础事件的话就会产生错误,这样我就能够知道到底有多少只兔子了,让我们来看看,在第12个月末,没那么简单,在第二年末兔子就很多了。
And then the number of pairs at month n is the number of pairs at month n - 1 plus the number of pairs at month n - 2.
我们让第一个月的兔子数是1对,第n个月的兔子对数,是第n-1个月的兔子对数。
The sum of the previous two.
加上第n-2个月的兔子对数。
This is--what elicited the laughter for Zachary was watching the classic film Winnie the Pooh and the Blustery Day where Rabbit climbed on a high bunch of shelves and it all came crashing down on him.
让Zachary笑的是,他在看的一部经典电影,《小熊维尼和大风吹》,兔子爬到一个很高的架子上,架子塌下来,砸到它身上。
应用推荐