#include <stdio.h>
#include <math.h>
#define N 8
void seiki(double x[N], double y[N], double A[2][N], double b[N], double S[2][3]);
void seiki(double x[N], double y[N], double A[2][N], double b[N], double S[2][3]){
for(int i=0;i<N;i++){
b[i] = y[i] -1;
}
for(int n=0;n<2;n++){
for(int l=0;l<2;l++){
for(int m=0;m<N;m++){
S[n][l] += A[n][m]*A[l][m];
}
}
}
for(int i=0;i<2;i++){
for(int j=0;j<N;j++){
S[i][2] += A[i][j]*b[j];
}
}
}
void pib(double S[2][3]){
for(int j=0;j<2;j++){
for(int i=j;i<3;i++){
}
for(int a=1+j;a<2;a++){
for(int b=j;b<3;b++){
}
}
for(int c=0;c<j;c++){
for(int d=j;d<3;d++){
}
}
}
}
int main(void) {
double x[N] = {0.15708, 0.23982, 0.37400, 0.57120, 0.82674, 1.04720, 1.23200, 1.43452};
double y[N] = {0.98769, 0.97138, 0.93087, 0.84125, 0.67728, 0.50000, 0.33236, 0.13586};
double A[2][N];
double b[N];
double S[2][3];
for(int n=0;n<2;n++){
for(int m=0;m<3;m++){
S[n][m] = 0;
}
}
seiki(x, y, A, b, S);
pib(S);
for(int j=0;j<2;j++){
printf("a%d = %f\n",j
+1, S
[j
][2]); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtYXRoLmg+CiNkZWZpbmUgTiA4Cgp2b2lkIHNlaWtpKGRvdWJsZSB4W05dLCBkb3VibGUgeVtOXSwgZG91YmxlIEFbMl1bTl0sIGRvdWJsZSBiW05dLCBkb3VibGUgU1syXVszXSk7Cgp2b2lkIHNlaWtpKGRvdWJsZSB4W05dLCBkb3VibGUgeVtOXSwgZG91YmxlIEFbMl1bTl0sIGRvdWJsZSBiW05dLCBkb3VibGUgU1syXVszXSl7Cglmb3IoaW50IGk9MDtpPE47aSsrKXsKCQlBWzBdW2ldID0gcG93KHhbaV0sIDIpOwoJCUFbMV1baV0gPSBwb3coeFtpXSwgNCk7CgkJYltpXSA9IHlbaV0gLTE7Cg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