Skip to content

Commit

Permalink
Merge branch 'feature/numerical_integration'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramy-Badr-Ahmed committed Sep 28, 2024
2 parents 9b14480 + e281889 commit 711ff42
Show file tree
Hide file tree
Showing 25 changed files with 199 additions and 15 deletions.
8 changes: 8 additions & 0 deletions examples/maths/numerical_integration/gaussian_legendre.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
!> Example Program for Gaussian-Legendre Quadrature Module
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #25
!! https://github.com/TheAlgorithms/Fortran/pull/25
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program demonstrates the use of Gaussian-Legendre Quadrature Module for numerical integration.
!!
!! It sets the integration limits and the number of quadrature points (n), and calls the
Expand Down
8 changes: 8 additions & 0 deletions examples/maths/numerical_integration/midpoint.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
!> Example Program for Midpoint Rule
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #25
!! https://github.com/TheAlgorithms/Fortran/pull/25
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program demonstrates the use of Midpoint Rule for numerical integration.
!!
!! It sets the integration limits and number of subintervals (panels), and calls the
Expand Down
8 changes: 8 additions & 0 deletions examples/maths/numerical_integration/monte_carlo.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
!> Example Program for Monte Carlo Integration
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #25
!! https://github.com/TheAlgorithms/Fortran/pull/25
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program demonstrates the use of Monte Carlo module for numerical integration.
!!
!! It sets the integration limits and number of random samples, and calls the
Expand Down
8 changes: 8 additions & 0 deletions examples/maths/numerical_integration/simpson.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
!> Example Program for Simpson's Rule
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #25
!! https://github.com/TheAlgorithms/Fortran/pull/25
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program demonstrates the use of Simpson's rule for numerical integration.
!!
!! It sets the integration limits and number of panels, and calls the
Expand Down
7 changes: 7 additions & 0 deletions examples/maths/numerical_integration/trapezoid.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
!> Example Program for Trapezoidal Rule
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #25
!! https://github.com/TheAlgorithms/Fortran/pull/25
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program demonstrates the use of the Trapezoidal rule for numerical integration.
!!
!! It sets the integration limits and number of panels, and calls the
Expand Down
9 changes: 8 additions & 1 deletion examples/sorts/example_usage_gnome_sort.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
!> Test program for the Gnome Sort algorithm

!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #09
!! https://github.com/TheAlgorithms/Fortran/pull/9
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program demonstrates the use of the gnome_sort_module by sorting an array of integers.

program test_gnome_sort
Expand Down
7 changes: 7 additions & 0 deletions examples/sorts/example_usage_heap_sort.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
!> Example program for the Heap Sort algorithm
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #8
!! https://github.com/TheAlgorithms/Fortran/pull/8
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program demonstrates the use of the heap_sort_module by sorting an array of integers.

program test_heap_sort
Expand Down
9 changes: 8 additions & 1 deletion examples/sorts/example_usage_merge_sort.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
!> Test program for the Merge Sort algorithm

!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #7
!! https://github.com/TheAlgorithms/Fortran/pull/7
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program demonstrates the use of the merge_sort_module by sorting an array of integers.

program test_merge_sort
Expand Down
8 changes: 8 additions & 0 deletions examples/sorts/example_usage_quick_sort.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
!> Example program for the Quick Sort algorithm
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #10
!! https://github.com/TheAlgorithms/Fortran/pull/10
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program demonstrates the use of the quick_sort_module by sorting an array of integers.

program test_quick_sort
Expand Down
9 changes: 8 additions & 1 deletion examples/sorts/example_usage_radix_sort.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
!> Test program for the Radix Sort algorithm

!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #11
!! https://github.com/TheAlgorithms/Fortran/pull/11
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program demonstrates the use of the radix_sort_module by sorting an array of integers.
!! The base parameter affects the internal digit processing but does not change the final sorted order
!! of decimal integers. The output is always in decimal form.
Expand Down
7 changes: 7 additions & 0 deletions modules/maths/numerical_integration/gaussian_legendre.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
!!
!! This module provides the implementation of Gaussian-Legendre Quadrature.
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #25
!! https://github.com/TheAlgorithms/Fortran/pull/25
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! The method approximates the definite integral of a function over a specified interval [a, b].
!!
!! The quadrature method works by transforming nodes and weights from the reference interval [-1, 1] to the
Expand Down
7 changes: 7 additions & 0 deletions modules/maths/numerical_integration/midpoint.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
!!
!! This module implements Midpoint rule for numerical integration.
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #25
!! https://github.com/TheAlgorithms/Fortran/pull/25
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! The midpoint rule approximates the integral by calculating the function
!! value at the midpoint of each subinterval and summing these values, multiplied
!! by the width of the subintervals.
Expand Down
7 changes: 7 additions & 0 deletions modules/maths/numerical_integration/monte_carlo.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
!! This module estimates the integral of a function over a specified range
!! using the Monte Carlo method (with OpenMP parallelization) and provides an error estimate.
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #25
!! https://github.com/TheAlgorithms/Fortran/pull/25
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! The method works by randomly sampling points within the integration range [a, b]
!! and evaluating the function at those points to estimate the integral.
!!
Expand Down
7 changes: 7 additions & 0 deletions modules/maths/numerical_integration/simpson.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
!!
!! This module implements Simpson's rule for numerical integration.
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #25
!! https://github.com/TheAlgorithms/Fortran/pull/25
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! Simpson's rule approximates the definite integral of a function by
!! dividing the area under the curve into parabolic segments and summing
!! their areas, providing a higher degree of accuracy than the Trapezoidal rule.
Expand Down
7 changes: 7 additions & 0 deletions modules/maths/numerical_integration/trapezoid.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
!!
!! This module implements the Trapezoidal rule for numerical integration.
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #25
!! https://github.com/TheAlgorithms/Fortran/pull/25
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! The Trapezoidal rule approximates the definite integral of a function by
!! dividing the area under the curve into trapezoids and summing their areas.
!!
Expand Down
12 changes: 10 additions & 2 deletions modules/sorts/gnome_sort.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
!> Gnome Sort Algorithm

