An interactive Streamlit web application that visualizes the Peano-Baker series, a powerful mathematical tool for approximating the state transition matrix
This tool aims to bridge the gap between abstract control theory and intuitive understanding by providing real-time visualizations, error bounds, and practical control case studies.
-
Custom LTV Systems: Define your own time-varying matrix
$A(t)$ using Python syntax (e.g.,[[0, 1], [-2 - 0.5*cos(t), -1]]) or choose from preset physical systems like the Damped Oscillator or Mathieu Equation. -
Real-Time Phase Portraits: Visualize 2D state trajectories (
$x_1$ vs$x_2$ ) and time-series evolution. -
Visual Convergence: Adjust the number of series terms (
$N$ ) and watch the approximation converge to the true solution in real-time.
- ** Theoretical Upper Bounds**: Compares the actual numerical error against the theoretical analytical upper bound derived from the work of Baake & Schlägel.
- Validity Horizon: Automatically calculates the time horizon for which the approximation is guaranteed to stay within a specified error threshold.
-
Parameter Sensitivity: Explore how changes in initial conditions (
$x_0$ ) and system dynamics magnitude ($|A|$ ) affect convergence. - Gradient Visualization: Compute and visualize 3D surfaces showing the sensitivity of the solution to system parameters (e.g., stiffness vs. perturbation).
- Convergence Heatmap: A "Wavefront" visualization showing the error magnitude across Time vs. Number of Terms.
- Term Magnitude: Analyze the Frobenius norm of individual series terms to verify decay and convergence.
-
Computation Benchmarks: Analyze the
$O(N \cdot M)$ complexity of the cumulative integration scheme.
- Variable-Height LIPM: A demonstration of LTV control applied to a walking humanoid robot that changes height (squatting).
- LTI vs LTV: Visually compares a standard "Naive" controller (assuming constant height) vs. the "Peano" controller (accounting for time-varying height), showing why LTV theory is critical for dynamic robots.
- Python 3.8+
- pip
Clone the repository, create a virtual environment, and install the required Python packages:
git clone https://github.com/yourusername/Peano-Baker-Series-Visualizer.git
cd Peano-Baker-Series-Visualizer
# Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r peano_baker_viz/requirements.txtStart the Streamlit development server:
streamlit run peano_baker_viz/app.pyThe app will automatically open in your default browser at http://localhost:8501.
This project is deployed to GitHub Pages using stlite (Serverless Streamlit).
Unlike traditional Streamlit apps that require a backend Python server, this project uses stlite to run the entire application directly in the user's browser using WebAssembly (Pyodide).
- Static Files: The
docs/directory contains a staticindex.htmlfile and copies of the Python source code (app.py,utils.py,case_studies.py). - WebAssembly Runtime: When a user visits the page,
index.htmlloads thestliteruntime, which downloads the Pyodide Python interpreter. - Browser Execution: The Python code is executed locally within the browser tab. This eliminates the need for a dedicated backend server, allowing free hosting on GitHub Pages.
GitHub Pages is configured to serve the /docs folder from the main branch.
peano_baker_viz/: Source code for local development.app.py: Main application entry point.utils.py: Core mathematical engine.case_studies.py: Robot simulation logic.
docs/: Static site assets for GitHub Pages deployment (containsindex.htmland mirrors the python files).
The pages webiste hosts a preview of the streamlit app. It is not exactly the same as what is seen if running the streamlit app itself.
You can see the app in action at Peano-Baker-Series-Visualizer.