def newton_raphson(f, df, x0, tol=1.0e-9):
    x = x0
    for i in range(30): # Max iterations
        fx = f(x)
        if abs(fx) < tol:
            return x
        dfx = df(x)
        if dfx == 0:
            raise ValueError("Zero derivative. No solution found.")
        x = x - fx/dfx
    raise ValueError("Method failed to converge")
f = lambda x: x**3 - 10*x**2 + 5
df = lambda x: 3*x**2 - 20*x
root = newton_raphson(f, df, 0.5)
print(f"Root found: root:.6f")

Theoretical Basis: Newton-Raphson Method. This requires the function $f(x)$ and its derivative $f'(x)$.

Before you search for a free PDF, understand the copyright status. The solutions manual for Kiusalaas’s book is copyrighted material intended for instructors, published by Cambridge University Press.

Theoretical Basis: Gaussian Elimination and LU Decomposition. Problem Type: Solving $Ax = b$.