Newton-Raphson Root Finding for Engineers
🔖
Solving Non-Linear Engineering Equations
Many governing equations—such as the Colebrook-White pipe friction formula or non-linear spring equilibrium—cannot be isolated algebraically. The Newton-Raphson method iteratively refines a root estimate $x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}$.
Example
# Solve f(x) = x^3 + 2x - 20 = 0 using Newton-Raphson
def f(x):
return x**3 + 2*x - 20
def df(x):
return 3*(x**2) + 2
x = 2.0
for iteration in range(1, 6):
x = x - f(x) / df(x)
print(f"Iteration {iteration}: x = {x:.6f}, residual f(x) = {f(x):.2e}")