-
-
Notifications
You must be signed in to change notification settings - Fork 342
Add- simpson's rule #246
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
Add- simpson's rule #246
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.
Pull Request Overview
This PR adds an implementation of Simpson's Rule for numerical integration in R, providing both a standard and vectorized approach to approximate definite integrals using quadratic polynomial interpolation.
Key Changes:
- Implements
simpson_rule()function with input validation and error handling - Adds a vectorized version
simpson_rule_vectorized()for improved performance - Provides comprehensive examples demonstrating convergence, accuracy, and various use cases
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
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.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Co-authored-by: Copilot <[email protected]>
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.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
|
@siriak please have a look |
siriak
left a comment
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.
Looks good, thanks!
PR: Simpson’s Rule for Numerical Integration in R
This PR introduces a fully documented implementation of Simpson’s Rule in R, a numerical integration technique that approximates the definite integral of a function using quadratic polynomials.
Simpson’s Rule provides higher accuracy than the Trapezoidal Rule by approximating the area under the curve with parabolic arcs rather than straight line segments.
Overview
The
simpson_rulefunction divides the integration interval ([a, b]) into an even number of subintervals and applies quadratic interpolation to estimate the integral.Key features include:
sin(x),x²,e^x, and probability density functionsSimpson’s Rule is widely used in applications such as:
Complexity