Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 941 Bytes

README.md

File metadata and controls

31 lines (22 loc) · 941 Bytes

Continuous Automata

Network Automata needn't consist of discrete activities. The units in an automaton can also take on continuous-valued activities.

The example below implements a continuous-valued Cellular Automaton from Wolfram's NKS book, found on page 157:

import math
import netomaton as ntm

adjacency_matrix = ntm.network.cellular_automaton(n=200)

initial_conditions = [0.0]*100 + [1.0] + [0.0]*99

# NKS page 157
def activity_rule(ctx):
    activities = ctx.activities
    result = (sum(activities) / len(activities)) * (3 / 2)
    frac, whole = math.modf(result)
    return frac

activities, adjacencies = ntm.evolve(initial_conditions, adjacency_matrix, timesteps=150,
                                     activity_rule=activity_rule)

ntm.plot_grid(activities)

The full source code for this example can be found here.