Code tool

Newton's Method Visualizer

Enter a supported function of x and a starting value to follow Newton iterations toward a root.

In-browser processingNo account requiredPrivacy details ↗

Allowed: x, numbers, pi, e, + − * / ^, parentheses, sin, cos, tan, exp, log, sqrt, abs. Example: cos(x) - x. No JavaScript is executed.

Convergence tolerance: |f(x)| ≤ 1e−10.

A QUICK WALKTHROUGH

How to use this tool

  1. Enter f(x), a finite starting value, and an iteration limit from 1 to 30.
  2. Run the iterations and inspect each function value, derivative, and next estimate.
  3. Use the diagram to see the curve, tangent steps, and any reported stopping condition.

A restricted expression language

Supported syntax: x, numbers (including scientific notation), pi, e, parentheses, + − * / ^, and sin, cos, tan, exp, log, sqrt, abs. Implicit multiplication is accepted (2x, 2(x+1)); function names require parentheses. This is parsed locally with explicit rules; arbitrary JavaScript is never executed.

Numerical derivative and stopping

The derivative is estimated with a scale-aware central difference. The run stops on convergence, a near-zero or non-finite derivative, a non-finite/diverging iterate, a detected cycle, or the iteration limit. Numerical results depend on the starting point and finite precision.

Local processing

The expression and all calculations stay in this browser. The chart is a visual aid with an automatically selected finite x-range; values outside the real domain are omitted.

GOOD TO KNOW

Common questions

Does Newton’s method always find a root?

No. It can diverge, cycle, encounter a zero derivative, or converge to a root that depends on the starting value.

Can I enter JavaScript or arbitrary functions?

No. Only the listed mathematical syntax and functions are accepted; the input is parsed and never passed to eval or Function.

Why is the derivative approximate?

This visualizer uses a central finite difference, so it is an estimate and can be sensitive near singularities or at extreme magnitudes.