Newton raphson way
The Newton-Raphson method is a root-finding algorithm that uses the idea of approximating a function with a tangent line to iteratively refine an estimate of a root. Starting with an initial guess, the method repeatedly applies a formula to get successively better approximations until a desired level of accuracy is reached.
Proof:
The method is based on the Taylor series expansion of a function f(x) around a point x₀. Truncating the series after the linear term, we get:
f(x) ≈ f(x₀) + f'(x₀)(x - x₀)
We want to find the root, so we set f(x) = 0 and solve for x (which we'll call x₁ for the next approximation):
0 = f(x₀) + f'(x₀)(x₁ - x₀)
Rearranging the equation, we get the Newton-Raphson formula:
x₁ = x₀ - f(x₀) / f'(x₀)
Formula:
The general formula for the Newton-Raphson method is:
xᵢ₊₁ = xᵢ - f(xᵢ) / f'(xᵢ)
where:
xᵢ is the current approximation of the root.
xᵢ₊₁ is the next, improved approximation.
f(xᵢ) is the value of the function at xᵢ.
f'(xᵢ) is the value of the first derivative of the function at xᵢ.
Example:
The Newton-Raphson method is a root-finding algorithm that uses the idea of approximating a function with a tangent line to iteratively refine an estimate of a root. Starting with an initial guess, the method repeatedly applies a formula to get successively better approximations until a desired level of accuracy is reached. [1, 2]
Proof:
The method is based on the Taylor series expansion of a function f(x) around a point x₀. Truncating the series after the linear term, we get: [2, 3, 4]
f(x) ≈ f(x₀) + f'(x₀)(x - x₀) [2, 3, 4]
We want to find the root, so we set f(x) = 0 and solve for x (which we'll call x₁ for the next approximation): [2, 3, 4, 4]
0 = f(x₀) + f'(x₀)(x₁ - x₀) [3, 4]
Rearranging the equation, we get the Newton-Raphson formula:
x₁ = x₀ - f(x₀) / f'(x₀) [3, 4]
Formula:
The general formula for the Newton-Raphson method is:
xᵢ₊₁ = xᵢ - f(xᵢ) / f'(xᵢ) [3, 5]
where:
• xᵢ is the current approximation of the root. • xᵢ₊₁ is the next, improved approximation. • f(xᵢ) is the value of the function at xᵢ. • f'(xᵢ) is the value of the first derivative of the function at xᵢ. [3, 3, 4, 4, 5, 5]
Example: Let's find the root of f(x) = x² - 2 (which is √2). [2, 3, 3, 5, 5, 6, 7]
1. Choose an initial guess: Let's start with x₀ = 1. 2. Calculate the derivative: f'(x) = 2x 3. First iteration: • f(x₀) = f(1) = 1² - 2 = -1 • f'(x₀) = f'(1) = 2 * 1 = 2 • x₁ = 1 - (-1 / 2) = 1.5
4. Second iteration: • f(x₁) = f(1.5) = 1.5² - 2 = 0.25 • f'(x₁) = f'(1.5) = 2 * 1.5 = 3 • x₂ = 1.5 - (0.25 / 3) = 1.41666...
5. Third iteration: • f(x₂) = f(1.41666...) ≈ -0.0069 • f'(x₂) = f'(1.41666...) ≈ 2.8333 • x₃ = 1.41666... - (-0.0069 / 2.8333) ≈ 1.414215
After a few iterations, we get a value very close to √2 ≈ 1.414213. [3, 5] Convergence: The Newton-Raphson method is known to converge quadratically, meaning the number of correct digits roughly doubles with each iteration, provided the initial guess is close enough to the root and the function satisfies certain conditions (e.g., the derivative is non-zero at the root). However, it can also diverge or converge to a different root if the initial guess is not well-chosen.