Small Flask web app for a linear algebra class: enter a square matrix (A), an initial vector (v), and a number of steps (N). It applies the normalized map (v \mapsto Av / |Av|) repeatedly, then shows the last iterate (v_N), the dot product (v_N \cdot (Av_N)) (Rayleigh quotient when (|v_N|=1)), and the angle between (v_N) and (Av_N) in degrees.
- Python 3.9+ (3.8 may work; use a recent 3.x if unsure)
- pip (usually bundled with Python)
From this directory, create a virtual environment (recommended), install dependencies, then run the app.
macOS / Linux:
python3 -m venv .venv
source .venv/bin/activateWindows (Command Prompt):
python -m venv .venv
.venv\Scripts\activate.batWindows (PowerShell):
python -m venv .venv
.venv\Scripts\Activate.ps1pip install --upgrade pip
pip install -r requirements.txt(Alternatively: pip install flask numpy.)
python html-iterate.pyBy default the server listens on http://127.0.0.1:5000/ — open that URL in a browser. The script runs Flask with debug=True for local teaching use; turn debug off or use a production server if you ever expose the app on a network.
Press Ctrl+C in the terminal where it is running.
- Matrix (A): one row per line, comma-separated numbers (must be square).
- Initial vector (v): comma-separated entries; length must match the matrix size.
- (N): nonnegative integer number of iterations.
- Use Compute to run; Clear resets the form.
html-iterate.py— single-file app (routes, HTML template, and NumPy iteration logic).requirements.txt— dependencies forpip install -r requirements.txt.