No commit activity in last 3 years
No release in over 3 years
Define simple dynamical systems, evolve them, and calculate properties.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

 Project Readme

A simple ruby library for discrete dynamical systems.

The essence of each system is a rule (given as a hash) that determines state transitions. You can create, evolve, and toy with these systems in a variety of ways.

Install

gem 'dynamical_system'

A cyclic system with 3 states

rule = { :s1 => :s2, :s2 => :s3, :s3 => :s1 }
sys = DynamicalSystem.new(rule, :s1)

sys.states      # => [:s1, :s2, :s3]
sys.evolve!(6)  # => :s1
sys.history     # => [:s1, :s2, :s3, :s1, :s2, :s3, :s1]

A system with a cycle and a fixed point

rule = { :s1 => :s2, :s2 => :s1, :s3 => :s3 }
sys = DynamicalSystem.new(rule, :s1)

sys.fixed_points                  # => [:s3]
sys.is_invariant_set?([:s1, :s2]) # => true

A system with a single attractor

rule = { :s1 => :s3, :s2 => :s3, :s3 => :s3 }
sys = DynamicalSystem.new(rule, :s1)

sys.path!(3)            # => [:s1, :s3, :s3, :s3]
sys.is_fixed_point?(:s3) # => true
sys.is_bijective?        # => false

A random system with 5 states

sys = DynamicalSystem.random(5)
sys.states.size # => 5