The Newton-Raphson method finds a stationary point of a single-variable polynomial by iteratively improving an initial estimate x₀ using the recurrence: Each step moves in the direction that reduces |f′(x)| most sharply, using f″(x) as the local curvature to scale the correction. Convergence is quadratic near a true stationary point — the number of correct decimal places roughly doubles with each iteration — making it substantially faster than bisection for well-behaved smooth functions. In exchange it requires a starting point x₀ rather than a bracketing interval, and it can fail to converge if x₀ is far from the solution, if f″ is near zero, or if the function has inflection points in the neighbourhood.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/FabianeloV/Metodo-simplex/llms.txt
Use this file to discover all available pages before exploring further.
Comparison with Bisection
| Property | Bisection | Newton-Raphson |
|---|---|---|
| Inputs required | Interval [a, b] with sign change of f′ | Starting point x₀ |
| Convergence rate | Linear (halves interval each step) | Quadratic near solution |
| Requires f″ | No | Yes |
| Guaranteed to converge? | Yes, when bracketing holds | No — may diverge |
| Risk of divergence | None (within bracket) | Near inflection points or poor x₀ |
Endpoint
Request
Polynomial coefficients listed from highest to lowest degree (NumPy convention). Must contain between 1 and 11 elements; the list must not be identically zero.Example:
[-1, 0, 4, 0] encodes f(x) = −x³ + 4x.coefficients | f(x) |
|---|---|
[-1, 4, 0] | −x² + 4x |
[1, -6, 9, 0] | x³ − 6x² + 9x |
[1, 0, -5, 0] | x³ − 5x |
Optimization direction:
"max" or "min". The engine uses f″(x*) to classify the converged point and sets goal_satisfied accordingly.Initial guess for the iterative procedure. The choice of x₀ significantly affects which stationary point (if any) the method converges to. For multimodal functions, try different starting values to locate distinct optima.
Convergence criterion. Iteration stops when |f′(xₙ)| < tolerance or |xₙ₊₁ − xₙ| < tolerance. Must be in the range (0, 1].
Maximum number of Newton-Raphson steps. Must be between 1 and 500. If the method has not converged after this many steps,
status is set to "no_convergence".Response
Final status of the solver:
"optimal"— a stationary point was found within the tolerance and iteration limits."no_convergence"— the method did not converge withinmax_iterationssteps. The last iterate is still returned inoptimal_xfor inspection.
The x-coordinate of the stationary point found (or the last iterate when
status = "no_convergence").The function value f(optimal_x).
Classification of the stationary point using the second-derivative test on f″(x*):
"mínimo"— local minimum (f″ > 0)."máximo"— local maximum (f″ < 0)."punto de inflexión"— saddle or inflection point (f″ ≈ 0).
true when nature matches the requested goal (e.g. goal = "min" and nature = "mínimo").Number of Newton-Raphson steps actually performed.
Complete per-step trace of the iteration sequence.
Human-readable representation of f(x), e.g.
"-x² + 4x".Human-readable representation of f′(x), e.g.
"-2x + 4".Human-readable representation of f″(x), e.g.
"-2". This field is unique to the Newton-Raphson response and is not present in the Bisection response.Narrative summary of the result. Includes the converged point, its nature, whether the goal was matched, and actionable guidance when the method did not converge or found the wrong type of stationary point.
Example
Find the maximum of f(x) = −x² + 4x starting from x₀ = 1:For a pure quadratic like −x² + 4x, the Newton step from x₀ = 1 lands exactly on x = 2 after the first correction. However, convergence is only declared once the engine re-evaluates f′ at the new point and confirms |f′(xₙ)| < tolerance — so two iterations are recorded: the first produces x_next = 2.0, and the second confirms f′(2.0) = 0. For higher-degree polynomials, additional iterations are generally required.
Convergence Pitfalls
Saddle / inflection points. When f″(x*) ≈ 0 at the converged point,
nature is "punto de inflexión" and goal_satisfied will be false. The method has found a stationary point, but the second-derivative test is inconclusive — neither a minimum nor a maximum is confirmed.Wrong type of stationary point. Newton-Raphson converges to the nearest stationary point of f′, which might be a minimum when you requested a maximum. In this case
status is still "optimal" but goal_satisfied is false. Try a starting point x₀ on the other side of the function’s inflection point to target the desired extremum type.