/**********************************************************************************/
#include
#include
#include
#define NI 1000
FILE*arquivo;
double xn,xv;
double f,df;
double newton(double xv){
xn=xv-f/df;
}
main(void){
int n;
arquivo=fopen("root2.dat","w");
xv=1;
for(n=0;n<=NI;n++){
f=4*cos(xv)-exp(xv);
df=-4*sin(xv)-exp(xv);
newton(xv);
fprintf(arquivo,"%d %.10f \n", n,xn);
printf("%d %.10f \n", n,xn);
xv=xn;
}
fclose(arquivo);
}
/**********************************************************************************/