import javax.swing.*;
public class ifx_Ex2 {
public static void main(String args[])
{ class ff1 implements if_x
  {public double func(double x)
  {return 2.0/Math.sqrt(Math.PI)*Math.exp(-x*x);}
  }; 
 ff1 ff=new ff1();
 double x=1.0;
 String s="x ="+x+"\n derivative df/dx = "+ff.dfunc(x);
 double a=0;double b=0.1;
 s+="\n a="+a+"b="+b+" integral of f="+ff.integral(a,b);
 s+="\n a="+a+"b="+b+" adaptive simpson integral of f="+ff.adaptive_simpson_integral(a,b,1e-10);
 s+="\n a="+a+"b="+b+" adaptive simpson integral2 of f="+ff.adaptive_simpson_integral2(a,b);
 s+="\nroot of f="+ff.newton(1.0); 
 ff.Plot(0.0,6.0,400);
 String s1=" indirect referencing and interface example with inner class lambda definition:";
 JOptionPane.showMessageDialog(null,s,s1,JOptionPane.PLAIN_MESSAGE);
}}
