收藏 分享(赏)

实验1_误差计算与什么是数值计算方法及应用.doc.doc

上传人:ysd1539 文档编号:6542291 上传时间:2019-04-16 格式:DOC 页数:12 大小:204KB
下载 相关 举报
实验1_误差计算与什么是数值计算方法及应用.doc.doc_第1页
第1页 / 共12页
实验1_误差计算与什么是数值计算方法及应用.doc.doc_第2页
第2页 / 共12页
实验1_误差计算与什么是数值计算方法及应用.doc.doc_第3页
第3页 / 共12页
实验1_误差计算与什么是数值计算方法及应用.doc.doc_第4页
第4页 / 共12页
实验1_误差计算与什么是数值计算方法及应用.doc.doc_第5页
第5页 / 共12页
点击查看更多>>
资源描述

1、数值计算方法实验报告 1什么是数值计算方法及应用与误差计算1什么是数值计算方法及应用计算数学也叫做数值计算方法或数值分析。主要内容包括代数方程、线性代数方程组、微分方程的数值解法,函数的数值逼近问题,矩阵特征值的求法,最优化计算问题,概率统计计算问题等等,还包括解的存在性、唯一性、收敛性和误差分析等理论问题。数值计算方法,是一种研究并解决数学问题的数值近似解方法,是在计算机上使用的解数学问题的方法,简称计算方法。在科学研究和工程技术中都要用到各种计算方法。 例如,在航天航空、地质勘探、汽车制造、桥梁设计、 天气预报和汉字字样设计中都有计算方法的踪影.Numerical analysis inv

2、olves the study of methods of computing numerical data. In many problems this implies producing a sequence of approximations by repeating the procedure again and again. People who employ numerical methods for solving problems have to worry about the following issues: the rate of convergence (how lon

3、g does it take for the method to find the answer), the accuracy (or even validity) of the answer, and the completeness of the response (do other solutions, in addition to the one found, exist).Numerical methods provide approximations to the problems in question. No matter how accurate they are,they

4、do not, in most cases, provide the exact answer. In some instances working out the exact answer by a different approach may not be possible or may be too time consuming and it is in these cases where numerical methods are mostoften used.The ever-increasing advances in computer technology has enabled

5、 many in science and engineering to apply numerical methods to simulate physical phenomena. Numerical methods are often divided into elementary ones such as finding the root of an equation, integrating a function or solving a linear system of equations to intensive ones like the finite element metho

6、d. Intensive methods are often needed for the solution of practical problems and they often require the systematic application of a range of elementary methods, often thousands or millions of times over. In the development of numerical methods, simplifications need to be made to progress towards a s

7、olution: for example general functions may need to be approximated by polynomials and computers cannot generally represent numbers exactly anyway. As a result, numerical methods do not usually give the exact answer to a given problem, or they can only tend towards a solution getting closer and close

8、r with each iteration. Numerical methods are generally only useful when they are implemented on computer using a computer programming language. In the study of numerical methods, we can make a general distinction between a set of methods such as solving linear systems of equations , solving matrix e

9、igenvalue problems , interpolation , numerical integration and finding the roots or zeros of equations , which can be somewhat 数值计算方法实验报告 2considered as the building blocks for larger that arise in engineering/applied mathematics/physics. For example the problem of solving ordinary differential equa

10、tions , optimisation and solvingintegral equations . But from the point of view of aplied mathematics or engineering, erhaps the most significant problems in numerical methods is the solution of partial differential equations by Finite Difference Methods , Finite Element Methods or Boundary Element

11、Methods . 数值分析是涉及计算数字数据的方法的研究。在许多问题中,这意味着一遍又一遍重复程序以产生近似值得序列。应用数值方法解决问题的人关心以下问题:收敛率(算法需要多久来找到答案) ,答案的准确性(或者有效性) ,响应的完整性(做其他的解决方案,另外一个发现,存在的话) 。数值方法提供了问题的近似答案。无论它是如何准确,它在大多数情况下也不会提供真切的答案。在某些情况下用不同的方式寻求确切的答案是不太可能的或也可能是太耗费时间,这就是数值计算方法最经常使用情况。计算机技术的不断进步使许多科学和工程应用数值方法来模拟物理现象。数值方法通常分为初级的,如找到一个方程的根,集成功能型向集约

