kalimusada: a Python library for solving the Ma-Chen financial chaotic system
A Python-based solver for demonstrating sensitivity to initial conditions in economic dynamics.
Model
The Ma-Chen system describes financial dynamics through three coupled ordinary differential equations:
$$ \dot{x} = z + (y - a)x, \quad \dot{y} = 1 - by - x^2, \quad \dot{z} = -x - cz $$
where the state variables are:
| Variable | Description | Economic interpretation |
|---|---|---|
| $x(t)$ | Interest rate | Cost of borrowing capital |
| $y(t)$ | Investment demand | Aggregate investment activity |
| $z(t)$ | Price index | General price level |
and the parameters are:
| Parameter | Description | Chaotic value |
|---|---|---|
| $a$ | Savings rate | $0.9$ |
| $b$ | Investment cost coefficient | $0.2$ |
| $c$ | Demand elasticity | $1.2$ |
The solver simulates two trajectories with infinitesimal initial separation $\delta_0 \sim \mathcal{O}(10^{-5})$ to visualize exponential divergence characteristic of deterministic chaos.
Installation
From PyPI:
pip install kalimusada
From source:
git clone https://github.com/sandyherho/kalimusada.git
cd kalimusada
pip install -e .
Quick start
CLI:
kalimusada case1 # run standard chaos scenario
kalimusada --all # run all test cases
Python API:
from kalimusada import MaChenSolver, MaChenSystem
system = MaChenSystem(a=0.9, b=0.2, c=1.2)
solver = MaChenSolver()
result = solver.solve(
system=system,
init_A=[1.0, 2.0, 0.5],
init_B=[1.00001, 2.0, 0.5],
t_span=(0, 250),
n_points=100000
)
print(f"Max divergence: {result['max_euclidean_distance']:.6f}")
Features
- High-precision ODE integration (LSODA)
- Dual trajectory sensitivity analysis
- Error metrics: Euclidean distance, RMSE, log divergence
- Output formats: CSV, NetCDF, PNG, GIF
License
MIT © Sandy H. S. Herho
Citation
@article{herho2026butterfly,
title = {{T}he butterfly effect in economics: {E}xploring chaos with a simple financial model},
author = {Herho, Sandy H. S.},
journal = {CODEE Journal},
volume = {20},
number = {1},
pages = {1},
year = {2026},
note = {https://scholarship.claremont.edu/codee/vol20/iss1/1}
}
Metadata
Release files for kalimusada 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kalimusada-0.0.2.tar.gz | 19.4 kB | Without provenance | Details for kalimusada-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kalimusada-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for kalimusada-0.0.2-py3-none-any.whl |
Total release size: 42.7 kB
Release files / kalimusada-0.0.2.tar.gz
| Download URL | kalimusada-0.0.2.tar.gz |
|---|---|
| Size | 19.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b372eca3b9c304a61ef204f89d33730b652e9a302e241dc178d2f8a0cfe4097
|
|
BLAKE2b-256 checksum How to use checksums |
8bb1e2b7f32565e2a64d75d6d096955797195cec952a8c504692222a3390182a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.2 Linux/6.11.9-100.fc39.x86_64
|
Release files / kalimusada-0.0.2-py3-none-any.whl
| Download URL | kalimusada-0.0.2-py3-none-any.whl |
|---|---|
| Size | 23.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81726bf144f2968f447618058c2d74bc23d28314342fd70a8e02235d21215a12
|
|
BLAKE2b-256 checksum How to use checksums |
487a719ddf335eb6c9f4579cf2a51c08831f78bcc8e2084106b776183fcaeba8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.2 Linux/6.11.9-100.fc39.x86_64
|
Security for kalimusada 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.