The aim of this project was creating interactive visuals of difference models with ease.
Ensure you have the following:
- Python 3.7+
- pip
-
Clone the repository:
git clone https://github.com/dunarand/difference-equations-dash.git cd difference-equations-dash -
Install the required Python packages:
pip install -r requirements.txt
- Navigate to the project directory:
cd difference-equations-dash - Run the application:
python dash_app.py
- Open a web browser and go to
http://127.0.0.1:8050/.
A difference equation is a relation that describes the change in a variable over time. We use difference equations when the time variable is discrete as opposed to continuous in the case of differential equations. A difference equation is used to model a problem that features a discrete time change. For example, to model the remaining debt of a loan which has a certain percentage of interest per month, we use difference equations.
A difference equation can be stated as follows:
where
For example, a loan of $10,000 with a monthly interest of 1% and a payment of $110 can be modeled as follows:
-
Adding a sequence: Simply set the following parameters
-
$a_0$ : Initial value -
$r$ : Rate of change -
$b$ : Additive constant -
$n$ -Start: Starting index of the sequence -
$n$ -Stop: Ending index of the sequence All of the fields are optional and can be left blank or set to 0.
-
- Adding multiple sequences: To add multiple sequences to the graph, first set the parameters of the first sequence. Then, click the "New Sequence" button. Repeat this process for all the sequences you want to add.
-
Fixing parameters: Fix
$a_0$ , Fix$r$ , and Fix$b$ checkboxes are used to fix these values so that when adding multiple sequences, fixed parameters will not be reset after clicking new sequences button. - Equilibrium Lines: "Toggle Equilibrium Lines" button is used to toggle the visibility of the equilibrium lines on the graph.
- Current Sequence: "Toggle Current Sequence" button is used to toggle the visibility of the current sequence on the graph.
-
Graph Customization: The graph can be customized using the following fields:
- Graph Title (accepts LaTeX)
- X-axis Label (accepts LaTeX)
- Y-axis Label (accepts LaTeX)
- X-axis Limits: Starting and ending values for the x-axis
- Y-axis Limits: Starting and ending values for the y-axis
-
Interactive Graph: The plot is interactive. The following features are supported:
- Zooming
- Panning
- Hovering over points to display their values
- Selecting a region to highlight the values in that region
- Hiding selected plots
- Resetting the graph to its initial state
- Saving the graph as an image
- Reset Button: Reset button defaults all input fields and clears the graph.
This project is licensed under the MIT License - see the LICENSE file for details.
