public class poly extends f_x
{// General polynomial function
 // y=a[0]+a[1]*x+a[2]*x^2+...
 public double a[];
 public f(double ia[])
 {int n=ia.length;
  a=new double[n];
  for(int i=0;i<n;i++) {a[i]=ia[i];}
 }
 public double func(double x)
 {
  int n=a.length;
  double ff=a[n-1];
  for(int i=n-2;i>=0;i--)
  {ff=ff*x+a[i];}
  return ff;
 } 
}
