## The function ScanForRoots to scan a given function f(x) for it’s roots using the newton’s algorithm.

### engineering

##### Description

Project 1 Please develop the function ScanForRoots to scan a given function f(x) for it’s roots using the newton’s algorithm. The Interface The program should read the following input parameters from an input file. The file’s format is given as follows. 1 [max number of roots to find] 2 [lower bound: lb] [upper bound: up] [step width: sw] 3 [precision eps] [step width h] [max iteration: ix] The program should search the root of a function with the starting position x0. The starting position x0 should be taken from the interval which is described by the parameters ub, lb and sw read from the input file. The found roots of the function should be saved in an dynamical array, which should be a parameter of the function ScanForRoots The size of the array should be set by a parameter, which is read from the input file. An example data file is given below. 1 10 2 -10. +10. 0.1 3 1.e-7 0.01 100 In the project a reasonable interval should be selected to be able to check the quality of the developed software. The Function ScanForRoots So the interface to Scan For Roots is the following. integer function ScanForRouts(f,lb,ub,sw,eps,h,maxit,roots) Parameter Type Comment f function function to analyse lb real(8) lower bound of search interval ub real(8) upper bound of search interval sw real(8) step width for the starting position x0 eps real(8) precision for the newton algorithm maxit integer maximal number of iteration for one root search roots real(8) one indexed array for the found roots The return value of ScanForRoots should give the number of found roots. The roots should not be stored multiple. The main program which should call ScanForRoots should do the following. • open, read and close the input file ScanForRoots.inp. • call ScanForRoots1 to search for the function’s roots. • write a little report which gives a list of the found roots