A modular FastAPI + JavaScript frontend application that analyzes and visualizes multivariable functions. It computes critical points, classifies them using gradient & Hessian analysis, and generates 3D surface plots and 2D contour plots with gradient vectors — all accessible via clean REST endpoints. Built as part of my weekly computer science learning journey, this project focuses on calculus automation, backend architecture, and interactive data visualization.
This week’s focus:
- REST API Design — Structuring mathematical analysis endpoints in FastAPI
- Symbolic Computation — Using SymPy for gradient, Hessian, and critical point classification
- Data Visualization — Generating 3D and 2D plots with Matplotlib
- Frontend–Backend Integration — Connecting a static JS frontend to a Python API
- Testing & Validation — Using pytest to verify mathematical correctness
- Critical Point Analysis — Finds and classifies local minima, maxima, and saddle points
- Degenerate Hessian Handling — Higher‑order term checks for flat curvature cases
- 3D Surface Plotting — Interactive‑ready PNGs generated on the fly
- 2D Contour + Gradient Vectors — Visualizes function topology and direction of steepest ascent
- Multi‑Point Support — Handles functions with multiple distinct critical points
- Test Suite — Parametrized pytest cases for robust verification
- Python 3.12 — Backend runtime
- FastAPI — API framework
- SymPy — Symbolic math engine
- NumPy — Numerical computation
- Matplotlib — Plot generation
- Pytest — Automated testing
- Vanilla JS + HTML/CSS — Lightweight frontend
- Backend (backend/)
- math_utils.py — Gradient, Hessian, classification logic
- plot_utils.py — 3D surface & 2D contour plot generation
- main.py — FastAPI routes for /analyze and /plot
- CORS middleware for cross‑origin frontend requests
- Frontend (frontend/)
- index.html — UI layout
- script.js — Fetch calls to backend, DOM updates
- style.css — Basic styling
- Tests (backend/test_math_utils.py)
- Covers local min/max/saddle, degenerate Hessians, and multi‑point cases
This project is part of my ongoing exploration of computer science concepts. Each week, I pick a new topic or technology to dive into through hands‑on projects. This week: Symbolic math automation and visualization with FastAPI. Previous weeks have included:
- Backend API design with Node.js & Express
- Cloud deployment with Azure Functions
- SQL optimization and data modeling
- React Native gesture‑based UI development The goal is to continuously expand my CS knowledge through practical implementation.
- How to compute and classify critical points programmatically
- Handling degenerate Hessians with higher‑order analysis
- Generating and encoding plots for API delivery
- Structuring a Python backend for modularity and testability
- Connecting a static JS frontend to a Python API with CORS
This project is designed for educational purposes and learning about multivariable calculus automation. Always verify mathematical results before using them in critical applications.
Built with 💻 Python, FastAPI, and a passion for learning something new every week.