Ma-Chen Financial Chaotic System Solver with Sensitivity Analysis
Project description
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
@software{herho2025_kalimusada,
title = {kalimusada: A Python library for solving the Ma-Chen financial chaotic system},
author = {Herho, Sandy H. S.},
year = {2025},
url = {https://github.com/sandyherho/kalimusada}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kalimusada-0.0.1.tar.gz.
File metadata
- Download URL: kalimusada-0.0.1.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.2 Linux/6.11.9-100.fc39.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abea6bdb1144c724256cdba9f6fe60e6408d465f50fc918bf93e090c4a4d377e
|
|
| MD5 |
3f49f1ebf6b6e5abec8b93ef5b0d69db
|
|
| BLAKE2b-256 |
741398808f9b0e3d73c8126652f5ddcb9a55841a8b373f41298a0419787369b2
|
File details
Details for the file kalimusada-0.0.1-py3-none-any.whl.
File metadata
- Download URL: kalimusada-0.0.1-py3-none-any.whl
- Upload date:
- Size: 23.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.2 Linux/6.11.9-100.fc39.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60af0ad13e93568cf717620dc689bc1fad4e1809b4114375d58f7010b1166520
|
|
| MD5 |
b2d39e0a6ab737dd430b8094d340790b
|
|
| BLAKE2b-256 |
efc6d7306fc3adaa1cc33ba5e562b3fc3666705f5ca046502a87a85e9fe555b3
|