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 版)
生命游戏
89
细胞里的水?细胞的结构部分?头发吗?死皮吗?皮肤上的细菌?你肠道里
的细菌?线粒体?当你称体重时,你包含了多少这样的分子?用离散的对象
来设想世界是有用的,但是我们所识别的实体并不是真实的。”
如果你对这些说法中的一些比另一些更满意,问问自己为什么。在这些情景
中,影响你反应的不同之处是什么?你能在它们之间做出原则性的区分吗?
有关工具主义的更多信息,请参阅
https://thinkcomplex.com/instr
6.6 生命游戏实现
本章末尾的练习要求你尝试和修改生命游戏,并实现其他二维元胞自动机。
本节将解释我对 GoL 的实现,你可以将其作为积累经验的起点。
为了表示单元格的状态,我使用一个由 8 位无符号整数组成的 NumPy 数组。
例如,下面的代码创建一个 10×10 的数组,并用 0 1 的随机值进行初始化:
a = np.random.randint(2, size=(10, 10), dtype=np.uint8)
有几种方法可以计算 GoL 规则。最简单的是使用 for 循环遍历数组的行和列:
b = np.zeros_like(a)
rows, cols = a.shape
for i in range(1, rows-1):
for j in range(1, cols-1):
state = a[i, j]
neighbors = a[i-1:i+2, j-1:j+2]
k = np.sum(neighbors) - state
if state:
if ...
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