-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented Several Numerical Integration Algorithms in maths/
#25
Implemented Several Numerical Integration Algorithms in maths/
#25
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @SatinWukerORIG ,
Looking forward to your review 🙂
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great implementation!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks great. A lot of changes lol.
Although the contribution guideline suggests not using variable names like a, b, and i, it is understandable in this case because it is for math modules. Do you think it is more readable if you change these variable names to full name?
It depends 🙂 I have renamed them in the examples files, but left them shortened in the modules files as there are explainations in the |
maths/
This comment was marked as outdated.
This comment was marked as outdated.
Note PR is complemented with #32 |
Description:
This pull request introduces the implementation of several numerical integration methods for approximating definite integrals over a specified interval.
Definition:
The following numerical integration methods are included:
Trapezoidal Rule (
trapezoid.f90
):Approximates the integral by dividing the interval into trapezoids and summing their areas.
Simpson's Rule (
simpson.f90
):Approximates the integral by fitting parabolas to segments of the function and is typically more accurate than the Trapezoidal Rule
Midpoint Rule (
midpoint.f90
):Approximates the integral by evaluating the function at the midpoint of each subinterval.
Monte Carlo Integration (with OpenMP parallelization,
monte_carlo.f90
):A probabilistic method that estimates the integral by sampling random points in the interval and averaging the function values.
It utilizes the
omp_lib
with the!$omp parallel do
directive for parallel execution.Gaussian-Legendre Quadrature (using precomputed table values,
gauss_legendre.f90)
:A highly accurate method that approximates the integral using a weighted sum of function values at specified points (nodes) within the integration interval.
Implements Gauss-Legendre quadrature using precomputed nodes and weights for orders
n=1
throughn=5
.Implementation Details
Example Usage
Examples for each method are provided, demonstrating how to call the respective subroutines to approximate a definite integral of this sample function:
examples/../trapezoidal.f90
:examples/../simpson.f90
:examples/../midpoint.f90
:examples/../monte_carlo.f90
:examples/../gaussian_legendre.f90
:Reference
Numerical Recipes: The Art of Scientific Computing, 3rd Edition