Third degree equation - Script

This JavaScript solves equation ax³+bx²+cx+d=0 in 10-6 accuracy using Newton method.
x³ + x² + x + = 0

The problem is the choice of initial values for the Newton-Raphson algorithm.

1qt derivative = 3ax² + 2bx + c, delta' = b²-3ac
2nd derivative = 6ax + 2b = 2(3ax + b)

The algorithm then calculates x[n+1] = x[n] - f(x[n])/f'(x[n]) until the Δx < 10-10
Results is then rounded at ± 0.5 10-6.

 

Home Arithmetic Geometric Misc Topics Scripts Games Exercices Mail Version Française Previous topic Next topic