Please develop the function ScanForRoots to scan a given function f(x) for it’s roots using the newton’s algorithm.
The program should read the following input parameters from an input file. The file’s format is given as follows.
The program should search the root of a function with the starting position x_{0}. The starting position x_{0 }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.
In the project a reasonable interval should be selected to be able to check the quality of the developed software.
So the interface to ScanForRoots 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 x_{0} 
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.
Follow Us