数值计算-方程组

上传人:第*** 文档编号:38908513 上传时间:2018-05-09 格式:DOC 页数:4 大小:225.50KB
返回 下载 相关 举报
数值计算-方程组_第1页
第1页 / 共4页
数值计算-方程组_第2页
第2页 / 共4页
数值计算-方程组_第3页
第3页 / 共4页
数值计算-方程组_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《数值计算-方程组》由会员分享,可在线阅读,更多相关《数值计算-方程组(4页珍藏版)》请在金锄头文库上搜索。

1、分别用雅可比、高斯塞达尔、超松弛法解方程组。精度:0.001 。 5*x1 + 2*x2+ x*3=-12 -x1 + x*2+ 2*x3= 20 2*x1 -*3x2 +10*x3= 31: 雅可比迭代法(雅可比迭代法(Jacobi):): /* 5*x1 + 2*x2+ x*3=-12 -x1 + x*2+ 2*x3= 20 2*x1 -*3x2 +10*x3= 3 */#include “math.h“#include “stdio.h“main()double a33=5.0,2.0,1.0,-1.0,4.0,2.0,2.0,-3.0,10.0;double x3=0.0,0.0,0.

2、0,y3,b3=-12.0,20.0,3.0;double eps=0.001,e,q,t,s;int i,j,k,N=0;e=eps+1.0;while (e=eps) N+; e=0.0; for(k=0;ke)e=q; printf(“n“);2: 高斯赛德尔迭代法(高斯赛德尔迭代法(G-S)/* 5*x1 + 2*x2+ x*3=-12 -x1 + x*2+ 2*x3= 20 2*x1 -*3x2 +10*x3= 3 */#include “math.h“#include “stdio.h“main()double a33=5.0,2.0,1.0,-1.0,4.0,2.0,2.0,-3

3、.0,10.0;double x3=0.0,0.0,0.0,b3=-12.0,20.0,3.0;double eps=0.001,e,q,t,s;int i,j,k,N=0;e=eps+1.0;while (e=eps) N+; e=0.0;for (i=0; ie)e=q; printf(“n“);3: 逐次超松弛迭代法(逐次超松弛迭代法(SOR):):/* 5*x1 + 2*x2+ x*3=-12 -x1 + x*2+ 2*x3= 20 2*x1 -*3x2 +10*x3= 3 */#include “math.h“#include “stdio.h“main()double a33=5.0,2.0,1.0,-1.0,4.0,2.0,2.0,-3.0,10.0;double x3=0.0,0.0,0.0,b3=-12.0,20.0,3.0;double eps=0.001,e,q,t,s;double w=1.15;int i,j,k,N=0;printf(“w=%fn“,w);e=eps+1.0;while (e=eps) N+; e=0.0;for (i=0; ie)e=q; printf(“n“);

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号