!> This module implements the Gnome Sort algorithm.
!!
!! This module implements the Gnome Sort algorithm.
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #09
!! https://github.com/TheAlgorithms/Fortran/pull/9
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! Gnome Sort is a simple comparison-based sorting algorithm.
!! It iterates through the array, comparing and swapping elements if needed.
Expand All @@ -12,6 +19,7 @@
!!
!! Output:
!! - A sorted array of integers.
!!
module gnome_sort_module
implicit none

Expand Down
12 changes: 10 additions & 2 deletions modules/sorts/heap_sort.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
!> ## Heap Sort Algorithm
!>
!> Heap Sort Algorithm
!!
!! This module implements the Heap Sort algorithm.
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #8
!! https://github.com/TheAlgorithms/Fortran/pull/8
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! Heap Sort is a comparison-based sorting algorithm that uses a binary heap data structure.
!! It first builds a max heap from the input data and then repeatedly extracts the maximum
!! element from the heap and reconstructs the heap until the array is sorted.
Expand All @@ -13,6 +20,7 @@
!!
!! Output:
!! - A sorted array of integers.
!!
module heap_sort_module
implicit none

Expand Down
9 changes: 8 additions & 1 deletion modules/sorts/merge_sort.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
!> Merge Sort Algorithm
!!
!> This module implements the Merge Sort algorithm.
!! This module implements the Merge Sort algorithm.
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #7
!! https://github.com/TheAlgorithms/Fortran/pull/7
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! Merge Sort is a divide-and-conquer algorithm. It divides the input array into two halves, recursively sorts them,
!! and then merges the two sorted halves.
Expand Down
8 changes: 8 additions & 0 deletions modules/sorts/quick_sort.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
!> Quick Sort Algorithm
!!
!! This module implements the Quick Sort algorithm, a highly efficient
!! sorting technique that uses the divide-and-conquer strategy.
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #10
!! https://github.com/TheAlgorithms/Fortran/pull/10
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! Quick Sort works by selecting a pivot element and partitioning the
!! array into elements less than the pivot and elements greater than the pivot.
!!
Expand Down
12 changes: 10 additions & 2 deletions modules/sorts/radix_sort.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
!> Radix Sort Algorithm

!> This module implements the Radix Sort algorithm with configurable base.
!!
!! This module implements the Radix Sort algorithm with configurable base.
!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #11
!! https://github.com/TheAlgorithms/Fortran/pull/11
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! Radix Sort is a non-comparison-based sorting algorithm that sorts numbers by processing individual digits.
!! It is particularly efficient for sorting large lists of integers with a fixed number of digits.
Expand All @@ -13,6 +20,7 @@
!!
!! Output:
!! - A sorted array of integers.
!!
module radix_sort_module
implicit none

Expand Down
9 changes: 8 additions & 1 deletion tests/sorts/tests_gnome_sort.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
!> Test program for the Gnome Sort algorithm

!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #09
!! https://github.com/TheAlgorithms/Fortran/pull/9
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program provides additional test cases to validate the gnome_sort_module.

program tests_gnome_sort
Expand Down
9 changes: 8 additions & 1 deletion tests/sorts/tests_heap_sort.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
!> Test program for the Heap Sort algorithm

!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #8
!! https://github.com/TheAlgorithms/Fortran/pull/8
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program provides additional test cases to validate the heap_sort_module.

program tests_heap_sort
Expand Down
9 changes: 8 additions & 1 deletion tests/sorts/tests_merge_sort.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
!> Test program for the Merge Sort algorithm

!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #7
!! https://github.com/TheAlgorithms/Fortran/pull/7
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program provides additional test cases to validate the merge_sort_module.

program tests_merge_sort
Expand Down
9 changes: 8 additions & 1 deletion tests/sorts/tests_quick_sort.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
!> Test program for the Quick Sort algorithm

!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #10
!! https://github.com/TheAlgorithms/Fortran/pull/10
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program provides additional test cases to validate the quick_sort_module.

program tests_quick_sort
Expand Down
9 changes: 8 additions & 1 deletion tests/sorts/tests_radix_sort.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
!> Test program for the Radix Sort algorithm

!!
!! Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed)
!! in Pull Request: #11
!! https://github.com/TheAlgorithms/Fortran/pull/11
!!
!! Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request
!! addressing bugs/corrections to this file. Thank you!
!!
!! This program provides additional test cases to validate the radix_sort_module.
!! The radix (base) parameter affects the internal digit processing for sorting, but the final output is always in decimal form.

Expand Down

0 comments on commit 711ff42

Please sign in to comment.