版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、数值分析大作业四一、算法设计方案:复化梯形积分法,选取步长为1/500=0.002,迭代误差控制在E1.0e-10复化梯形积分法:,截断误差为:。复化Simpson积分法,选取步长为1/50=0.02,迭代误差控制在E1.0e-10Simpson积分法:,截断误差为:。Guass积分法选用Gauss-Legendre 求积公式:截断误差为:R=(1,1)。选择9个节点:-0.9681602395,-0.8360311073,-0.6133714327,-0.3242534234,0,0.3242534234,0.6133714327,0.8360311073,0.9681602395,对应的求
2、积系数依次为:0.0812743884,0.1806481607,0.2606106964,0.3123470770,0.3302393550,0.3123470770,0.2606106964,0.1806481607,0.0812743884。二、程序源代码:#include<stdio.h>#include<math.h>#include<stdlib.h>#define E 1.0e-10/*定义函数g和K*/double g(double a)double b;b=exp(4*a)+(exp(a+4)-exp(-a-4)/(a+4);return
3、b;double K(double a,double b)double c;c=exp(a*b);return c;/*复化梯形法*/void Tixing()double u1001,x1001,h,c1001,e;int i,j,k;FILE *fp;fp=fopen("f:/result0.xls","w");h=1.0/1500;for(i=0;i<3001;i+)xi=i*h-1;ui=g(xi);for(k=0;k<100;k+)e=0;for(i=0;i<1001;i+)for(j=1,ci=0;j<N-1;j+)c
4、i+=K(xi,xj)*uj;ui=g(xi)-h*ci-h/2*(K(xi,x0)*u0+K(xi,xN-1)*uN-1);e+=h*(exp(4*xi)-ui)*(exp(4*xi)-ui);if(e<=E) break;for(i=0;i<1001;i+)fprintf(fp,"%.12lf,%.12lfn",xi,ui);fclose(fp);/*复化Simpson法*/void simpson()double u101,x101,h,c101,d101,e;int i,j,k;FILE *fp;fp=fopen("f:/result1.xls
5、","w");h=1.0/50;for(i=0;i<101;i+)xi=i*h-1;ui=g(xi);for(k=0;k<50;k+)e=0;for(i=0;i<101;i+)for(j=1,ci=0,di=0;j<51;j+)ci+=K(xi,x2*j-1)*u2*j-1;if(j<50)di+=K(xi,x2*j)*u2*j;ui=g(xi)-4*h/3*ci-2*h/3*di-h/3*(K(xi,x0)*u0+K(xi,xM-1)*uM-1);e+=h*(exp(4*xi)-ui)*(exp(4*xi)-ui);if(e<
6、=E) break;for(i=0;i<101;i+)fprintf(fp,"%.12lf,%.12lfn",xi,ui);fclose(fp);/*Gauss积分法*/void gauss()double x9=-0.9681602395,-0.8360311073,-0.6133714327,-0.3242534234,0,0.3242534234,0.6133714327,0.8360311073,0.9681602395,A9=0.0812743884,0.1806481607,0.2606106964,0.3123470770,0.3302393550,0.
7、3123470770,0.2606106964,0.1806481607,0.0812743884,u9,c9,e;int i,j,k;FILE *fp;fp=fopen("f:/result2.xls","w");for(i=0;i<9;i+)ui=g(xi);for(k=0;k<50;k+)e=0;for(i=0;i<9;i+)for(j=0,ci=0;j<9;j+)ci+=Aj*K(xi,xj)*uj;ui=g(xi)-ci;e+=Ai*(exp(4*xi)-ui)*(exp(4*xi)-ui);if(e<=E) br
8、eak;for(i=0;i<9;i+)fprintf(fp,"%.12lf,%.12lfn",xi,ui);fclose(fp);/*主函数*/main()Tixing();Simpson(); Gauss();return 0;三、运算结果复化梯形数据-10.018323-0.920.02523-0.9980.018471-0.9180.025433-0.9960.018619-0.9160.025637-0.9940.018768-0.9140.025843-0.9920.018919-0.9120.026051-0.990.019071-0.910.02626-
9、0.9880.019224-0.9080.026471-0.9860.019378-0.9060.026683-0.9840.019534-0.9040.026897-0.9820.019691-0.9020.027113-0.980.019849-0.90.027331-0.9780.020008-0.8980.02755-0.9760.020169-0.8960.027772-0.9740.020331-0.8940.027995-0.9720.020494-0.8920.028219-0.970.020658-0.890.028446-0.9680.020824-0.8880.02867
10、4-0.9660.020992-0.8860.028905-0.9640.02116-0.8840.029137-0.9620.02133-0.8820.029371-0.960.021501-0.880.029607-0.9580.021674-0.8780.029844-0.9560.021848-0.8760.030084-0.9540.022023-0.8740.030326-0.9520.0222-0.8720.030569-0.950.022378-0.870.030815-0.9480.022558-0.8680.031062-0.9460.022739-0.8660.03131
11、1-0.9440.022922-0.8640.031563-0.9420.023106-0.8620.031816-0.940.023291-0.860.032072-0.9380.023478-0.8580.032329-0.9360.023667-0.8560.032589-0.9340.023857-0.8540.032851-0.9320.024048-0.8520.033114-0.930.024241-0.850.03338-0.9280.024436-0.8480.033648-0.9260.024632-0.8460.033918-0.9240.02483-0.8440.034
12、191-0.9220.025029-0.8420.034465-0.840.034742-0.760.047841-0.8380.035021-0.7580.048225-0.8360.035302-0.7560.048613-0.8340.035586-0.7540.049003-0.8320.035872-0.7520.049396-0.830.03616-0.750.049793-0.8280.03645-0.7480.050193-0.8260.036743-0.7460.050596-0.8240.037038-0.7440.051002-0.8220.037335-0.7420.0
13、51412-0.820.037635-0.740.051825-0.8180.037937-0.7380.052241-0.8160.038242-0.7360.052661-0.8140.038549-0.7340.053084-0.8120.038858-0.7320.05351-0.810.039171-0.730.05394-0.8080.039485-0.7280.054373-0.8060.039802-0.7260.054809-0.8040.040122-0.7240.05525-0.8020.040444-0.7220.055693-0.80.040769-0.720.056
14、141-0.7980.041096-0.7180.056591-0.7960.041426-0.7160.057046-0.7940.041759-0.7140.057504-0.7920.042094-0.7120.057966-0.790.042432-0.710.058431-0.7880.042773-0.7080.058901-0.7860.043116-0.7060.059374-0.7840.043463-0.7040.05985-0.7820.043812-0.7020.060331-0.780.044164-0.70.060816-0.7780.044518-0.6980.0
15、61304-0.7760.044876-0.6960.061796-0.7740.045236-0.6940.062293-0.7720.045599-0.6920.062793-0.770.045966-0.690.063297-0.7680.046335-0.6880.063805-0.7660.046707-0.6860.064318-0.7640.047082-0.6840.064834-0.7620.04746-0.6820.065355-0.680.06588-0.60.090722-0.6780.066409-0.5980.091451-0.6760.066942-0.5960.
16、092185-0.6740.06748-0.5940.092926-0.6720.068022-0.5920.093672-0.670.068568-0.590.094424-0.6680.069119-0.5880.095183-0.6660.069674-0.5860.095947-0.6640.070234-0.5840.096718-0.6620.070798-0.5820.097494-0.660.071366-0.580.098277-0.6580.071939-0.5780.099067-0.6560.072517-0.5760.099862-0.6540.0731-0.5740
17、.100664-0.6520.073687-0.5720.101473-0.650.074278-0.570.102288-0.6480.074875-0.5680.103109-0.6460.075476-0.5660.103937-0.6440.076082-0.5640.104772-0.6420.076694-0.5620.105614-0.640.077309-0.560.106462-0.6380.07793-0.5580.107317-0.6360.078556-0.5560.108179-0.6340.079187-0.5540.109048-0.6320.079823-0.5
18、520.109924-0.630.080464-0.550.110806-0.6280.08111-0.5480.111696-0.6260.081762-0.5460.112593-0.6240.082418-0.5440.113498-0.6220.08308-0.5420.114409-0.620.083748-0.540.115328-0.6180.08442-0.5380.116254-0.6160.085098-0.5360.117188-0.6140.085782-0.5340.118129-0.6120.086471-0.5320.119078-0.610.087165-0.5
19、30.120035-0.6080.087865-0.5280.120999-0.6060.088571-0.5260.12197-0.6040.089282-0.5240.12295-0.6020.089999-0.5220.123938-0.550.110806-0.470.152592-0.5480.111696-0.4680.153817-0.5460.112593-0.4660.155053-0.5440.113498-0.4640.156298-0.5420.114409-0.4620.157553-0.540.115328-0.460.158819-0.5380.116254-0.
20、4580.160095-0.5360.117188-0.4560.16138-0.5340.118129-0.4540.162677-0.5320.119078-0.4520.163983-0.530.120035-0.450.1653-0.5280.120999-0.4480.166628-0.5260.12197-0.4460.167966-0.5240.12295-0.4440.169315-0.5220.123938-0.4420.170675-0.520.124933-0.440.172046-0.5180.125936-0.4380.173428-0.5160.126948-0.4
21、360.174821-0.5140.127967-0.4340.176225-0.5120.128995-0.4320.17764-0.510.130031-0.430.179067-0.5080.131076-0.4280.180505-0.5060.132128-0.4260.181955-0.5040.13319-0.4240.183416-0.5020.134259-0.4220.18489-0.50.135338-0.420.186375-0.4980.136425-0.4180.187871-0.4960.13752-0.4160.18938-0.4940.138625-0.414
22、0.190901-0.4920.139738-0.4120.192435-0.490.140861-0.410.19398-0.4880.141992-0.4080.195538-0.4860.143132-0.4060.197109-0.4840.144282-0.4040.198692-0.4820.145441-0.4020.200288-0.480.146609-0.40.201897-0.4780.147786-0.3980.203518-0.4760.148973-0.3960.205153-0.4740.15017-0.3940.206801-0.4720.151376-0.39
23、20.208462-0.390.210136-0.310.289382-0.3880.211824-0.3080.291706-0.3860.213525-0.3060.294049-0.3840.21524-0.3040.296411-0.3820.216969-0.3020.298792-0.380.218711-0.30.301192-0.3780.220468-0.2980.303611-0.3760.222239-0.2960.306049-0.3740.224024-0.2940.308508-0.3720.225823-0.2920.310985-0.370.227637-0.2
24、90.313483-0.3680.229465-0.2880.316001-0.3660.231308-0.2860.318539-0.3640.233166-0.2840.321098-0.3620.235039-0.2820.323677-0.360.236927-0.280.326277-0.3580.23883-0.2780.328897-0.3560.240748-0.2760.331539-0.3540.242682-0.2740.334202-0.3520.244631-0.2720.336886-0.350.246596-0.270.339592-0.3480.248576-0
25、.2680.34232-0.3460.250573-0.2660.345069-0.3440.252586-0.2640.347841-0.3420.254614-0.2620.350635-0.340.256659-0.260.353451-0.3380.258721-0.2580.35629-0.3360.260799-0.2560.359151-0.3340.262894-0.2540.362036-0.3320.265005-0.2520.364944-0.330.267134-0.250.367875-0.3280.269279-0.2480.37083-0.3260.271442-
26、0.2460.373809-0.3240.273622-0.2440.376811-0.3220.27582-0.2420.379838-0.320.278035-0.240.382888-0.3180.280268-0.2380.385964-0.3160.28252-0.2360.389064-0.3140.284789-0.2340.392189-0.3120.287076-0.2320.395339-0.230.398514-0.150.548804-0.2280.401715-0.1480.553212-0.2260.404942-0.1460.557655-0.2240.40819
27、4-0.1440.562134-0.2220.411473-0.1420.56665-0.220.414778-0.140.571201-0.2180.418109-0.1380.575789-0.2160.421467-0.1360.580414-0.2140.424853-0.1340.585076-0.2120.428265-0.1320.589775-0.210.431705-0.130.594512-0.2080.435172-0.1280.599287-0.2060.438668-0.1260.604101-0.2040.442191-0.1240.608953-0.2020.44
28、5743-0.1220.613844-0.20.449323-0.120.618774-0.1980.452932-0.1180.623744-0.1960.45657-0.1160.628754-0.1940.460237-0.1140.633805-0.1920.463934-0.1120.638895-0.190.46766-0.110.644027-0.1880.471416-0.1080.6492-0.1860.475203-0.1060.654414-0.1840.47902-0.1040.659671-0.1820.482867-0.1020.664969-0.180.48674
29、6-0.10.67031-0.1780.490655-0.0980.675694-0.1760.494596-0.0960.681121-0.1740.498569-0.0940.686592-0.1720.502573-0.0920.692107-0.170.50661-0.090.697666-0.1680.510679-0.0880.70327-0.1660.514781-0.0860.708919-0.1640.518916-0.0840.714613-0.1620.523084-0.0820.720352-0.160.527285-0.080.726138-0.1580.53152-
30、0.0780.731971-0.1560.535789-0.0760.73785-0.1540.540093-0.0740.743776-0.1520.544431-0.0720.749751-0.070.7557730.011.040796-0.0680.7618430.0121.049156-0.0660.7679620.0141.057583-0.0640.7741310.0161.066077-0.0620.7803480.0181.07464-0.060.7866160.021.083272-0.0580.7929340.0221.091973-0.0560.7993030.0241
31、.100743-0.0540.8057230.0261.109585-0.0520.8121950.0281.118497-0.050.8187190.031.127481-0.0480.8252950.0321.136537-0.0460.8319240.0341.145666-0.0440.8386060.0361.154868-0.0420.8453410.0381.164144-0.040.8521310.041.173494-0.0380.8589760.0421.18292-0.0360.8658750.0441.192421-0.0340.872830.0461.201999-0
32、.0320.879840.0481.211654-0.030.8869070.051.221386-0.0280.8940310.0521.231196-0.0260.9012120.0541.241085-0.0240.9084510.0561.251054-0.0220.9157480.0581.261102-0.020.9231030.061.271232-0.0180.9305170.0621.281442-0.0160.9379910.0641.291735-0.0140.9455250.0661.30211-0.0120.953120.0681.312569-0.010.96077
33、50.071.323112-0.0080.9684930.0721.333739-0.0060.9762720.0741.344452-0.0040.9841130.0761.355251-0.0020.9920180.0781.36613600.9999860.081.3771090.0021.0080180.0821.388170.0041.0161140.0841.399320.0061.0242760.0861.410560.0081.0325030.0881.4218890.091.433310.171.9738530.0921.4448230.1721.9897080.0941.4
34、564280.1742.0056890.0961.4681260.1762.0217990.0981.4799180.1782.0380390.11.4918050.182.0544080.1021.5037870.1822.070910.1041.5158660.1842.0875430.1061.5280410.1862.1043110.1081.5403150.1882.1212130.111.5526870.192.1382510.1121.5651580.1922.1554250.1141.577730.1942.1727380.1161.5904020.1962.190190.11
35、81.6031760.1982.2077810.121.6160530.22.2255150.1221.6290340.2022.243390.1241.6421180.2042.2614090.1261.6553080.2062.2795730.1281.6686040.2082.2978830.131.6820060.212.316340.1321.6955160.2122.3349450.1341.7091350.2142.35370.1361.7228630.2162.3726050.1381.7367010.2182.3916620.141.750650.222.4108720.14
36、21.7647120.2222.4302360.1441.7788860.2242.4497560.1461.7931740.2262.4694330.1481.8075770.2282.4892680.151.8220960.232.5092620.1521.8367310.2322.5294170.1541.8514840.2342.5497330.1561.8663550.2362.5702130.1581.8813460.2382.5908570.161.8964570.242.6116670.1621.911690.2422.6326450.1641.9270450.2442.653
37、790.1661.9425230.2462.6751060.1681.9581260.2482.6965930.252.7182520.333.7433850.2522.7400850.3323.7734530.2542.7620940.3343.8037610.2562.7842790.3363.8343140.2582.8066430.3383.8651110.262.8291860.343.8961560.2622.8519110.3423.9274510.2642.8748180.3443.9589960.2662.8979090.3463.9907960.2682.9211850.3
38、484.022850.272.9446480.354.0551620.2722.96830.3524.0877340.2742.9921420.3544.1205670.2763.0161750.3564.1536640.2783.0404010.3584.1870260.283.0648220.364.2206570.2823.0894390.3624.2545580.2843.1142540.3644.2887310.2863.1392680.3664.3231790.2883.1644830.3684.3579030.293.18990.374.3929060.2923.2155220.
39、3724.428190.2943.2413490.3744.4637580.2963.2673840.3764.4996120.2983.2936280.3784.5357530.33.3200830.384.5721850.3023.346750.3824.6089090.3043.3736320.3844.6459280.3063.4007290.3864.6832450.3083.4280440.3884.7208610.313.4555790.394.758780.3123.4833350.3924.7970030.3143.5113130.3944.8355330.3163.5395
40、160.3964.8743730.3183.5679460.3984.9135240.323.5966040.44.952990.3223.6254930.4024.9927730.3243.6546130.4045.0328760.3263.6839670.4065.07330.3283.7135570.4085.114050.415.1551260.497.0992760.4125.1965330.4927.1562980.4145.2382720.4947.2137780.4165.2803460.4967.271720.4185.3227590.4987.3301270.425.365
41、5120.57.3890040.4225.4086080.5027.4483530.4245.4520510.5047.5081790.4265.4958420.5067.5684860.4285.5399850.5087.6292770.435.5844830.517.6905560.4325.6293380.5127.7523270.4345.6745540.5147.8145950.4365.7201330.5167.8773620.4385.7660770.5187.9406340.445.8123910.528.0044140.4425.8590770.5228.0687070.44
42、45.9061380.5248.1335160.4465.9535770.5268.1988450.4486.0013960.5288.2646990.456.04960.538.3310820.4526.0981910.5328.3979980.4546.1471730.5348.4654520.4566.1965480.5368.5334470.4586.2463190.5388.6019890.466.296490.548.6710810.4626.3470640.5428.7407280.4646.3980450.5448.8109350.4666.4494340.5468.88170
43、50.4686.5012370.5488.9530440.476.5534560.559.0249560.4726.6060940.5529.0974450.4746.6591550.5549.1705170.4766.7126420.5569.2441750.4786.7665580.5589.3184260.486.8209080.569.3932720.4826.8756950.5629.468720.4846.9309210.5649.5447740.4866.9865910.5669.6214390.4887.0427080.5689.6987190.579.776620.6513.
44、463670.5729.8551470.65213.571810.5749.9343050.65413.680820.57610.01410.65613.790710.57810.094530.65813.901470.5810.175610.6614.013130.58210.257340.66214.125690.58410.339730.66414.239150.58610.422780.66614.353520.58810.50650.66814.468810.5910.590890.6714.585020.59210.675960.67214.702170.59410.761710.
45、67414.820260.59610.848150.67614.93930.59810.935280.67815.059290.611.023110.6815.180250.60211.111650.68215.302180.60411.20090.68415.425090.60611.290870.68615.548980.60811.381560.68815.673870.6111.472980.6915.799770.61211.565130.69215.926670.61411.658020.69416.05460.61611.751660.69616.183550.61811.846
46、050.69816.313540.6211.94120.716.444570.62212.037110.70216.576650.62412.133790.70416.70980.62612.231250.70616.844010.62812.32950.70816.979310.6312.428530.7117.115690.63212.528360.71217.253160.63412.628990.71417.391740.63612.730420.71617.531430.63812.832680.71817.672250.6412.935750.7217.814190.64213.039650.72217.957280.64413.144
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
评论
0/150
提交评论