This project contains C++ implementations of a variety of classic and modern numerical techniques, applied to physical problems encountered in laboratory courses and practical assignments. The codebase is designed with clarity, scalability, and reproducibility in mind
These laboratory works showcase algorithms for solving core computational physics problems. The implementations are modular and leverage clean C++ patterns to facilitate study, reuse, and extension for new problems
numerical-methods-in-physics/
├── images/ # Necessary graphs
├── include/ # Public headers for numerical modules and solvers
├── reports/ # Markdown lab reports and practical results
├── src/Labs # Source files (lab tasks implementations)
├── CMakeLists.txt # Build configuration (CMake)
├── vcpkg.json # Dependency manifest
├── README.md # Project overview and instructions
├── LICENSE # MIT License
├── .gitignore # Git ignore rules
Demonstrates solving tridiagonal and arbitrary systems using direct and iterative methods (e.g., Thomas algorithm, Jacobi, Gauss-Seidel), with application to real modeling tasks
Contains implementations of the bisection (dichotomy), Newton, and simple iteration methods for solving non-linear equations. Demonstrates convergence efficiency and robustness on real physical functions
Features various quadrature methods (rectangular, trapezoidal, Simpson's), with error analysis and comparisons on benchmark test cases
Includes explicit and implicit schemes for ODEs, such as Euler, improved Euler and Runge-Kutta methods, tested on classical physical systems (oscillator, decay, etc.)
Presents approaches for numerically solving ordinary differential equations with boundary conditions, including finite difference schemes, shooting methods, and matrix formulations. Analysis includes stability, convergence on heat conduction and physical diffusion models
Demonstrates numerical solution of linear Fredholm and Volterra integral equations of the second kind using quadrature-based methods (trapezoidal rule, Simpson’s rule, Gauss–Christoffel formulas) and piecewise-linear approximation of the unknown function on a grid, with analysis of how the choice of quadrature and mesh size affects accuracy, stability, and error propagation in test problems
Studies numerical solution of 1D heat‑conduction boundary‑value problems using finite‑difference schemes on uniform space–time grids. Implements explicit, implicit, and weighted (θ‑method) schemes for the heat equation with various boundary conditions, and compares temperature profiles and error behaviour for different time and space steps to analyse stability limits, numerical diffusion, and the influence of the weighting parameter on accuracy
Demonstrates numerical solution of the 1D linear convection equation with prescribed and periodic boundary conditions using explicit and implicit finite‑difference schemes of first and second order (FTCS, first‑ and second‑order upwind, Lax–Wendroff, MacCormack, Richtmyer, BTCS). Compares numerical and exact solutions and visualizes the maximum error in time to study how the Courant number, stencil choice, and approximation order affect stability, numerical diffusion, dispersion, and long‑time error growth
Demonstrates numerical solution of the 1D wave equation with source term and given initial and boundary conditions using finite‑difference methods on uniform space–time grids. Implements the explicit second‑order “cross” scheme and a weighted scheme, and compares their stability and accuracy by varying time and space steps, visualizing wave propagation, reflection from boundaries, and analysing how the choice of weights affects numerical dispersion and error growth
- C++17 compatible compiler (GCC, Clang, MSVC)
- CMake 3.14 or newer
- matplot++ development files
- Eigen library (header-only, managed via CMake or package manager)
To build the code, standard CMake workflows are recommended:
git clone https://github.com/Krasnovvvvv/numerical-methods-in-physics.git
cd numerical-methods-in-physics
mkdir build && cd build
cmake ..
make
./lab_executableAll completed laboratory reports (including results, and code descriptions) can be found here:
| 📝 Report | Link |
|---|---|
| Systems of Linear Algebraic Equations 📄 | Read |
| Root Finding Algorithms 📄 | Read |
| Integrating Algorithms 📄 | Read |
| Solving ODEs Algorithms 📄 | Read |
| Solving Rigid ODEs Algorithms 📄 | Read |
| Boundary Value Problems for ODEs 📄 | Read |
| Solving Integral Equations 📄 | Read |
| Solving 1D Heat Equation 📄 | Read |
| Solving Convection Equations 📄 | Read |
| Solving 1D Wave Equation 📄 | Read |
- matplot++ — a high-quality C++ plotting library for scientific visualization
- Eigen — a fast, versatile C++ library for linear algebra and matrix operations
These dependencies are automatically handled via CMake (assuming installed on your system or via package managers like vcpkg)
Contributions, bug reports, and feature requests are welcome!
Please open issues or pull requests on the GitHub repository