Welcome to the Numerical Methods repository! This project includes implementations of various numerical methods in both C++ and Python. The Python implementations are designed to mimic C++ conventions to help C++ coders transition smoothly to Python.
A basic iterative approach for solving equations.
A numerical technique for finding successively better approximations to the roots of a real-valued function.
A root-finding method that repeatedly bisects an interval and then selects a subinterval in which a root must lie for further processing.
- Forward Finite Differences: Approximates the derivative of a function using forward differences.
- Central Finite Differences: Approximates the derivative using central differences.
- Backward Finite Differences: Approximates the derivative using backward differences.
- Trapezoidal Rule: Approximates the integral of a function using trapezoids.
- Simpson's 1/3 Rule: Approximates the integral of a function using parabolic segments.
- Simpson's 3/8 Rule: A variation of Simpson's rule using cubic polynomials.
- Simpson's 1/3 Double Integration Rule: Extends Simpson's 1/3 rule to double integrals.
- Linear Interpolation: Estimates unknown values by assuming a linear relationship between known values.
- Lagrange's Interpolation: Provides a polynomial interpolation through a set of data points.
- Newton's Method: Provides an interpolating polynomial in Newton form.
To use the C++ and Python implementations, you'll need to have the appropriate compilers or interpreters installed:
- Install a C++ compiler (e.g.,
g++
orclang++
).
- Ensure you have Python 3.x installed. You can download it from python.org.
To compile and run the C++ code, navigate to the C++ source directory and use the following commands:
g++ -o method_name method_name.cpp
./method_name
You can use an online compiler such as Programiz to compile and run your C++ code directly in the browser.
To run the Python code, navigate to the Python source directory and use the following command:
python method_name.py
-
Google Colab: Use Google Colab to run your Python code in a cloud-based environment.
-
JupyterLite: Try JupyterLite (to try without login) for an online Jupyter notebook experience without needing to log in.
These platforms provide suitable environments for Python and are generally better than other online interpreters available.