资源描述:
《数值分析编程题c语言.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、数值分析实习报告-12-数值分析实习报告上机实习题一一、题目:已知A与b12.38412,2.115237,-1.061074,1.112336,-0.113584,0.718719,1.742382,3.067813,-2.0317432.115237,19.141823,-3.125432,-1.012345,2.189736,1.563849,-0.784165,1.112348,3.123124-1.061074,-3.125432,15.567914,3.123848,2.031454,1
2、.836742,-1.056781,0.336993,-1.0101031.112336,-1.012345,3.123848,27.108437,4.101011,-3.741856,2.101023,-0.71828,-0.037585A=-0.113584,2.189736,2.031454,4.101011,19.897918,0.431637,-3.111223,2.121314,1.7841370.718719,1.563849,1.836742,-3.741856,0.431637,9
3、.789365,-0.103458,-1.103456,0.2384171.742382,-0.784165,-1.056781,2.101023,-3.111223,-0.103458,14.7138465,3.123789,-2.2134743.067813,1.112348,0.336993,-0.71828,2.121314,-1.103456,3.123789,30.719334,4.446782-2.031743,3.123124,-1.010103,-0.037585,1.784317
4、,0.238417,-2.213474,4.446782,40.00001b={2.1874369,33.992318,-25.173417,0.84671695,1.784317,-86.612343,1.1101230,4.719345,-5.6784392}1.用Household变换,把A化为三对角阵B(并打印B)。2.用超松弛法求解BX=b(取松弛因子ω=1.4,X(0)=0,迭代9次)。3.用列主元素消去法求解BX=b。二、解题方法的理论依据:1、用Householder变换的理论依据﹝
5、1﹞令A0=A,a(ij)1=a(ij),已知Ar_1即Ar_1=a(ij)r﹝2﹞Sr=sqrt(pow(a,2))﹝3﹞a(r)=Sr*Sr+abs(a(r+1,r))*Sr﹝4﹞y(r)=A(r_1)*u®/a®﹝5﹞Kr=(/2)*Ur的转置*Yr/a®﹝6﹞Qr=Yr-Kr*Ur﹝7﹞Ar=A(r-1)-(Qr*Ur的转置+Ur*Qr的转置)r=1,2,,……,n-22、用超松弛法求解其基本思想:在高斯方法已求出x(m),x(m-1)的基础上,组合新的序列,从而加快收敛速度。其算式:其中ω
6、是超松弛因子,当ω>1时,可以加快收敛速度3、用消去法求解用追赶消去法求Bx=b的方法:,,-12-数值分析实习报告,,q1[0]=0,u1[0]=0,x[9]=u1[9]三、1.计算程序:#include"math.h"#include"stdio.h"#definege8voidmain(){intsign(doublex);doublea[][9]={{12.38412,2.115237,-1.061074,1.112336,-0.113584,0.718719,1.742382,3.0678
7、13,-2.031743},{2.115237,19.141823,-3.125432,-1.012345,2.189736,1.563849,-0.784165,1.112348,3.123124},{-1.061074,-3.125432,15.567914,3.123848,2.031454,1.836742,-1.056781,0.336993,-1.010103},{1.112336,-1.012345,3.123848,27.108437,4.101011,-3.741856,2.101
8、023,-0.71828,-0.037585},{-0.113584,2.189736,2.031454,4.101011,19.897918,0.431637,-3.111223,2.121314,1.784317},{0.718719,1.563849,1.836742,-3.741856,0.431637,9.789365,-0.103458,-1.103456,0.238417},{1.742382,-0.784165,-1.056781,2.101023,-