12、型的,如有限元法求解线性系统的方程。密集的方法往往是解决实际问题的需要,他们往往需要系统应用一系列的基本方法,通常是数千或数百万次。在发展的数值方法中,简化是取得进展的解决方案所必需的,例如:大多函数可能需要近似多项式和计算机不能准确地表示数字。因此,数值方法通常不会给出给定问题确切的答案,或者它们在每次迭代中只能越来越密切地趋近解决方案。数值方法一般仅在当它们被电脑上的一种计算机编程语言实现时起作用。在研究数值方法中,我们可以得到一些一整套方法的大体特性,如求解线性方程组,求解矩阵特征值问题,插值,数值积分,发现根部或零方程组的,这些可以在一定程度上被视为解决工程/应用数学/物理问题的桥梁。

13、例如求解常微分方程,优化和解决的问题,积分方程。但是, 。用于数学或工程的角度来看,数值方法的最重要的问题是用有限差分法,有限元方法,边界元法解决偏微分方程。2. 误差计算数值计算方法实验报告 31.实验描述1根据习题12和习题13构造算法和MATLAB程序,以便精确计算所有情况下的二次方程的根,包括 的情况。24bac2参照1.25对3个差分方程计算出前十个数值的近似值,构造列表和图形。误差算法分别为 , , .nxrnpnxq2.实验内容1设 , ,且有方程 。通过如下二次根公式可解出方程的根:0a2-4cb2+=0abc(1)+-4x=, =x这些根还可通过下列等价公式解出:(2)22-

14、1, +44ccbaba2对下列三个差分方程计算出前10个数值近似值。在每种情况下引入一个小的初始误差。如果没有初始误差,则每个差分方程将生成序列 。用MATLAB构造生成图表。=12n(a) ,其中n=1,2,0-1=.94;2nrr(b) ,其中n=2,3, 1-23,.7,=nppp(c) , 其中n=2,3, 0-1-5=,.49,2qq3.实验结果及分析1.二次方程的的求根根据习题12所述,若b0,两个根为 = , = ;若b0output outputendNYY NY N数值计算方法实验报告 5表 1 序列= 以及近似值 , 和 /3nxnrpnqn xr0 1.00000000

15、0000000 0.994000000000000 1.000000000000000 1.000000000000000 1 0.500000000000000 0.497000000000000 0.497000000000000 0.4970000000000002 0.250000000000000 0.248500000000000 0.245500000000000 0.2425000000000003 0.125000000000000 0.124250000000000 0.119750000000000 0.1152500000000004 0.062500000000000

16、 0.062125000000000 0.056875000000000 0.0516250000000005 0.031250000000000 0.031062500000000 0.025437500000000 0.0198125000000006 0.015625000000000 0.015531250000000 0.009718750000000 0.0039062500000007 0.007812500000000 0.007765625000000 0.001859375000000 -0.0040468750000008 0.003906250000000 0.0038

17、82812500000 -0.002070312500000 -0.0080234375000009 0.001953125000000 0.001941406250000 -0.004035156250000 -0.01001171875000010 0.000976562500000 0.000970703125000 -0.005017578125000 -0.011005859375000表 2 误差序列 , 和 nxrnpnxqnnxrnp0 0.006000000000000 0.000000000000000 0.000000000000000 1 0.0030000000000

18、00 0.003000000000000 0.0030000000000002 0.001500000000000 0.004500000000000 0.0075000000000003 0.000750000000000 0.005250000000000 0.0157500000000004 0.000375000000000 0.005625000000000 0.0318750000000005 0.000187500000000 0.005812500000000 0.0639375000000016 0.000093750000000 0.005906250000000 0.12

