MichaelYagi/Grapher

โ˜… 0Forks 0PythonGitHub โ†—Compare

README

Grapher - Mathematical Function Plotter

A web-based mathematical function plotting tool with Python backend and D3.js frontend.

โœจ Features

Backend (Python/FastAPI)

  • ๐Ÿงฎ Mathematical Expression Evaluation: Parse and evaluate complex mathematical expressions using NumPy and numexpr
  • ๐Ÿ”„ Multi-variable Support: Handle expressions with multiple parameters and variables
  • โšก High Performance: Vectorized computations with intelligent caching
  • ๐Ÿ›ก๏ธ Security: Safe expression parsing with protection against code injection
  • ๐Ÿ“Š REST API: Clean, documented API endpoints for frontend integration
  • ๐ŸŽฏ Comprehensive Function Support: Trigonometric, logarithmic, exponential, and polynomial functions

Frontend (JavaScript/D3.js)

  • ๐Ÿ“ˆ Interactive Graphing: Smooth, real-time graph rendering with D3.js
  • ๐Ÿ”„ Dual Range System:
    • Default Display: [-10, 10] for focused view
    • Full Computation: [-30, 30] for comprehensive data
    • Toggle Range: Instantly switch between zoomed and full views
  • ๐ŸŽ›๏ธ Real-time Parameter Updates: Interactive sliders for multi-variable expressions
  • ๐ŸŽจ Color-coded Interface: Consistent color scheme across UI and graphs
  • ๐Ÿ“ฑ Responsive Design: Works seamlessly on desktop and mobile devices
  • ๐Ÿ”„ Offline Mode: Limited functionality when backend is unavailable
  • ๐Ÿ“Š Multi-function Support: Plot and manage multiple functions simultaneously
  • ๐Ÿ’พ Export Functionality: Download graphs as PNG or SVG

๐Ÿš€ Quick Start (1 command!)

Linux/Mac:

./start.sh

Windows:

start.bat

That's it! The app will be running at http://localhost:3000

Alternatively:

\backend\src> python -m uvicorn main:app --host <private_ip> --port 3000

๐Ÿ“‹ What this command does:

  • Installs dependencies automatically (handles managed environments)
  • Starts server immediately
  • Works in any Python environment (Linux, Mac, Windows)

Note: If you see "externally-managed-environment" message, that's normal! The script handles it automatically.

If you want virtual environment (optional):

./quick-setup.sh  # Creates venv
./start_grapher.sh  # Uses venv

๐Ÿ“‹ What these commands do:

  1. ./setup.sh (or setup.bat on Windows):

    • Creates a Python virtual environment automatically
    • Installs all required dependencies
    • Creates startup scripts
    • Sets up configuration
  2. ./start_grapher.sh (or start_grapher.bat):

๐ŸŒ Access the Application

๐Ÿ“š Detailed Documentation

For Users:

  • Usage Guide - How to use the application, examples, features

For Developers:

๐Ÿงช Quick Test

# Run backend tests
cd backend && python -m pytest tests/ -v

# Run with coverage
cd backend && python -m pytest tests/ --cov=src

๐Ÿ“„ License

This project is licensed under MIT License.

Contributors

MichaelYagi

Issues