Skip to content

dkrashen/matrix-iterator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Normalized matrix iteration (demo)

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.

Requirements

  • Python 3.9+ (3.8 may work; use a recent 3.x if unsure)
  • pip (usually bundled with Python)

Installation

From this directory, create a virtual environment (recommended), install dependencies, then run the app.

1. Create and activate a virtual environment

macOS / Linux:

python3 -m venv .venv
source .venv/bin/activate

Windows (Command Prompt):

python -m venv .venv
.venv\Scripts\activate.bat

Windows (PowerShell):

python -m venv .venv
.venv\Scripts\Activate.ps1

2. Install Python packages

pip install --upgrade pip
pip install -r requirements.txt

(Alternatively: pip install flask numpy.)

3. Run the demo

python html-iterate.py

By 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.

Stop the server

Press Ctrl+C in the terminal where it is running.

Usage (quick)

  • 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.

Files

  • html-iterate.py — single-file app (routes, HTML template, and NumPy iteration logic).
  • requirements.txt — dependencies for pip install -r requirements.txt.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages