《Numerical Methods》由会员分享,可在线阅读,更多相关《Numerical Methods(95页珍藏版)》请在金锄头文库上搜索。
1、Numerical Methods,Numerical Methods Using MATLAB, Fourth EditionBy John H. Mathews and Kurtis D. Finkhttp:/,Textbook:,Software:,MATLAB , MathWorks Inc.,Plan for the Course,Time: 48h= 40h for lectures of the methods + 8h for Usage of MATLAB,Score: 30% from exercises and MATLAB programming + 70% from
2、the final examination,Please send me your homework, including exercises andprograms, in electronic version.,Introduction,In engineering, we need :to calculate many complex mathematical expressions, such as ex, sin(x)ln(1+x2).to find the solutions of many equations, such as design constraints distanc
3、e(p1,p2)=2.0* distance(p1,p3). 3. to evaluate the performance of a designed product by solving some physical equations, such as differential equations for stress distributions and flow fields.,Introduction,We may already know the math expression, but we more concern the values of variables which app
4、ears in engineering practices. This course will introduce the popular methods which let you obtain these values under the help of computers.,Introduction,General numerical methods:Discretion Continuous - DiscreteIteration xk+1=g(xk)Approximation Replaced by simpler one,Contents,Number representation
5、 and error analysisSolving nonlinear equationsSolving linear equationsInterpolation and approximation5. Curve fittingNumerical differentialNumerical integrationSolving differential equationsEigenvalues and eigenvectors,Number Representation & Error Analysis,Binary number,Decimal number,1563=1103+510
6、2+6101+3100 =1000+500+60+3=1563ten,1563=1210+129+028+027+026+025+124 +123+022+121+120=1024+512+0+0+0+0+16+8+0+2+1=11000011011two,The number is expressed as the sum of terms of ten to the power of n.,The number is expressed as the sum of terms of two to the power of n.,1563=2781+1, b0=1781=2390+1, b1
7、=1390=2195+0, b2=0195=297+1, b3=197=248+1, b4=148=224+0, b5=024=212+0, b6=012=26+0, b7=06=23+0, b8=03=21+1, b9=11=20+1, b10=11563=b10b9b8b7b6b5b4b3b2b1b0=11000011011two,Compute binary numbers from decimal numbers:,bi is the remainder,2 is the divisor,The quotient is divided further,The process is en
8、ded when the quotient is zero.,R=d12-1+d22-2+dn2-n+=0.d1d2dn two =0.10110 0110 0110 0110two,Binary fractions:,2R=d1+d22-1+dn2-n+1+d1=(int)(2R)F1=frac(2R)=d22-1+dn2-n+1+d2=(int)(2F1)F2=frac(2F1),R=d12-1+d22-2+dn2-n+=0.d1d2dn twoR= =0.7=0.10110 0110 0110 0110two,2R =1.4 d1=int(1.4)=1, F1=frac(1.4)=0.4
9、2F1=0.8 d2=int(0.8)=0, F2=frac(0.8)=0.82F2=1.6 d3=int(1.6)=1, F3=frac(1.6)=0.62F3=1.2 d4=int(1.2)=1, F4=frac(1.2)=0.22F4=0.4 d5=int(0.4)=0, F5=frac(0.4)=0.42F5=0.8 d6=int(0.8)=0, F6=frac(0.8)=0.82F6=1.6 d7=int(1.6)=1, F7=frac(1.6)=0.6,x=q2nq=0.d1d2dm two, d1=1q is the mantissa, n is the exponentFor
10、a computer, the number m is fixed, e.g. 32.x=0.1d2dm2n,Machine Numbers,Single-precision real number (32 bits): q=24, n=8Double-precision real number (64 bits): q=53, n=11,q,n,A binary digit,-0.11010011213,1,1,1,1,0,0,1,1,0,0,0,1,1,1,13ten=+1101two,Floating-point: the binary point position is not fix
11、ed!,Machine Accuracy,Its machine number for a 32-bit mantissa machine,The error is the following:,(When chopping-off is adopted. The other is the method of rounding-off),Repeated,See the error from the following example (for 4-bit mantissa):,1.00111 1.010,1.,Rounding:,Rounding:,0.11111*2-1 1.000*2-1
12、=0.1000*20,Error Analysis,Absolute error: Ex=|x-x|, Relative error: Rx=|x-x|/|x|,Suppose x is the accurate number and x is the approximatenumber. (Suppose they are known),Significant digits, the largest d satisfying : Rx=|x-x|/|x| 0.5101-d,x=3.141592, x=3.14, |x-x|/x=0.0005070.510-2, d=3x=1,000,000,
13、 x=999,996,|x-x|/x=0.0000040.510-5, d=6x=0.000012, x=0.000009, |x-x|/x=0.250.5100, d=1,x=3.141592, x=3.14, |x-x|/x=0.0005070.510-2, d=3|3.141592-3.14 |/3.141592=0.000507 0.507*10-3=0.0507*10-20.510-2-x=3.141592, x=3.1483, |x-x|/x=0.0021358970.005=0.510-2 d=3The two approximations have the same numbe
14、r of significant digits!,For example,The meaning of Significant Digits:,So, the precision for mantissa is mainly related to relative error R :,x=0.343434 X=0.343678 d=4, a =3434.34 a =3436.00|a-a|=1.66,| a-a | 5,When significant digit is d, there is:And for any larger d, the inequality cannot be sat
15、isfied.,| a-a | 5,The meaning of Significant Digits:,x=0.343434x=0.343678d=2, 0.340000E=0.0034340.005d=3, 0.343000E=0.0004340.0005d=4, 0.343600E=0.0001660.0005d=5, 0.343670E=0.0002360.0005d=6, 0.343678E=0.0002440.0005,Generally, d is the number of the digits that are maintained for the best approximation.,