Skip to Content
复杂性思考:复杂性科学和计算模型(原书第2 版)
book

复杂性思考:复杂性科学和计算模型(原书第2 版)

by Allen B. Downey
March 2020
Intermediate to advanced
200 pages
3h 12m
Chinese
China Machine Press
Content preview from 复杂性思考:复杂性科学和计算模型(原书第2 版)
元胞自动机
79
5.12 CA
到目前为止,如果 CA 是“ totalitic”,那么我们的函数是有效的,这意味着
规则只依赖于邻居的和。但是大多数规则也取决于哪个邻居是开着的,哪个
邻居是关着的。例如,100 001 有相同的和,但是对于许多 CA 来说,它们
会产生不同的结果。
我们可以使用带有元素 [4,2,1] 的窗口,step2 通用,该窗口将邻域视为二进
制数。例如,邻域 100 产生 4010 产生 2001 产生 1。然后我们可以获取
这些结果并在规则表中查找它们。
下面是 step2 的更一般步骤:
def step3(array, i, window=[4,2,1]):
row = array[i-1]
c = np.correlate(row, window, mode='same')
array[i] = table[c]
前两行是相同的。最后一行从表中的 c 中查找每个元素,并将结果赋给
array [i]
这是计算表的函数:
def make_table(rule):
rule = np.array([rule], dtype=np.uint8)
table = np.unpackbits(rule)[::-1]
return table
参数 rule 0 255 之间的整数。第一行将 rule 放入一个包含单个元素
的数组中,因此我们可以使用 unpackbits,它将规则编号转换为二进制表
示。例如,这是规则 150 的表:
>>> table = ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

数据驱动力:企业数据分析实战

数据驱动力:企业数据分析实战

Carl Anderson
精通模块化JavaScript

精通模块化JavaScript

Nicolás Bevacqua
流畅的Python

流畅的Python

Luciano Ramalho

Publisher Resources

ISBN: 9787111647348