import javax.swing.*;

public class yarisonsuzkatiSF
{
public static double[] Tduvar(double alfa,double tson,double L,int N)
{ 
 double dx=L/N;
 double dt=11;
 double Fo=alfa*dt/(dx*dx);
 double T[]=new double[N];
 double T1[]=new double[N];
 T[0]=100.0;
 T[N-1]=20.0;
 T1[N-1]=20.0;
 for(int m=1;m<N;m++) {T[m]=20.0;}
 int p=0;
 for(int t=0;t<=tson;t+=dt)
 {for(int m=1;m<N-1;m++)
  {T1[m]=T[m]+Fo*(T[m+1]+T[m-1]-2.0*T[m]);}
  for(int m=1;m<N;m++)
  {T[m]=T1[m];} 
 }
return T; 
}

public static void ciktipenceresi(String s)
{
String s1="polar sınıfı çıktı penceresi";	
JOptionPane.showMessageDialog(null,s,s1, JOptionPane.PLAIN_MESSAGE);	
}
public static void main(String arg[])
{
double alfa=5.0e-6;
double t=36000.0;
double L=10.0;
int N=1000;
double T[]=Tduvar(alfa,t,L,N);
double x[]=new double[N];
x[0]=0.0;
double dx=L/N;
System.out.println("dx="+dx);
for(int i=1;i<N;i++)
{x[i]=x[i-1]+dx;;}
Plot.data(x,T);
}

}