1 / 55

Chapter 1 Introduction

This chapter provides an introduction to scientific computing, including an overview of computational errors and how they propagate in basic arithmetic operations. It discusses the importance of numerical analysis and its application to various scientific disciplines. The chapter also explores the concept of truncation error and the Taylor theorem.

lspellman
Download Presentation

Chapter 1 Introduction

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. Chapter 1Introduction Prof. Chuan-Ming Liu MCSE Lab, NTUT TAWIAN MCSE Lab, NTUT

  2. Outline • Scientific Computing • Computational Errors • Error Propagation • Error Propagation in Basic Arithmetic Operations MCSE Lab, NTUT

  3. Scientific Computing Scientific computing The interface of Computer Science, Engineering and Applied Mathematics. MCSE Lab, NTUT

  4. Scientific Computing • People want the methods to be fast and accurate. • Applications of Scientific Computing • Fluid dynamics • Material science • Semiconductor device simulation • Weather modeling • Computational biology • Econometrics and computational finance • Computer graphics MCSE Lab, NTUT

  5. Scientific Computing • In this course, we will consider the time complexity and accuracy for the solutions to some problems. • Time complexity relates to the algorithm analysis. • Accuracy relates to mathematic analysis. MCSE Lab, NTUT

  6. Scientific Computing • Why do we need numerical analysis (methods)? • It is all about the reality. • Example: consider a 3D solid if revolution can be created by revolving the curve y = r(x) about the x-axis. MCSE Lab, NTUT

  7. y y = r(x) x z Scientific Computing • If r(x) is simple, e.g. r(x) = ex , then close form solution MCSE Lab, NTUT

  8. Scientific Computing • If r(x) is not simple, for example it is not possible to get the close form: MCSE Lab, NTUT

  9. Scientific Computing • Numerical analysis then comes in. • To obtain the (approximated) value of V, we can subdivide the interval [0, 1] into n equal subintervals as MCSE Lab, NTUT

  10. Scientific Computing • Rewrite the integration into the sum MCSE Lab, NTUT

  11. constructing solving Physicalphenomena Mathematical models Mathematical solutions explanation or prediction Scientific Computing • Note: what we did here is the rectangular rule, we will discuss this rule later in this course. • In practice, many problems do not have a close form solution. MCSE Lab, NTUT

  12. L θ m mgsinθ mg Scientific Computing • Example: motion of a pendulum L: string length θ: the angle, a function of time t. Using Newton’s second law, we can get the following model MCSE Lab, NTUT

  13. Scientific Computing • Initial-value problems MCSE Lab, NTUT

  14. Scientific Computing • The general solution MCSE Lab, NTUT

  15. Scientific Computing MCSE Lab, NTUT

  16. Scientific Computing • Note: • Note: This close form is inaccurate when θdoes not approach to 0. MCSE Lab, NTUT

  17. Scientific Computing • Discussion on the first example (Integration) • discretization • discretization error • how the error is OK • efficiency • The scientific computing is used to denote the use of numerical methods in a complex hardware and software environment to solve models from various scientific disciplines. MCSE Lab, NTUT

  18. 3 Ω 5 Ω 1 2 100 v 10 Ω a 2 Ω 6 Ω 1 Ω 3 b 1 Ω 7 Ω 0 v 6 5 4 Scientific Computing • Example: consider the electrical network obtain the voltages at nodes 1 through 6. MCSE Lab, NTUT

  19. Scientific Computing MCSE Lab, NTUT

  20. Scientific Computing MCSE Lab, NTUT

  21. Scientific Computing MCSE Lab, NTUT

  22. Scientific Computing MCSE Lab, NTUT

  23. Scientific Computing • In this course, we will learn many numerical methods as well as how to tell a method is good or not. First of all, we start with the “computational error”. MCSE Lab, NTUT

  24. Computational Errors • The computational error comes from: • Machine representation • Number representation • Round off errors • Rounding • Chopping • Rounding up • Rounding down • Formula for the problem • Truncation error MCSE Lab, NTUT

  25. 0 ∞ -∞ real number Computational Errors • Roundoff errors • finite precision numbers present infinite precision numbers • The result of an operation on two machine-representable numbers is not necessarily a machine-representable number. MCSE Lab, NTUT

  26. Computational Errors 11 digits e.g. : a = 9.99*104 and b = 9.99*10-4 a + b = (9.99+9.99*10-8)*10-4 =9.9900000999*104. Suppose the machine only computes to 6-digits.Then, a + b = 9.99*104 =>b has no effect !! (why ?) However, a/b = 108 a*b = 99.8001 are still valid (why ?) The reason will be discussed later 6-digit representation is OK with the result MCSE Lab, NTUT

  27. Truncation error Computational Errors • Truncation error • Occurs when applying a formula MCSE Lab, NTUT

  28. Please review how to calculate the derivatives for some common functions e.g. ex, sinx, logx Taylor Theorem MCSE Lab, NTUT

  29. Taylor Theorem • Pn(x) is the nth Taylor polynomial for f about x0 • Rn(x) is the remainder term (or truncation error) associated with Pn(x). • The infinite series obtained by taking n ∞ is called the Taylor series for x about x0 • When x0 = 0, the Taylor polynomial is often called a Maclaurin polynomialand the Taylor series is called a Maclaurin series. MCSE Lab, NTUT

  30. Taylor Theorem -Example • Determine (a) the second and (b) the third Taylor polynomials for f(x) = cosx about x0 = 0 and use these polynomials to approximate cos(0.01) • (a) MCSE Lab, NTUT

  31. Taylor Theorem - Example (b) exercise. MCSE Lab, NTUT

  32. Computational Errors approximation of derivative of function f. Let f be a function. Obtain the derivative at a where f is cont. on [a-h, a+h]. MCSE Lab, NTUT

  33. Computational Errors MCSE Lab, NTUT

  34. actual f ’(a) approximate f ’(a) a-h a a+h MCSE Lab, NTUT

  35. Computational Errors • The more terms use to estimate, the more accurate the answer is MCSE Lab, NTUT

  36. Computational Errors • Absolute v.s. relativeerrors • If P* is an approximation to P, • |P*-P| is the absolute error. • | P*-P |/|P| where |P|≠0 is the relative error. • Error tolerance • A computation is acceptable if the error (absolute or relative) is no more than a specific error tolerance. • |computed solution – exact solution| < tolerance i.e. | P*-P | < tol or |P*-P|/|P| < tol. MCSE Lab, NTUT

  37. Computational Errors • Error tolerances should be part of the specifications of an algorithm. • High accuracy usually needs high cost! • Accuracy appr. MCSE Lab, NTUT

  38. Computational Errors • The number of decimal places of accuracy, d, for fixed error, |error| = 10-dis given by d = -log10|error|, i.e. the approximation has d accurate decimal places. • example MCSE Lab, NTUT

  39. Computational Errors MCSE Lab, NTUT

  40. Computational Errors • example MCSE Lab, NTUT

  41. Error Propagation • Error Propagation (overall) MCSE Lab, NTUT

  42. Error Propagation MCSE Lab, NTUT

  43. Error Propagation • Example: c = ? MCSE Lab, NTUT

  44. Error Propagation • Sol. MCSE Lab, NTUT

  45. Error Propagation • The sensitivity of a problem is indicated by the relative dependence of output error to input error. • Definition: MCSE Lab, NTUT

  46. Error Propagation in Basic Arithmetic Operations • Error Propagation in Arithmetic Operations MCSE Lab, NTUT

  47. Error Propagation in Basic Arithmetic Operations MCSE Lab, NTUT

  48. (1+x)-1 = 1-x+x2+… Error Propagation in Basic Arithmetic Operations MCSE Lab, NTUT

  49. Error Propagation in Basic Arithmetic Operations MCSE Lab, NTUT

  50. Error Propagation in Basic Arithmetic Operations • Avoiding cancellation errors • Rationalization • Taylor expansion (two nearly equal numbers) MCSE Lab, NTUT

More Related