三九宝宝网宝宝教育教学论文

用C语言写一个高斯消元法解方程组的程序

02月16日 编辑 39baobao.com

[用C语言编一个迷宫程序]-# --------### # ## # # ### ----# # #-## # # # #### #### # ## ## #-# ## # # # #---# ## # ## # # # # -# ### ## #### ## # # ----# # # ## # # # ## ### ## -# --# --...+阅读

我们以方程组 2x1 + 6x2 - x3 = -12 5x1 - x2 +2x3 = 29 -3x1 - 4x2 + x3 = 5 为例 来说明楼主自己把方程组化为矩阵形式。以下为源代码 。 #include#include#include#includeint GS(int,double**,double *,double); double **TwoArrayAlloc(int,int); void TwoArrayFree(double **); int main(void) { int i,n; double ep,**a,*b; n = 3; ep = 1e-4; a = TwoArrayAlloc(n,n); b = (double *)calloc(n,sizeof(double)); if(b == NULL) { printf("memory get error\n"); exit

(1); } a[0][0]= 2; a[0][1]= 6; a[0][2]= -1; a[1][0]= 5; a[1][1]=-1; a[1][2]= 2; a[2][0]=-3; a[2][1]=-4; a[2][2]= 1; b[0] = -12; b[1] = 29; b[2] = 5; if(!GS(n,a,b,ep)) { printf("can't solve it with GS elimination\n"); exit(0); } printf("The solution of equations is as follows:\n"); for(i=0;i

以下为关联文档:

用C语言编写二分法解方程程序#include <stdio.h> #include <math.h> float getvalue(float x) { return x*x*x+4*x*x-10; } void main() { float a=1,b=1.5,c; c=(a+b)/2; while(fabs(getvalue(c))>0.00...

c语言二分法求解方程程序#include "stdio.h" #define MAX 100 typedef struct node { int key; }NODE; int binsearch(NODE r[MAX],int k,int n) { int t=1,h=n,m; while(t<=h) { m=(t+h)/2; if(k==r[...

用C语言编写一个计算薪水的程序/*工资计算程序*/ #include main() { float originWage; /*应发工资*/ float realWage; /*实发工资*/ float tax; /*所缴税款*/ int i,hour,amount,money; printf("请选择工资种...

用C语言写一个能够实现四个数排序的程序#include stdio.h void main{ int i,j; int temp; int arr[] = {8,7,9,12}; for(i=0;i<arr.length;i++){ for(j=1;j<arr.length;j++){ if(arr[i]>arr[j]){ temp = arr[i]; a...

用C语言编写一个简单的图书管理小程序源代码如下: #include<iostream> #include<iomanip> #include<string> #include<fstream> #include<stdio.h> using namespace std; const int maxb=10000; //最多的图书 clas...

只是用简单的C语言能实现高斯滤波吗可以的。int*** SmoothImage(int ***XImage ,int width, int height, int channel){double sigma = 1.85; //(n/2 -1)*0.3 +0.8 { n = 9 ,no. of elements}double conv[3][3...

用c语言编写一个简单的程序main() { int a,b,i; bool flag = true; for (i = 0; i < 6; i++) { scanf("%d", &a); if (flag) { b = a; flag = false; } else { if (b > a) b = a; } } prinf("%d", b); }...

帮助写一个简单的C语言程序//****************************************************************************** // 设a(非0),b,c,d,e(非0非1)分别为一位整数,abcd,dcba分别为四位整数 // 若有abcd*e=dcba...

用c语言编写一个程序实现以下功能1 2 3 4 5 6 7 8 9 10 #include "stdio.h" intmain(intargc,char*argv[]){ 5261int a,b; doublex,y; charch1,ch2; printf("Please enter the data...\n"); scanf("%d%d%lf%lf %c...

推荐阅读
图文推荐