// Calculation program for displaying saeshore wave by simple simulation 2, Jan. 29 (Sat.), 2009



// y=sin(x-(exp(c*y*time)-1))



// file name: wave2.c



#include< stdio.h>

#include< math.h>



void main(void)

{



	double pi;// the value of the pi

	double x,y,dx,time;// x is the phase, y indicates the wave form, dx is the minute increment of x, and time is the normalized time by wave number.

	double xmin,xmax;// the minimum and maximum values of x respectively

	double c;// c indicates the degree of an influence of viscousity

	int i,imax;

	double xx[10001],yy[10001];// Take care of the upper limit of storage memory capacitance.



	FILE *fp;



// Setting of the constants

	pi=3.14159265;

	c=1.;



// Setting of the other parameters

	xmin=-2*pi;

	xmax=2*pi;

	dx=(xmax-xmin)/10000;



// Setting of the normalized time

	time=1.0;// the normalized time by wave number



// execution of calculation

	i=0;

	for(x=xmin+dx;x< xmax;x=x+dx)

		{

		i++;



		y=sin(x);



		xx[i]=x+(exp(c*y*time)-1);

		yy[i]=y;



		printf("i=%d,x=%f,y=%f\n",i,xx[i],yy[i]);

		}

	imax=i;



// writing the calculated coordinates data (expressed in (x,y) coordinates) into a textfile named "wave2.txt"

	fp=fopen("wave2.txt","w");

	if(fp==NULL)

		{

		printf("FILE OPEN ERROR\n");

		}

	else

		{

		for(i=1;i<=imax;i++)

			{

			fprintf(fp,"%f,%f\n",xx[i],yy[i]);

			}

		fflush(fp);

		fclose(fp);

		}

	printf("end\n");

}// the end of the program





RETURN