Think Complexity: Exploring Complexity Science in Python

Think Complexity

Version 2.6.3

Think Complexity

Version 2.6.3

Allen B. Downey Green Tea Press

Needham, Massachusetts

Copyright ? 2016 Allen B. Downey.

Green Tea Press 9 Washburn Ave Needham MA 02492

Permission is granted to copy, distribute, transmit and adapt this work under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License: .

If you are interested in distributing a commercial version of this work, please contact the author.

The LATEX source for this book is available from



iv

Contents

Preface

xi

0.1 Who is this book for? . . . . . . . . . . . . . . . . . . . . . . xii

0.2 Changes from the first edition . . . . . . . . . . . . . . . . . xiii

0.3 Using the code . . . . . . . . . . . . . . . . . . . . . . . . . . xiii

1 Complexity Science

1

1.1 The changing criteria of science . . . . . . . . . . . . . . . . 3

1.2 The axes of scientific models . . . . . . . . . . . . . . . . . . 4

1.3 Different models for different purposes . . . . . . . . . . . . 6

1.4 Complexity engineering . . . . . . . . . . . . . . . . . . . . . 7

1.5 Complexity thinking . . . . . . . . . . . . . . . . . . . . . . 8

2 Graphs

11

2.1 What is a graph? . . . . . . . . . . . . . . . . . . . . . . . . 11

2.2 NetworkX . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.3 Random graphs . . . . . . . . . . . . . . . . . . . . . . . . . 16

2.4 Generating graphs . . . . . . . . . . . . . . . . . . . . . . . . 17

2.5 Connected graphs . . . . . . . . . . . . . . . . . . . . . . . . 18

2.6 Generating ER graphs . . . . . . . . . . . . . . . . . . . . . 20

2.7 Probability of connectivity . . . . . . . . . . . . . . . . . . . 22

vi

CONTENTS

2.8 Analysis of graph algorithms . . . . . . . . . . . . . . . . . . 24 2.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3 Small World Graphs

27

3.1 Stanley Milgram . . . . . . . . . . . . . . . . . . . . . . . . . 27

3.2 Watts and Strogatz . . . . . . . . . . . . . . . . . . . . . . . 28

3.3 Ring lattice . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

3.4 WS graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

3.5 Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

3.6 Shortest path lengths . . . . . . . . . . . . . . . . . . . . . . 35

3.7 The WS experiment . . . . . . . . . . . . . . . . . . . . . . . 36

3.8 What kind of explanation is that? . . . . . . . . . . . . . . . 38

3.9 Breadth-First Search . . . . . . . . . . . . . . . . . . . . . . 39

3.10 Dijkstra's algorithm . . . . . . . . . . . . . . . . . . . . . . . 41

3.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

4 Scale-free networks

47

4.1 Social network data . . . . . . . . . . . . . . . . . . . . . . . 47

4.2 WS Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

4.3 Degree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

4.4 Heavy-tailed distributions . . . . . . . . . . . . . . . . . . . 53

4.5 Barab?asi-Albert model . . . . . . . . . . . . . . . . . . . . . 55

4.6 Generating BA graphs . . . . . . . . . . . . . . . . . . . . . 57

4.7 Cumulative distributions . . . . . . . . . . . . . . . . . . . . 59

4.8 Explanatory models . . . . . . . . . . . . . . . . . . . . . . . 62

4.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

CONTENTS

vii

5 Cellular Automatons

67

5.1 A simple CA . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

5.2 Wolfram's experiment . . . . . . . . . . . . . . . . . . . . . . 68

5.3 Classifying CAs . . . . . . . . . . . . . . . . . . . . . . . . . 69

5.4 Randomness . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

5.5 Determinism . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

5.6 Spaceships . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

5.7 Universality . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

5.8 Falsifiability . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

5.9 What is this a model of? . . . . . . . . . . . . . . . . . . . . 78

5.10 Implementing CAs . . . . . . . . . . . . . . . . . . . . . . . 80

5.11 Cross-correlation . . . . . . . . . . . . . . . . . . . . . . . . 82

5.12 CA tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

5.13 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

6 Game of Life

89

6.1 Conway's GoL . . . . . . . . . . . . . . . . . . . . . . . . . . 89

6.2 Life patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

6.3 Conway's conjecture . . . . . . . . . . . . . . . . . . . . . . 92

6.4 Realism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

6.5 Instrumentalism . . . . . . . . . . . . . . . . . . . . . . . . . 95

6.6 Implementing Life . . . . . . . . . . . . . . . . . . . . . . . . 97

6.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

7 Physical modeling

103

7.1 Diffusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

7.2 Reaction-diffusion . . . . . . . . . . . . . . . . . . . . . . . . 105

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download