Implement Newton-Raphson method in R#196
Merged
siriak merged 4 commits intoTheAlgorithms:masterfrom Oct 11, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements the Newton-Raphson method for finding roots of equations in R. The implementation provides a numerical method that iteratively approximates roots using the function and its derivative.
Key changes:
- Adds a new Newton-Raphson algorithm implementation
- Includes standard numerical method parameters (tolerance, maximum iterations)
- Provides a clean, functional interface for root finding
Comments suppressed due to low confidence (1)
mathematics/newton_raphson_method.r:1
- The function lacks documentation explaining the algorithm, parameters, and return value. Add comments describing what the Newton-Raphson method does, the expected input parameters, and the output.
newtonRaphson <- function(f, fprime, x0, tol = 1e-6, max_iter = 100) {
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
siriak
previously approved these changes
Oct 11, 2025
siriak
approved these changes
Oct 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Newton-Raphson method is a powerful and relatively straightforward method for finding the roots of an equation. It has many advantages but suffers from several drawbacks such as a readily calculated derivative, inconsistencies when f′(x)=0 and so on.