Курсовая работа: Моделирование непрерывно-стохастической модели на ЭВМ
y=0.15;
double y1=0.15;
double y_max,y_rez,eps,eps1;
double mas1[1200];
double mas[1200];
double e;
FILE *stream;
printf(" t | y | z \n");
/// fprintf(stream, " t | y | z \n");
i=0;
/* open a file for update */
stream = fopen("DUMMY.FIL", "w+");
while (t<120)
{
double j1, j2, r1, r2, s;
j1 = -1.0 + 2.0*rand()/((double)RAND_MAX - 1.0);
j2 = -1.0 + 2.0*rand()/((double)RAND_MAX - 1.0);
s = j1*j1 + j2*j2;
if (s < 1)
{
r1 = j1 * sqrt(-2*log(s)/s);
r2 = j2 * sqrt(-2*log(s)/s);
};
e=r1;
t=t+h;
y=y+h*z;
z=z+h*(e*pow((n0/h),1/2)-b1*z-b2*fabs(z)*z-c1*y-c3*pow(y,3));
mas[i]=y;
printf("%f | %f | %f \n",t,y,z);