#include#include#include#include
double f(int n,double x){ //f(n,x)用来返回x的n次方
double y=1.0;if(n==0)return 1.0;else{for(int i=0;i
}
}int xianxingfangchengzu(double **a,int n,double *b,double *p,double dt)//用高斯列主元法来求解法方程组
{inti,j,k,l;doublec,t;for(k=1;k<=n;k++)
{
c=0.0;for(i=k;i<=n;i++)if(fabs(a[i-1][k-1])>fabs(c))
{
c=a[i-1][k-1];
l=i;
}if(fabs(c)<=dt)return(0);if(l!=k)
{for(j=k;j<=n;j++)
{
t=a[k-1][j-1];
a[k-1][j-1]=a[l-1][j-1];
a[l-1][j-1]=t;
}
t=b[k-1];
b[k-1]=b[l-1];
b[l-1]=t;
}
c=1/c;for(j=k+1;j<=n;j++)
{
a[k-1][j-1]=a[k-1][j-1]*c;for(i=k+1;i<