How abdelhamid108/numerical-project works
Project type and purpose
• This is a C++ command-line numerical-analysis toolkit (not a web or distributed system).
• Its core is an EquationParser for parsing and evaluating mathematical expressions, plus a suite of numerical-methods modules (root finding, interpolation, integration, ODE stepping, polynomial fitting).
• The main.cpp file ties everything together into a single executable.
File structure
• Top level:
• .vscode (IDE config)
• README.md (EquationParser documentation)
• headers/ (public API headers for each module)
• src/ (implementation of each module)
• main.cpp (the CLI “driver”)
• main.exe (built executable)
• Notice one directory for headers, one for sources, and one entry-point file.
• Each numerical method lives in its own header+cpp pair: bisection, secant, integration, EulerMethods, LagrangeInterpolator, DividedDifferenceInterpolator, PolynomialFitter, plus parser.
README for additional insights
• The README focuses on the EquationParser class—its public API, tokenization, infix→postfix conversion, and evaluation.
• It does not describe the numerical algorithms in detail, but their existence in the headers/src makes clear they form separate modules that consume either the parser or raw numbers.
a. Main components:
1. CLI Interface (main.cpp)
2. EquationParser
• Tokenizer (splits input string into tokens)
• Infix→Postfix Converter
• Evaluator (postfix interpreter)
3. Numerical Methods Modules
• Root-finding: Bisection, Secant
• Integration
• ODE solver: EulerMethods
• Interpolation: LagrangeInterpolator, DividedDifferenceInterpolator
• PolynomialFitter
4. Data models: Token, AST node (implicit in parser), result data structures
5. Output/Console
b. Relationships & interactions:
• CLI → reads user input → passes equation (string) & parameters to EquationParser
• EquationParser → parses → converts to postfix → evaluates to produce a callable function f(x) or f(x,y)
• CLI → selects numerical method → passes f(x)/data to the chosen module
• Numerical module → computes results → returns numeric result or data array
• CLI → prints results to console
c. Architectural patterns & principles:
• Modular design: each algorithm is self-contained in its own header+cpp
• Single executable, no external services
• Separation of concerns: parsing/evaluation isolated from numerical methods
d. Key technologies:
• C++17 (or above), standard library
• No external dependencies
• Build system: presumably g++ or MSVC (main.exe present)
Elements
• Clear rectangular blocks for each component (CLI, Parser, Tokenizer, Converter, Evaluator, each numerical module).
• Input flow: User input → CLI
• Parsing flow: CLI → Tokenizer → Converter → Evaluator
• Computation flow: Evaluator → Numerical Method → Result
• Output flow: CLI → Console
• Numerical modules in another
• I/O in a third
• Annotations for key methods (e.g., EquationParser::parseEquation(), ::evaluate(), Bisection::findRoot()).