运行时会出现OVERFLOW ERROR.我已经调过很多次了找不出问题.麻烦高手帮忙看看
#include "stdio.h"
#include "math.h"
void f(double xf[],double yb[])
{
yb[1]=3*xf[1]-cos(xf[2]*xf[3])-0.5;
yb[2]=xf[1]*xf[1]-81*(xf[2]+1)*(xf[2]+1)+sin(xf[3])+1.06;
yb[3]=exp(-xf[1]*xf[2])+20*xf[3]+(10*3.14159-3)/3;
}
main()
{
int n,k,i,j,l,m;
double eps1,eps2,h,x[10],y[10],ym[10],U[10][10];
double ym1[10],Q[10][10],QQ[10][10],fm1[10],fm2[10],deltax[10],a[10];
double maxf,maxfd,c,d,am,t,b;
printf("please input n:");
scanf("%d",&n);
printf("\n Please input eps1 & eps2:\n");
scanf("%lf%lf",&eps1,&eps2);
for(i=1;i<=n;i++)
{ printf("\n Please input the initial value of x[%d]:",i);
scanf("%lf",&x[i]);}
for(k=0;;k++)
{ maxf=0.0;maxfd=0.0;
f(x,y);
for(i=1;i<=n;i++)
if(fabs(y[i])>maxf)
maxf=fabs(y[i]);
if (maxf<=eps1) break;
for(i=1;i<=n;i++)
ym[i]=x[i];
h=maxf;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{if(i==j)
Q[i][j]=1;
else
Q[i][j]=0;
}
for(m=1;m<=n;m++)
{ f(ym,fm2);
d=fm2[m];
for(i=1;i<=n;i++)
{for(j=1;j<=n;j++)
ym1[j]=ym[j]+h*Q[i][j];
f(ym1,fm1);
c=fm1[m];
a[i]=(c-d)/h;
}
l=m;
for(l;l>0;l--)
a[l]=0;
l=m;
for(l;l<=n;l++)
a[l]=a[l];
/*household*/
t=0;
for (l=1;l<=n;l++)
if(t<a[l])
t=a[l];
if(t==0)
{ b=0;
printf("\nb=0\n");
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(i==j)
U[i][j]=1;
else
U[i][j]=0;
}
else
{
for (l=1;l<=n;l++)
a[l]=a[l]/t;
am=0.0;
for (l=1;l<=n;l++)
am=am+a[l]*a[l];
am=sqrt(am);
if(a[1]<0)
am=-am;
a[1]=a[1]+am;
b=1/(am*a[1]);
am=b*am;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{U[i][j]=-b*a[i]*a[j];
if(i==j)
U[i][j]=1+U[i][j];}
}
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
QQ[i][j]=0;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
for(l=1;l<=n;l++)
QQ[i][j]+=Q[i][l]*U[l][j];
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
Q[i][j]=QQ[i][j];
for(i=1;i<=n;i++)
ym[i]=ym[i]-d*Q[i][m]/am;
}
for(i=1;i<=n;i++)
{
deltax[i]=ym[i]-x[i];
x[i]=ym[i];
}
for(i=1;i<=n;i++)
if(fabs(deltax[i])>maxfd)
maxfd=fabs(deltax[i]);
if(maxfd<=eps2) {break;}
}
for(i=1;i<=n;i++)
printf("\nx[%d]=%lf",i,x[i]);
printf("\n\n");
}