Introducing Ergodicity Library
A Toolkit For Exploring Time-Average Behavior In Stochastic Environments
Today is the day! After a long period of development, I’m releasing the first beta version of the Ergodicity library — a Python toolkit designed to automate and accelerate research in ergodicity economics and related fields, accompanied by the tutorial book: Ergodicity Library: An Introduction. Both of them are available on the website: www.ergodicitylibrary.com
The work of Ole Peters and his colleagues in ergodicity economics has fascinated me for a long time. Several years ago, while being a student in economics, I did my first and pretty primitive programming experiments on the topic.
And much later, this year, when I was exploring again how I could contribute to the development of ergodicity economics, I realized that I had too many ideas and too little time. It’s rare in modern science to encounter a field with so many fundamental questions unanswered and numerous promising ideas to test. It is fascinating but at the same time frustrating that so many low-hanging fruits remain unpicked.
I asked myself: how can I contribute most efficiently in such a situation? The answer became clear — by helping to automate — creating a set of tools that not only speeds up research but also lowers the entry barrier for others interested in the field. So, I postponed doing the research (although that was hard) and focused on developing tools to do the research.
The Ergodicity library is the result of this effort. It provides:
- A vast catalog of stochastic processes with the ability to create custom ones.
- Numerical and symbolic toolkits for ergodicity calculations, stochastic analysis, and time-average computations.
- Tools for creating and managing artificial agents optimizing behavior under uncertainty.
- Functionality for inferring the ergodic properties of time series and risk preferences from data.
The library is designed to be powerful yet easy to use, simplifying the management of stochastic processes and ergodicity economics calculations. It supports custom configurations, multiprocessing, advanced visualizations, research and reporting automatization, different simulation methods, and integrates well with numpy, sympy, matplotlib, and tensorflow. The library appeared to evolve into a big project with many submodules, and it is impossible to describe everything it does in one post, so I refer you to the tutorial book.
Although the initial purpose of the library and my main motivation to create it was to accelerate the research in ergodicity economics, the final result, I believe, is applicable far beyond. For example, the library offers:
- A robust symbolic stochastic differential equation solver (to my knowledge, the most powerful one ever developed in Python).
- Extensive tools for working with fat-tailed processes, especially Lévy alpha-stable processes.
- Evolutionary algorithms for testing evolving artificial agents under risk.
- An expressive constructor for custom stochastic processes, stochastic differential equations, and their systems.
- Many tools for simulating and solving stochastic differential equations, their systems, and partial stochastic differential equations — all with different (not necessarily Wiener) increments.
Both the library and the accompanying tutorial book are free and open-source. They can be installed with a single line of code using pip:
pip install ergodicity
A couple of words must be said about the Ergodicity Library: An Introduction book. It is mostly a tutorial on how to use the library, but it also provides many use cases and shows how the library can be used in different disciplines — may it be economics, physics, biology, or chemistry. It is accessible for absolute beginners, but advanced users of Python and people who know a lot about ergodicity economics and stochastic analysis may find there many interesting things for themselves as well.
I also created ErgodicityGPT — a custom GPT agent who has access to the documentation and knowledge about the library and can help you learn and use it.
I hope this library will help advance the great, hard and necessary research being conducted in ergodicity economics and its applications across various disciplines where stochastic dynamics and time-average behavior matter.
The library is also available on GitHub. Contributions, issue reports, and feature suggestions are welcome as we work together to expand the possibilities in stochastic analysis and ergodicity economics.
As the project is released, I am now planning to dedicate time to updating it based on the user feedback and applying its toolkit myself to answer the long-awaited questions which motivated its development.