1 / 13

Introduction to Numerical Analysis Course

Learn classical approximation techniques, understand when and why they work, and build a foundation for scientific computing.

lorraines
Download Presentation

Introduction to Numerical Analysis Course

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Q1:What is numerical analysis for? Q2:What is this course for? Input Computer Output     Approximations NA • To give an introduction to classical approximation technique • To explain how, why, and when they can be expected to work • To provide a firm basis for future study of scientific computing 1/13

  2. Example: Approximate Solution: Use Taylor expansion of S4 R4/* Remainder */ Take Chapter 1Mathematical Preliminaries  1.2 Roundoff Errors and Computer Arithmetic = 0.747… … | Total error | < 0.006 Roundoff error (by included terms) < 0.00052 = 0.001 Truncation error (by excluded terms) < 0.005 2/13

  3. Chapter 1 Mathematical Preliminaries -- Roundoff Errors and Computer Arithmetic Normalized decimal floating-point form of a real number: where 1  d1  9 and 0  di  9 ( i = 2, …, k ) Given a real number y = 0.d1d2 … dkdk+1dk+2 …  10n /* Chopping */ /* Rounding */ Truncation Error:the error involved in using a truncated, or finite, summation to approximate the sum of an infinite series. Roundoff Error:the error produced when performing real number calculations. It occurs because the arithmetic performed in a machine involves numbers with only a finite number of digits. k-digit decimal machine number 3/13

  4. Chapter 1 Mathematical Preliminaries -- Roundoff Errors and Computer Arithmetic Definition: The number p* is said to approximate p to tsignificant digits (or figures) if t is the largest nonnegative integer for which Chopping: Rounding: Definition: If p* is an approximation to p, the absolute error is | p – p* |, and the relative error is | p – p* | / | p |, provided that p 0. Of course mine is more accurate ! The accuracy relates to not only the absolute error, but also to the size of the exact value. I can tell that distance between two planets is 1 million light year ±1 light year. I can tell that this part’s diameter is 20cm1cm. 4/13

  5. Chapter 1 Mathematical Preliminaries -- Roundoff Errors and Computer Arithmetic How will roundoff error affect our results?  Subtraction of nearly equal numbers will cause a cancellation of significant digits. Example:a1 = 0.12345 and a2 = 0.12346 both have 5 significant digits. However, a2 a1 = 0.00001 has only 1 significant digit left.  Dividing by a number with small magnitude (or, equivalently, multiplying by a number with large magnitude) will cause an enlargement of the error. Remember: always simplify your formulae before you give them to your computer! 5/13

  6. Chapter 1 Mathematical Preliminaries -- Roundoff Errors and Computer Arithmetic Solution: Example: Find the roots of x2 + 62.10x + 1 = 0, using 4-digit rounding. The roots are x1 0.01610723 and x2  62.08390.  Relative error  24%  Relative error  0.032%  An alternative approach: 6/13

  7. Chapter 1 Mathematical Preliminaries -- Roundoff Errors and Computer Arithmetic x x2 x3 6.1x2 3.2x Exact 4.71 22.1841 104.487111 135.32301 15.072 Chopping 4.71 22.1 104. 134. 15.0 Rounding 4.71 22.2 105. 135. 15.1 Chopping = –14.2;Rounding = –14.3 Relative error (Chopping)  0.45% Relative error (Rounding)  0.25% Example: Evaluate f(x) = x3 – 6.1x2 + 3.2x + 1.5 at x = 4.71 using 3-digit arithmetic. HW: p.27-28 #3, 11, 17(b) Exact = –14.263899;Chopping = –13.5;Rounding = –13.4 Relative error (Chopping)  5%; Relative error (Rounding)  6%  An alternative approach: f(x) = x3 – 6.1x2 + 3.2x + 1.5 = ((x – 6.1) x + 3.2) x + 1.5 秦九韶算法 Horner’s Method 7/13

  8. Chapter 1 Mathematical Preliminaries The following problem can be solved either the easy way or the hard way. Two trains 200 miles apart are moving toward each other; each one is going at a speed of 50 miles per hour. A fly starting on the front of one of them flies back and forth between them at a rate of 75 miles per hour. It does this until the trains collide and crush the fly to death. What is the total distance the fly has flown? The fly actually hits each train an infinite number of times before it gets crushed, and one could solve the problem the hard way with pencil and paper by summing an infinite series of distances. The easy way is as follows: Since the trains are 200 miles apart and each train is going 50 miles an hour, it takes 2 hours for the trains to collide. Therefore the fly was flying for two hours. Since the fly was flying at a rate of 75 miles per hour, the fly must have flown 150 miles. That's all there is to it. When this problem was posed to John von Neumann, he immediately replied, "150 miles." "It is very strange," said the poser, "but nearly everyone tries to sum the infinite series." "What do you mean, strange?" asked Von Neumann. "That's how I did it!"  1.3 Algorithms and Convergence 8/13

  9. Chapter 1 Mathematical Preliminaries -- Algorithms and Convergence The Colonel's Order A COLONEL ISSUED THE FOLLOWING DIRECTIVE TO HIS EXECUTIVE OFFICERS:"Tomorrow evening at approximately 20:00Halley's Comet will be visible in this area; an event which occurs only every 75 years. Have the men fall out in the battalion area in fatigues, and I will explain this rare phenomenon to them. In case of rain, we will not be able to see anything, so assemble the men in the theater and I will show them films of it." EXECUTIVE OFFICER TO COMPANY COMMANDER:"By order of the Colonel, tomorrow at 20:00, Halley's Comet will appear above the battalion area. If it rains, fall the men out in fatigues, then march to the theater where this rare phenomenon will take place, something which occurs only once every 75 years." COMPANY COMMANDER TO LIEUTENANT: "By order of the Colonel be in fatigues at 20:00 tomorrow evening the phenomenal Halley's Comet will appear in the theater. In case of rain in the battalion area, the Colonel will give another order, something which occurs once every 75 years."LIEUTENANT TO SERGEANT: "Tomorrow at 20:00, the Colonel will appear in the theater with Halley's comet, something which happens every 75 years. If it rains, the Colonel will order the comet into the battalion area." SERGEANT TO SQUAD: "When it rains tomorrow at 20:00, the phenomenal 75-year-old General Halley, accompanied by the Colonel, will drive his comet through the battalion area theater in fatigues." 9/13

  10. Chapter 1 Mathematical Preliminaries -- Algorithms and Convergence Definition: An algorithm that satisfies that small changes in the initial data produce correspondingly small changes in the final results is called stable; otherwise it is unstable. An algorithm is called conditionally stable if it is stable only for certain choices of initial data. Definition: Suppose that E0 > 0 denotes an initial error and Enrepresents the magnitude of an error after n subsequent operations. If En C n E0, where C is a constant independent of n, then the growth of error is said to be linear. If En CnE0, for some C > 1, then the growth of error is called exponential. Note: Linear growth of error is usually unavoidable, and when C and E0 are small the results are generally acceptable. Exponential growth of error should be avoided since the term Cn becomes large for even relatively small values of n. This leads to unacceptable inaccuracies, regardless of the size of E0. 10/13

  11. Chapter 1 Mathematical Preliminaries -- Algorithms and Convergence Example: Evaluate  Method 1: This is theoretically accurate. What happened?! ? Unstable! ?? ? ! ! ! 11/13

  12. Chapter 1 Mathematical Preliminaries -- Algorithms and Convergence  Method 2: Excuses for not doing homework I accidentally divided by zero and my paper burst into flames. Take We may take We just got lucky? HW: p.38 #7 This is theoretically equivalent to the previous formula. Stable! 12/13

  13. Chapter 1 Mathematical Preliminaries -- Algorithms and Convergence Lab 01. Numerical Summation of a Series Time Limit: 1 second; Points: 4 Produce a table of the values of the series (1) for the 3001 values of x, x = 0.0, 0.1, 0.2, …, 300.00. All entries of the table must have an absolute error less than 1.0e-10. This problem is based on a problem from Hamming (1962), when mainframes were very slow by today's microcomputer standards. 13/13

More Related