import javax.swing.*;

class fb implements f_x
{ public double func(double x)
   { return x*x-5.0;}}
   
class fc implements f_x
{ public double func(double x)
   { return x*x*3-5.0*x+2;}}
      

public class H9Ex3d {

public static String toString(f_x f,String s,double x)
{ String s1="x ="+x+"\n derivative df/dx [s] = "+numerical.derivative(f,x)+"\n";
 return s1;
}
	
public static void main(String args[])
{  
    double x=1.0;
	String s=toString(new fb(),"x*x-5.0",x);
	x=2;	
	s+=toString(new fb(),"x*x-5.0",x);
	x=1;
	s+=toString(new fc(),"x*x*3-5.0x+2",x);
	x=2;
    s+=toString(new fb(),"x*x*3-5.0x+2",x);
    String s1="indirek fonksiyon adresi kullanma :";
    JOptionPane.showMessageDialog(null,s,s1,JOptionPane.PLAIN_MESSAGE);
}
}
