import static java.lang.Math.*;

abstract public class f_x extends Mathd
{
  // single function single independent variable
  // example f=x*x
  public double a[];

   public f_x(double ai[])
   {setA(ai);}
   
   public f_x()
   { double ai[]=new double[0];
	 setA(ai);
   }
   
  public void setA(double ai[])
  {int n=ai.length;
   a=new double[n];
   for(int i=0;i<n;i++)
   {a[i]=ai[i];}
  }
  abstract public double func(double x);
  public double dfunc(double x)
  {  double dx=1.0e-2;
	  return (-func(x+2.0*dx)+8.0*func(x+dx)-8.0*func(x-dx)+func(x-2.0*dx))/(12.0*dx);
  }
}