class elambda extends f_x
{
public double func(double lambda)
{//function t be solved
double eps=0;
if(lambda<2) eps=0.8;
else eps=0.2;
return eps;
}
}

public class isinim1
{
public static double emissivity(f_x f,double T)
{
double dlambda=1.0;
int N=20000;
double l1=dlambda*N;
double F1=F(l1*T);
double total=0;
for(int n=2;n<2000;n++)
{total+=f.func(n*dlambda)*(F(n*dlambda)-F((n-1)*dlambda));}
total/=F1;
return total;	
}

public static double F(double x)
{double C2=1.439e4; //mm/K
double ksi=C2/x;
double total=0;
for(int n=1;n<200;n++)
{total+=Math.exp(-n*ksi)/n*(ksi*ksi*ksi+3.0*ksi*ksi/n+6.0*ksi/(n*n)+6.0/(n*n*n));}
total*=15.0/(Math.PI*Math.PI*Math.PI*Math.PI);
return total;
}

public static double E(double l1,double l2,double T)
{ // T degreee K
 double sigma=5.67e-8; // W/m2K4
 double l1T=l1*T;
 double l2T=l2*T;
 double E1=sigma*T*T*T*T*(F(l2T)-F(l1T));
 return E1;
}

public static void main(String arg[])
{ double T=1000.0;
  double l1=4.6; //mikrometre
  double l2=8.5; //mikrometre
  elambda f=new elambda();
  System.out.println("F1="+F(l1*T)+" F2= "+F(l2*T)+"E="+E(l1,l2,T)+"emmissivity="+emissivity(f,T));
}

}