}
for(i=0;i<N;i++)
{
xar+=x[i];
}
xar/=N;
for(i=0;i<N;i++)
{
yar+=y[i];
}
yar/=N;
for(i=0;i<N;i++)
{
xga+=1.0/x[i];
}
xga=N/xga;
for(i=0;i<N;i++)
{
yga+=1.0/y[i];
}
yga=N/yga;
for(i=0;i<N;i++)
{
xge*=x[i];
}
xge=pow(xge,1.0/N);
for(i=0;i<N;i++)
{
yge*=y[i];
}
yge=pow(yge,1.0/N);
printf("xar=%f xge=%f xga=%f yar=%f yge=%f yga=%f",xar,xge,xga,yar,yge,yga);
printf("\n Xcp | Ycp | Y^ |\n");
for (i=0;i<N;i++)
{while(xar>=x[i]&&xar<=x[i+1])
{yy=((xar-x[i])/(x[i+1]-x[i]))*(y[i+1]-y[i])+y[i];
printf("%7.4f|%7.4f|%7.4f|%7.4f\n",xar,yar,yy,min=my[0]=fabs((yar-yy)/yy));
break;}}
for (i=0;i<N;i++)
{while(xge>=x[i]&&xge<=x[i+1])
{yy=((xge-x[i])/(x[i+1]-x[i]))*(y[i+1]-y[i])+y[i];
printf("%7.4f|%7.4f|%7.4f|%7.4f\n",xge,yar,yy,my[1]=fabs((yar-yy)/yy));;break;}}
for (i=0;i<N;i++)
{while(xga>=x[i]&&xga<=x[i+1]){yy=((xga-x[i])/(x[i+1]-x[i]))*(y[i+1]-y[i])+y[i];
printf("%7.4f|%7.4f|%7.4f|%7.4f\n",xga,yar,yy,my[2]=fabs((yar-yy)/yy));;break;}}
for (i=0;i<N;i++)
{while(xar>=x[i]&&xar<=x[i+1]){yy=((xar-x[i])/(x[i+1]-x[i]))*(y[i+1]-y[i])+y[i];
printf("%7.4f|%7.4f|%7.4f|%7.4f\n",xar,yge,yy,my[3]=fabs((yge-yy)/yy));;break;}}
for (i=0;i<N;i++)
{while(xge>=x[i]&&xge<=x[i+1]){yy=((xge-x[i])/(x[i+1]-x[i]))*(y[i+1]-y[i])+y[i];
printf("%7.4f|%7.4f|%7.4f|%7.4f\n",xge,yge,yy,my[4]=fabs((yge-yy)/yy));;break;}}
for (i=0;i<N;i++)
{while(xga>=x[i]&&xga<=x[i+1]){yy=((xga-x[i])/(x[i+1]-x[i]))*(y[i+1]-y[i])+y[i];
printf("%7.4f|%7.4f|%7.4f|%7.4f\n",xga,yge,yy,my[5]=fabs((yge-yy)/yy));;break;}}
for (i=0;i<N;i++)
{while(xar>=x[i]&&xar<=x[i+1]){yy=((xar-x[i])/(x[i+1]-x[i]))*(y[i+1]-y[i])+y[i];
printf("%7.4f|%7.4f|%7.4f|%7.4f\n",xar,yga,yy,my[6]=fabs((yga-yy)/yy));;break;}}
for (i=0;i<N;i++)
{while(xge>=x[i]&&xge<=x[i+1]){yy=((xge-x[i])/(x[i+1]-x[i]))*(y[i+1]-y[i])+y[i];
printf("%7.4f|%7.4f|%7.4f|%7.4f\n",xge,yga,yy,my[7]=fabs((yga-yy)/yy));;break;}}
for (i=0;i<N;i++)
{while(xga>=x[i]&&xga<=x[i+1]){yy=((xga-x[i])/(x[i+1]-x[i]))*(y[i+1]-y[i])+y[i];
printf("%7.4f|%7.4f|%7.4f|%7.4f\n",xga,yga,yy,my[8]=fabs((yga-yy)/yy));;break;}}
for(i=0;i<N;i++)
{
lx[i]=log(x[i]);
ly[i]=log(y[i]);
x1[i]=1/x[i];
y1[i]=1/y[i];
}
for(i=1;i<N;i++)
{
if(my[i]<min)
{
min=my[i];
k=i+1;
}
}
printf("k=%i",k);
printf("\nOtrimana funkciya:");
switch(k)
{
case 1:
a1=A1(x,y);
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.