Skip to content

Latest commit

 

History

58 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

compMath: C++ Numerical Methods Library

A header-based C++ library for core computational mathematics: differentiation, integration, interpolation, and solving differential equations. Designed for clarity, extensibility, and practical use in scientific and engineering projects.


Features

  • Differentiation: Numerical derivatives (first, second, etc.)
  • Integration: Definite integrals using various quadrature rules
  • Interpolation: Lagrange and Newton polynomial interpolation
  • ODE Solvers: Euler, Trapezoidal, and Runge-Kutta methods for systems
  • Norms: Vector norms for error analysis
  • Data Export: Simple CSV export for results
  • Unit Tests: GoogleTest-based test suite
  • Doxygen Documentation

Getting Started

Prerequisites

  • C++17 or newer
  • CMake 3.25+
  • A modern C++ compiler (GCC, Clang, MSVC)
  • GoogleTest (automatically fetched for tests)

Build Instructions

# Clone the repository
$ git clone https://github.com/canne16/comp_math.git
$ cd comp_math/Cpp/compmath

# Create a build directory
$ mkdir build && cd build

# Configure the project
$ cmake .. -DCMAKE_BUILD_TYPE=Release

# Build the library and tests
$ make

Running Tests

# From the build directory
$ ctest --output-on-failure

Or run a specific test:

$ ./runInterpolationTests

Usage Example

#include "differentiation.hh"
#include <iostream>

int main() {
    auto f = [](double x) { return std::sin(x); };
    double df = compmath::differentiate(f, 1.0, 1e-5);
    std::cout << "f'(1.0) ≈ " << df << std::endl;
    return 0;
}

Documentation

Doxygen documentation is generated in Cpp/compmath/docs/html after building:

  • Open Cpp/compmath/docs/html/index.html in your browser.
  • Browse API docs, examples, and module overviews.

To regenerate docs:

$ cd Cpp/compmath
$ doxygen Doxyfile

Contributing

Contributions are welcome! To propose a change:

  1. Fork the repository
  2. Create a feature branch (git checkout -b my-feature)
  3. Make your changes (with tests if possible)
  4. Run the test suite (ctest)
  5. Open a pull request with a clear description

Please follow the existing code style and document new functions with Doxygen comments.


License

This project is licensed under the MIT License. See LICENSE for details.


Acknowledgements


For questions or suggestions, feel free to open an issue.

About

Computational math practise

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages