Wikipedia

Search results

06 October 2019

Newton Raphson method to solve roots of higher-degree equations

Roots of High-Degree Equations

Equations can be polynomials, radicals, trigonometric, logarithmic, and other.

Simplest example is the quadratic function. More complex equations will often require numerical methods to solve.


Newton Raphson Method algorithm:

- similar to Simple Iteration except it handles the equation as a function, not a rearrangement
- first step is to put the equation as a function
- second step is to calculate the first derivative of the function
- third step is to iterate as the simple iteration method

This method is an optimization of the simple iteration method.


for example:

'''
for equation:
x^3 - x^2 + 7 = 10
x^3 - x^2 - 3 = 0

derivative
3x^2 - 2x = 0

Newton Raphson equation:

y = x - (x^3 - x^2 - 3) / (3x^2 - 2x)

'''

x = 2 # initial guess, derive multiple roots with different guesses
for i in range(100):
y = x - (x^3 - x^2 - 3) / (3x^2 - 2x)
if x == y: # or within tolerable range
break
x = y

# y now approximates the value of the root





No comments:

Post a Comment