![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Numerical Calculation
文章平均质量分 60
laohan_
贵在坚持
展开
-
GaussElimination_MCP
#include #include int main() { int i,j,k,p,n; float m,temp,temp1,A[10][10],X[10]; printf("请输入方程组未知个数n:"); scanf("%d",&n); printf("请输入增广矩阵A相关信息:\n"); for(i=1;i for(j=1;j scanf("%f",&A[i][j])原创 2012-04-03 22:40:46 · 689 阅读 · 0 评论 -
Gauss_Seidel
#include #include float cal(float X[],float A[10][10],int i,int s,int n) { int j; float sum=0; for(j=s;j sum=sum+A[i][j]*X[j]; return sum; } float jacobi(int n,int N,float A[10][10],float B原创 2012-04-04 01:20:49 · 974 阅读 · 0 评论 -
Simple_iterative_method
#include #include #define N 100 float cal(float element) { float sum; // sum=sqrt(10-pow(element,3)); sum=pow(element*element+0.8,3); return 1.0/sum; } int main() { float x; float x0; fl原创 2012-04-03 22:45:01 · 439 阅读 · 0 评论 -
lagrange
#include float lagrange(int n,float x[],float y[],float xx) { float temp,yy; int i,j; yy=0; for(i=0;i { temp=y[i]; for(j=0;j if(j!=i) temp=temp*(xx-x[j])/(x[i]-x[j]); yy=yy+temp; } retur原创 2012-04-21 15:50:56 · 545 阅读 · 0 评论 -
secant_method
#include #include double cal(double x) { return 4+2.0/3*cos(x); } int main() { double x0,x1,flag,x; int N; printf("x0 x1 flag N\n"); scanf("%lf %lf %lf %d",&x0,&x1,&flag,&N); int n=1; whi原创 2012-04-03 22:44:17 · 712 阅读 · 0 评论 -
ComplexT
#include int main() { float va[]={50.0f,46.0f,40.0f,32.2f,22.5f},temp,a,b,h; int j,i,n; a=0; b=8; n=2; h=(b-a)/n; temp=1/va[0]+1/va[4]; //complex T转载 2012-06-18 23:21:57 · 582 阅读 · 0 评论 -
Euler
#include using namespace std; #define F(x,y) (2*x)/(3*y*y) int main() { float a,b,y,y0,h,x,S[3]; int N; a=0; b=1; y0=1; for(int i=0;i {转载 2012-06-18 23:19:59 · 404 阅读 · 0 评论 -
Least_Square_Method
#include #include using namespace std; void Least_Square_Method(float *A,float *B,float X[],float Y[],int cal) { float sum_Xi=0,sum_XiXi=0,sum_Yi=0,sum_XiYi=0,temp=0; int i=0; for(;原创 2012-05-14 22:30:02 · 845 阅读 · 0 评论 -
jacobi
#include #include float cal(float X[],float A[10][10],int i,int n) { int j=1; float sum=0; for(;j if(j!=i) { sum=sum+A[i][j]*X[j]; } return sum; } float jacobi(int n,int N,float A[10][10原创 2012-04-03 22:39:39 · 712 阅读 · 0 评论 -
Newton
#include #include /*#define F0 ((3.0*x0+1)/(x0*x0)) #define f0 (-(3.0*x0+2)/(x0*x0*x0)) */ /*#define F0 (x0*x0*x0-1)/3.0 #define f0 x0*x0*1.0 */ /*#define F0 x0*x0*x0-3*x0-1 #define f0 3原创 2012-04-03 22:43:33 · 604 阅读 · 0 评论 -
chasingMethod
#include int main() { int i,n; float X[10],A[10],B[10],C[10],F[10]; printf("请输入方程组的未知个数n:\n"); scanf("%d",&n); printf("对应系数矩阵的三个向量a,b,c;方程组的右端项f:\n"); for(i=2;i { scanf("%f",&A[i]); }原创 2012-04-03 22:42:17 · 720 阅读 · 0 评论 -
Binary_interval_method
#include #define N 100 float cal(float p) { float sum=p*p*p+p-4; return sum; } float main(){ float a; float b; float flag; int n; float p; float FP; float FA; flag=0.001f; n=0; a=1;原创 2012-04-03 22:41:35 · 417 阅读 · 0 评论 -
Steffensen
#include #include double cal(double x,int option){ if(option==1) return (3*x+1)/(x*x); else if(option==2) return (x*x*x-1)/3.0; else if (option==3) return pow(3*x+1,1.0/3.0); else if(option=原创 2012-04-03 22:45:36 · 586 阅读 · 0 评论