import java.rmi.RemoteException;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class HTrectangle extends f_xj
{
double L,W,T1,T2;
public HTrectangle(double Li,double Wi,double T1i,double T2i)
{L=Li;W=Wi;T1=T1i;T2=T2i;}
public double func(double x[])
{ double C=0;
int plusminus=1;
double teta=0;
for(int n=1;n<100;n++)
{C=2.0*(plusminus+1)/(Math.PI*n*Math.sinh(n*Math.PI*W/L));
 plusminus*=-1;
 teta+=C*Math.sin(n*Math.PI*x[0]/L)*Math.sinh(n*Math.PI*x[1]/L);
}
return teta*(T2-T1)+T1;
}}
public class HT_rectangular1
{ public static void main(String arg[]) 
 {
 double W=1.0;
 double L=1.0;
 double k=50.0;
 double T1=20;//derece C
 double T2=100;
 double dfx,dfy;
 double qx,qy;
 HTrectangle f=new HTrectangle(W,L,T1,T2);
 double teta[][]=new double[21][21];
 double q[][]=new double[21][21];
 double x[]=new double[2];
 for(int i=0;i<=20;i++)
 {for(int j=0;j<=20;j++)
   {  double x1[]={0.05*i,0.05*j};
      x=x1;
	  teta[i][j]=f.func(x);
	  dfx=f.dfunc(x,0);
	  dfy=f.dfunc(x,1);
	  qx=-k*dfx;
	  qy=-k*dfy;
	  q[i][j]=Math.sqrt(qx*qx+qy*qy);
   }
 }
 Text.print(teta);
 Text.print(q);
 //ContourPlot p=new ContourPlot(teta,0.0,L,0.0,W,20,true,"x","y","T degree C");
 ContourPlot p=new ContourPlot(f,0.0,L,30,0.0,W,30,20,true,"x","y","z"); 
 p.plot();
 surfacePlot pp=new surfacePlot(f,0.0,L,0.0,W,T1,T2,"X","Y","T degree C",30); 
 pp.plot();          
 }
}