Tip 93. Trace of a cycle with help of taken up array

Fig. 93. Search of the equations root

The function with the name Root is showed and tested in the fig. 93. It returns the root of the algebraic equation using the Newton method (tangent method).

Fig. 93a. Trace of a cycle with help of taken up array

In the fig. 93 the same program is rewrote so when you call it all history of search the root is visible: the counter of the cycle n is added, but the second of the loop body is changed to the assignment operator of the value to n-th element of the vector V, which the history of search the root keeps x and y(x). Apart from the current values of the argument and the analyzable function either number of approximation step or the message thats enough (if the condition of loop termination is executed: y(x) ≈ 0) is written in the vector V.