19、79687500000017 0.000046875000000 0.005953125000000 0.2559843750000038 0.000023437500000 0.005976562500000 0.5119921875000059 0.000011718750000 0.005988281250000 1.02399609375001010 0.000005859375000 0.005994140625000 2.047998046875021 是误差稳定的,且按指数级递减,相差不大较为稳定,说明该序列和等比序列较为nr接近。 的误差不大较为稳定,但误差呈递增状态,所以其逼

20、近效果不如 。 的误p nrq数值计算方法实验报告 6差是不稳定的,变化幅度较大,即n越大,误差越大,说明当 时,误差可能比数值更n大。以下就是差分方程的的图形0 1 2 3 4 5 6 7 8 9 1001234567x 10-3nxn-rn图 1 稳定递减的误差序列 nxr数值计算方法实验报告 70 1 2 3 4 5 6 7 8 9 100123456x 10-3nxn-pn图 2 稳定的误差序列 nxp数值计算方法实验报告 80 1 2 3 4 5 6 7 8 9 1000.511.522.5nxn-pn图 3 不稳定的误差序列 nxq数值计算方法实验报告 94.结论1.运行程序后,当

21、输入a,b,c分别为0,0和0时,输出there are infinite roots当输入a,b,c分别为1,-1000000.000001和1时,输出x1= 1000000.000000000000,x2= 0.000001000000。对于特殊情况和高精度运算,算法能得出精确的值。由此我们可以得出我们所采用的算法可行。 2通过对于差分方程的求解可知,不同的差分方程的初始误差传播会随着其表达式的不同有很大差异性。因此,对于不同差分方程的选取问题和计算问题应慎重选择,选择稳定算法。数值计算方法实验报告 10附件(代码):1. function x1,x2=input(a,b,c)%input

22、 -a is the coefficient of x2% -b is the coefficient of x% -c is the Constant coefficient%output-x1 is one root of the equation% -x2 is one root of the equationif a=0xn=1./(2.n) %-n is the input-sequence%-xn is the value of the sequence(a)r0=0.994;r(1)=r0/2for n=2:10r(n)=r(n-1)/2;%-r(n) is the genera

23、l term of xn数值计算方法实验报告 11endr0,r(b)p0=1;p(1)=0.497;p(2)=3*p(1)/2-p0/2;for n=3:10p(n)=3*p(n-1)/2-p(n-2)/2;%-p(n) is the general term of pnendp0,p%- show all the items of pn(c)q0=1;q(1)=0.497;q(2)=5*q(1)/2-q0;for n=3:10q(n)=3*q(n-1)/2-q(n-2)/2;%-r(n) is the general term of pnendq0,q %- show all the it

24、ems of qn(3.1) r0=0.994;r(1)=r0/2for n=2:10r(n)=r(n-1)/2;%-r(n) is the general term of rnendrn=r0,rn=0:10;xn=1./(2.n);y=xn-rn %- show all the items of xn-rnplot(n,y,.)xlabel(n);数值计算方法实验报告 12ylabel(xn-rn);%- plot the figure of xn-rn(3.2)p0=1;p(1)=0.497;p(2)=3*p(1)/2-p0/2;for n=3:10p(n)=3*p(n-1)/2-p(n

25、-2)/2; %-p(n) is the general term of pnendzn=p0,p;n=0:10;xn=1./(2.n);z=xn-zn%- show all the items of xn-znplot(n,z,.)xlabel(n);ylabel(xn-pn);%- plot the figure of xn-zn(3.3)q0=1;q(1)=0.497;q(2)=5*p(1)/2-q0;for n=3:10q(n)=5*q(n-1)/2-q(n-2); %-q(n) is the general term of qnendqn=q0,q;n=0:10;xn=1./(2.n);w=xn-qn%- show all the items of xn-wnplot(n,w,.)xlabel(n);ylabel(xn-pn);%- plot the figure of xn-pn

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 中等教育 > 中学实验

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报