1
当我运行下面的程序时,它输出所有的数字为0.0。如何解决这个问题来说明混沌行为?如何编写说明混沌行为的Python程序
# A simple program illustrating chaotic behaviour
def main():
print ("This program illustrates a chaotic function")
x = int (float(input("Enter a number between 0 and 1: ")))
for i in range(10):
x = 3.9 * x * (1-x)
print (x)
main()
Python的'int()'层数,所以0到1之间的每个数字都舍入为0。 – wrkyle