import java.io.*;
import javax.swing.*;
import javax.tools.*;
import java.util.*;
import java.lang.Integer;
import java.awt.*;
import java.awt.event.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.swing.*;
import java.util.Locale;
import java.text.*;
import java.util.*;
import javax.swing.table.*;

class ce2C5
{ 	 public double r;	
	 public ce2C5(double x1) 
	 {     
        f2D ff=new f2D();
        r= hasan47a(ff,x1);
     }
     
public static double hasan47a(f_x f,double x)
{ // third order
int nmax=500;
double tolerance=1.0e-8;
double fx,dfx;
double x1=0,dfx1=0;
for(int i=0;i<nmax;i++)
{  fx=f.func(x);
   dfx=f.dfunc(x);
   x1=x-fx/(2.0*dfx);
   dfx1=f.dfunc(x1);
   x-=fx/dfx1;
  if(Math.abs(fx)<tolerance) { return x;}
}
JOptionPane.showMessageDialog(null,"Maximum number of iteration is exceeded in hasan47a Method\n"+
   " results may not be valid","MAXIMUM ITERATION WARNING",JOptionPane.WARNING_MESSAGE);
return x;
}


}
