MATH 3311 (L2): Introduction to Numerical Methods Instructor: Prof. Jianping Gan Office: 3478; Email: [email protected]; Tel: 7421; Office hour: Wed: 16:30-17:30 Class schedule: 16:30-17:20 Tue. and Thu., Venue: 2407 Teaching Assistants: Taylor Michael ([email protected]); Yejun Gu ([email protected]) TA sessions: T2a, Mon. 17:50-18:20 rm5583 (Taylor Michael: mtaylor) T2b, Thur., 15:90-15:50, rm 2463(Yejun Gu: yguab); T2c, Wed., 12:30-13:20, rm 2463(Yejun Gu: yguab); Textbook: Numerical Analysis, 8th ed., by Burden, R.L. and Faires J. D., Thomson Brooks/Cole. http://www.as.ysu.edu/~faires/Numerical-Analysis Grading: Mid-term : 30%, March 27, 2013 Final : 70%, All materials taught in the whole semester will be tested, including those already tested in the midterm exam. But focus will be on those topics not covered in the midterm exam. (Exams are closed books and notes, and no formula sheets are provided. However, you are allowed to bring one 3in x 5in note card (front and back) to write whatever you think helpful or necessary. Calculators approved by Hong Kong Examinations and Assessment Authority (香港考試及評核局) are allowed. Use 5-digit rounding arithmetic in all calculations.) Assignments: Assigned and graded, but not marked. Solutions will be provided. MATH3311: Introduction to Numerical Methods • 1. Develop an understanding of the core ideas and concepts of Numerical Methods. • 2. Be able to recognize the power of abstraction and generalization, and to carry out investigative mathematical work with independent judgment. • 3. Be able to apply rigorous, analytic, highly numerate approach to analyze and solve problems using Numerical Methods. • 4. Be able to communicate problem solutions using correct mathematical terminology and good English. Topics: Introduction to computational world (Chapter 1) Root Finding (Chapter 2) Bisection method (2.1) Fixed-point iteration (2.2) Newton's method, Secant method (2.3) Interpolation (Chapter 3) Interpolation and the Lagrange (interpolating) polynomial (3.1) Divided differences and Newton's interpolatory divided-difference formula (3.2) Least Squares Data Fitting (chapter 8) Least squares data fitting--data fitting, modes, normal equation (8.1) Numerical Differentiation and Integration (Chapter 4) Numerical differentiation--forward, backward, and central finite differences (4.1) Elements of numerical integration (4.3) Composite rules (4.4) Gaussian quadrature--Gaussian node points, weights (4.7) Solution of Ordinary Differential Equations (Chapter 5) Euler's method (5.2) Solving Linear Systems (Chapters 6 & 7) Gauss elimination--multipliers, Gauss elimination, back substitution, pivoting (6.1 - 6.2) LU factorization--LU, forward substitution (6.5) Iterative methods--matrix splitting, Jacobi method, Gauss-Seidel method, SOR method (7.3) Error bounds and iterative refinement (7.4) Chapter 1 A: Introduction to Computational World • Numerical Method? Example 1: λ a0 = b0e + c0 λ λ ( e − 1) λ can not be solved analytically or by algebraic methods. λ can be solved by numerical method. Example 2: df f ( x0 + ∆x ) − f ( x0 ) = f ' ( x0 ) = lim dx ∆x ∆x →0 f ( x0 + ∆x ) − f ( x0 ) f ' ( x0 ) ≈ ∆x f (x) x = x0 − ∆x x = x0 x = x0 + ∆x ∆x2 ∆x3 f ( x0 ± ∆x) = f ( x0 ) ± f ' ( x0 )∆x + f ' ' ( x0 ) ± f ' ' ' ( x0 ) ± ... 2! 3! f ( x0 + ∆x) − f ( x0 ) f ( x0 + ∆x) − f ( x0 ) f ' ( x0 ) = +R≈ ∆x ∆x or f ( x0 ) − f ( x0 − ∆x) f ( x0 ) − f ( x0 − ∆x) f ' ( x0 ) = +R≈ ∆x ∆x Truncation error Round-off Error 3• 3 =3 In a machine (computer), only a fixed and finite number digits are used to represent 3 • 3 = 2.99999999... The error that results from replacing a number with its floating-point form is called round-off error. For 64 bit-binary digits, < 2 − 1022 Underflow: Overflow: > 2 1023 • ( 2 − 2 − 52 ) If p* is an approximation to p, then p − p* p − p* p Absolute error Relative error Algorithms Example of Algorithms: N An algorithm to compute ∑ i =1 xi = x1 + x 2 + ...... + x N , Where N and the numbers x 1 , x 2 ,....., x N are given, is Described by the following: INPUT N , x 1 , x 2 ,..., x N OUTPUT sum = STEP1 STEP2 STEP3 ∑ N i =1 xi set sum = 0 For i = 1 , 2 ,... N do set sum = sum + x i (add the next term) OUTPUT STOP ( sum ); Stable and Unstable: En (error) Unstable exponential error growth, En=CnE0 Stable exponential error growth, En=CnE0 n (number of iteration) Stable: An algorithm has feature that small changes in the initial data produce correspondingly small changes in the final result Example: 1 n ) + c2 3n 3 1 with p 0 = 1 , p 1 = , we have c 1 = 1 , c 2 = 0 3 1 pn = ( )n 3 p n = c1 ( Using five-digit rounding arithmetic (note: if 5th+1 digit ≥5, add 1 to the 5th digit. Otherwise keep the first 5 digits.), p0 = 1.0000, p1 = 0.3333, so, c1 = 1.0000, c2 = −0.125 × 10−5 1 n pˆ n = 1.0000( ) − 0.125 × 10−5 (3)n 3 Round-off error: pn − pˆ n = 0.125 × 10−5 (3)n Growth exponentially (unstable) Example: pn = c1 + c2n; 1 2 with p0 = 1, p1 = , we have c1 = 1, c2 = − , so 3 3 2 pn = 1 − n 3 For five-digit rounding arithmetic, p0 = 1.0000, p1 = 0.3333,c1 = 1.0000, c2 = −0.6667 pˆ n = 1.000 − 0.6667n 2 p − pˆ n = (0.6667 − )n 3 Growth linearly (stable) Convergence: Suppose {β } ∞ n n =1 → 0 , {α } ∞ n n =1 →α α n − α ≤ k β n for large n , k is a positive constant ∞ We say {α n }n =1 converges to α O( βn ) In general, βn = with rate of convergence 1 , p >0 p n 1 so α n = α + O ( p ) n Example: n +1 n+3 α n = 2 , αˆ n = 3 n n Both series approach zero as n reaches ∞. However, 4 α̂ n 2 n +1 n + n 1 ≤ = 2 = 2βn 2 2 n n n n + 3 n + 3n 1 = 4 = 4βn αˆ n − 0 = 3 ≤ 3 2 n n n 1 so, α n = 0 + O ( ); n The convergence rate (to zero) 1 for and are and , αˆ n = 0 + O ( 2 ) respectively. n αn − 0 = αn B: MATLAB Introduction The name MATLAB stands for matrix laboratory. Features: • • • • • • • Math and computation Algorithm development Data acquisition Modeling, simulation, and prototyping Data analysis, exploration, and visualization Scientific and engineering graphics Application development, including graphical user interface building. In short, MATLAB integrates data structure, programming and graphical user interface together. On Windows platforms, start MATLAB by double-clicking the MATLAB shortcut icon on your Windows desktop. MATLAB Desktop • Use desktop tools to manage your work in MATLAB. You can also use MATLAB functions to perform the equivalent of most of the features found in the desktop tools. Matlab major features and applications • Desktop Tools and Development Environment • The MATLAB Mathematical Function Library • The MATLAB Language • Graphics • MATLAB External Interfaces Command Window • Use the Command Window to enter variables and to run functions and M-file scripts. Ex 1. Ex 2. Command History • Statements you enter in the Command Window are logged in the Command History. From the Command History, you can view and search for previously run statements, as well as copy and execute selected statements. You can also create an M-file from selected statements. Help Browser • To open the Help browser, click the Help button in the desktop toolbar. • The Help browser consists of two panes, the Help Navigator, which you use to find information, and the display pane, where you view the information. Current Directory Workspace Browser • The MATLAB workspace consists of the set of variables (named arrays) built up during a MATLAB session and stored in this temporary memory. The features (e.g. dimension and data type) of these variables can be viewed in the workspace and these stored variables can be used in the subsequent calculation. • To delete variables from the workspace, select the variables and select Edit > Delete. Alternatively, use the clear function. • The core of MATLAB is array and matrix to conduct calculation and to store data. Creating Matrices Array Editor • Double-click a variable in the Workspace browser, or use openvar variablename, to see it in the Array Editor. Use the Array Editor to view and edit a visual representation of variables in the workspace. Adding and Subtracting Matrices Working with Workspace Use mathematical functions in Matlab Polynomials • Polynomials p(x) = x3 – 6x2 – 11x – 6 is represented as • The roots function calculates the roots of a polynomial: • The function poly returns the polynomial coefficients: Interpolation Interpolation • Linear interpolation (default) • Nearest neighbor interpolation • Cubic spline interpolation Running M-files in the Editor/Debugger
© Copyright 2026 Paperzz