public class square_wave
{
public static void main(String arg[])
{
if_x f=x->{double ff=0;double L=1.0;for(int n=1;n<800;n++){int k=2*n-1;ff+=Math.sin(k*Math.PI*x/L)/k;};ff*=4.0/Math.PI;return ff;};
Plot p=new Plot(f,0.0,10.0,800);
p.plot();
}
}