A modern web application for visualizing and understanding difference equations and economic models, with a focus on interactive demonstrations of dynamic systems.
This project is an educational web application designed to help students and economists understand complex dynamic systems through interactive visualizations. It covers fundamental concepts in difference equations and their applications to economic models like the Cobweb Model, supply-demand dynamics, and price-quantity relationships.
The application provides:
- Interactive Calculator for solving difference equations
- Visual Models with real-time parameter adjustments
- Multi-language Support (English, Slovak)
- Mathematical Rendering with LaTeX and Plotly charts
Interactive visualization of how price and quantity reach equilibrium through cyclical adjustments.
Variations include:
- Convergence to equilibrium
- Divergence from equilibrium
- Oscillatory behavior
- Chaotic dynamics
Solve difference equations with automatic LaTeX rendering of solutions.
Explore how market equilibrium is determined through supply and demand curves.
Analysis of long-run equilibrium in dynamic economic systems.
Study how expectations adapt over time in economic forecasting.
Explore chaotic behavior and system anomalies in difference equations.
Full support for English and Slovak languages with dynamic language switching.
cobweb-website/
โโโ app.py # Flask application entry point
โโโ Dockerfile # Docker configuration
โโโ requirements.txt # Python dependencies
โโโ secret.env # Environment variables
โ
โโโ api/ # API route handlers
โ โโโ __init__.py
โ โโโ home_api.py # Home page routing
โ โโโ calculator_api.py # Calculator endpoints
โ โโโ models_api.py # Model visualization endpoints
โ โโโ intros_and_params_api.py # Introduction & parameters
โ โโโ language_api.py # Language switching
โ
โโโ dictionaries/ # Content dictionaries
โ โโโ intros_dictionary.py
โ โโโ models_dictionary.py
โ โโโ params_dictionary.py
โ
โโโ tools/ # Calculation & modeling tools
โ โโโ diff_calculator.py # Difference equation solver
โ โโโ models/
โ โโโ cobweb_equations.py
โ โโโ cobweb_functions.py
โ โโโ demand_and_supply.py
โ โโโ adaptive_expectations.py
โ โโโ normal_price.py
โ โโโ prices_periods_dependency.py
โ
โโโ static/ # Static assets
โ โโโ css/ # Stylesheets
โ โ โโโ global.css
โ โ โโโ index.css
โ โ โโโ calculator.css
โ โ โโโ data.css
โ โ โโโ intros.css
โ โ โโโ params.css
โ โโโ js/ # JavaScript files
โ โ โโโ data.js
โ โ โโโ intro.js
โ โโโ img/ # Images & diagrams
โ
โโโ templates/ # HTML templates
โ โโโ base.html # Base template
โ โโโ index.html # Home page
โ โโโ calculator.html # Calculator interface
โ โโโ data.html # Data visualization
โ โโโ intros_base.html
โ โโโ params_base.html
โ โโโ partials/ # Reusable template components
โ โโโ math_table.html
โ โโโ math_table_calc.html
โ
โโโ utils/ # Utility functions
โโโ checking_utils.py
โโโ solutions_utils.py
- Python 3.8+
- pip or conda
-
Clone the repository
git clone <repository-url> cd cobweb-website
-
Create a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set environment variables
# Create a .env file or use secret.env export SECRET_KEY="your-secret-key-here"
-
Run the application
python app.py
The application will be available at http://localhost:5000
Navigate to / to access the main menu with all available models and tools.
Access the interactive cobweb model at /model/cobweb to adjust parameters and visualize model behavior.
Use the difference equations calculator at /calculator to solve equations and see LaTeX-formatted solutions.
View interactive charts and data analysis at /data.
Switch between English and Slovak from the language menu in the navigation bar.
| Technology | Purpose |
|---|---|
| Flask | Web framework for routing and templating |
| SymPy | Symbolic mathematics & equation solving |
| Plotly | Interactive data visualization |
| NumPy | Numerical computations |
| HTML5/CSS3 | Frontend structure and styling |
| JavaScript | Client-side interactivity |
- flask ~3.0.3
- sympy ~1.13.2
- plotly ~5.24.1
- numpy ~1.26.4
Solves linear and non-linear difference equations, providing:
- General solutions
- Particular solutions
- LaTeX mathematical notation rendering
Demonstrates supply-demand dynamics with:
- Convergent equilibrium
- Divergent patterns
- Oscillatory cycles
- Chaotic behavior
Key Equations:
- Demand:
$P_d = a - b \cdot Q_d$ - Supply (lagged):
$Q_s = c + d \cdot P_{t-1}$ - Equilibrium condition:
$Q_d = Q_s$
Analyzes long-run equilibrium behavior and convergence properties.
Models how agents form expectations adaptively based on past errors.
Comprehensive visualization of:
- Market equilibrium
- Consumer and producer surplus
- Elasticity effects
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Home page |
/calculator |
GET | Calculator interface |
/calculator |
POST | Calculate difference equations |
/model/<model_name> |
GET | Display specific model |
/data |
GET | Data visualization page |
/intros/<section> |
GET | Introduction pages |
/params/<model> |
GET | Model parameters page |
/language |
POST | Switch language |
docker build -t cobweb-website .docker run -p 5000:5000 \
-e SECRET_KEY="your-secret-key" \
cobweb-websiteThe application will be accessible at http://localhost:5000
This educational application was developed as a Bachelor's thesis project in Computer Modeling. It demonstrates the practical application of computational techniques, symbolic mathematics, and interactive visualization to make complex economic and mathematical concepts accessible through hands-on experimentation.


