Skip to content

Explore numerical methods implemented in PHP for solving equations and integrals. Enhance your understanding of numerical analysis techniques.

License

Notifications You must be signed in to change notification settings

rezasadid753/numphp

Repository files navigation

🧮 NumPHP: Numerical Analysis Toolkit

PHP Mathematics Education License

A high-visibility, step-by-step numerical methods engine built entirely in pure PHP.
Designed to make complex mathematical iterations transparent and easy to visualize.


🚀 The Backstory

Born during a deep dive into Numerical Analysis in my 3rd university semester, NumPHP was an experiment in defying the status quo. While Python and MATLAB are the standards, I wanted to prove that PHP—the language of the web—could handle complex mathematical iterations just as elegantly.

This toolkit doesn't just give you the answer; it shows you the journey of the algorithm, making it an ideal companion for students and educators.


✨ Features

  • 🔍 Granular Iterations: See every step of the calculation, from initial guess to final convergence.
  • 🌐 100% Web-Native: No external compilers or Python environments needed. Just a browser and a PHP server.
  • 🛠️ Framework-less: Light, fast, and dependency-free.
  • 📊 Comprehensive Toolkit: Includes methods for Root Finding, Linear Systems, and Numerical Integration.
  • 🎨 Responsive UI: Clean interface built with modern CSS and vanilla JS for real-time interaction.

🧪 Mathematical Methods

NumPHP covers the "Big Three" areas of numerical analysis:

Category Method Description
Root Finding Bisection Bracketing method based on the Intermediate Value Theorem.
Newton-Raphson High-speed convergence using derivatives.
Secant Root finding without requiring derivative functions.
False Position Linear interpolation to find roots.
Fixed-Point Iterative process finding $x$ where $f(x) = x$.
Linear Systems Jacobi Iterative algorithm for determining the solutions of a system of linear equations.
Integration Trapezoidal Approximating the definite integral by using trapezoids.
Simpson's Rule High-accuracy integration using parabolic arcs.

🧬 How the Engine Works

graph TD
    A[User Input] --> B(Method Selector)
    B --> C{Calculation Engine}
    C -->|Loop| D[Apply Formula]
    D --> E[Calculate Error]
    E -->|Tolerance Not Met| D
    E -->|Tolerance Met| F[Final Result]
    D --> G[Record Iteration Data]
    G --> H[Render Results Table]
    F --> H
    
    style C fill:#f9f,stroke:#333,stroke-width:2px
    style H fill:#bbf,stroke:#333,stroke-width:2px
Loading

🛠️ Getting Started

Installation

Since NumPHP is built with pure PHP, you only need a local server (like XAMPP or Nginx) to run it.

  1. Clone the Repository:

    git clone https://github.com/rezasadid753/numphp.git
    cd numphp
  2. Run: Move the folder to your web directory (htdocs or www) and access it via: http://localhost/numphp


📁 Directory Structure

NumPHP/
├── 📄 index.php                   # Entry point & Method Switcher
├── 📂 methods/                    # Mathematical Logic
│   ├── method-bisection.php
│   ├── method-jacobi.php
│   ├── method-newton-raphson.php
│   └── ... (and others)
├── 🎨 numerical-analysis.css      # Core Styles
└── ⚡ numerical-analysis.js       # UI Interactivity & Validation

🎯 Ideal Use Cases

  • University Students: Check your manual homework calculations against the step-by-step output.
  • CS Educators: Use as a visual demo during lectures to show how different methods converge at different rates.
  • Curious Devs: Learn how to implement mathematical formulas in a high-level language like PHP.

🤝 Contributing

Mathematical accuracy is the priority! If you find a bug in a formula or want to add a new method (like Gauss-Seidel or Runge-Kutta), feel free to:

  1. Fork the project.
  2. Submit a Pull Request.

📜 License

This project is open-source under the MIT License.


Built for the love of math and the power of PHP. 📐

Releases

No releases published

Packages

 
 
 

Contributors