#include #include double f(double x); double df(double x); void NR(double x0, double tol, int max_itno); void plotfunction(double x0, double x1, int N); double min(double a,double b); double max(double a,double b); // Driver program int main() { // Initial values double x0 = -4; NR(x0,1e-16,100); plotfunction(-10, 10,1000); return 0; } // Prints root of func(x) with error of EPSILON void NR(double x0, double tol, int max_itno) { int i; double x,xx0,xx1, h; FILE *output; output = fopen("nr.dat", "w");//opening file. i=0; x=x0; xx0=1e16; xx1=-1e16; while (fabs(f(x)) >= tol&&i=b){ return b; } else return a; } double max(double a,double b) { if(a>=b){ return a; } else return b; }