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.*;
//newton-raphson search method
//optimisation
class ce2M
{ 	 public double r;	
	 public ce2M(double x1) 
	 {     
        f2D ff=new f2D();
        r= newton(ff,x1);
     }
     
public static double newton(f_x f,double x)
{
// root finding newton-raphson program

int nmax=500;
double tolerance=1.0e-10;
double fx,dfx;
for(int i=0;i<nmax;i++)
{
fx=f.dfunc(x,1);
dfx=f.dfunc(x,2);
x-=fx/dfx;
if(Math.abs(fx)<tolerance)
{ return x; }
}
return x;
}


}
