Introduction to Numerical Methods and Applications

cise 301 numerical methods topic 1 introduction n.w
1 / 73
Embed
Share

Explore the fundamental concepts of numerical methods, including Taylor series, algorithms for obtaining numerical solutions, basic requirements, and techniques for solving nonlinear equations and linear systems. Dive into topics such as interpolation, numerical integration, and differential equations, with practical examples and applications.

  • Numerical Methods
  • Taylor Series
  • Algorithms
  • Nonlinear Equations
  • Linear Systems

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM CISE301_Topic1 1

  2. Lecture 1 Introduction to Numerical Methods What are NUMERICAL METHODS? Why do we need them? Topics covered in CISE301. Reading Assignment: Pages 3-10 of textbook CISE301_Topic1 2

  3. Numerical Methods Numerical Methods: Algorithms that are used to obtain numerical solutions of a mathematical problem. Why do we need them? 1. No analytical solution exists, 2. An analytical solution is difficult to obtain or not practical. CISE301_Topic1 3

  4. What do we need? Basic Needs in the Numerical Methods: Practical: Can be computed in a reasonable amount of time. Accurate: Good approximate to the true value, Information about the approximation error (Bounds, error order, ). CISE301_Topic1 4

  5. Outlines of the Course Taylor Theorem Number Representation Solution of nonlinear Equations Interpolation Numerical Differentiation Numerical Integration Solution of linear Equations Least Squares curve fitting Solution of ordinary differential equations Solution of Partial differential equations CISE301_Topic1 5

  6. Solution of Nonlinear Equations Some simple equations can be solved analytically: 0 3 4 = + + x x 2 2 4 4 1 ( 4 )( 3 ) = Analytic solution roots 1 ( 2 ) = = 1 3 x and x Many other equations have no analytical solution: = e x 9 2 + x = 2 5 0 x x analytic No solution CISE301_Topic1 6

  7. Methods for Solving Nonlinear Equations o Bisection Method o Newton-Raphson Method o Secant Method CISE301_Topic1 7

  8. Solution of Systems of Linear Equations + = 3 = x x 1 2 x + 2 5 x 1 2 We x can = x solve x it as : + = 3 , x 3 2 5 x x 1 2 2 2 = = = , 2 3 2 1 2 1 What to do if we have equations 1000 unknowns. 1000 in CISE301_Topic1 8

  9. Cramers Rule is Not Practical solve to used be can Rule s Cramer' system the : 3 1 1 3 5 2 1 5 = = = = , 1 2 x x 1 2 1 1 1 1 1 2 1 2 But Cramer' Rule s is not practical for problems. large + To solve equations N with unknowns, N we need (N 1)(N 1)N! multiplica tions. 35 To system, 30 by 30 a solve 2.3 10 multiplica tions needed. are 20 super A computer needs more than 10 years compute to this. CISE301_Topic1 9

  10. Methods for Solving Systems of Linear Equations o Naive Gaussian Elimination o Gaussian Elimination with Scaled Partial Pivoting o Algorithm for Tri-diagonal Equations CISE301_Topic1 10

  11. Curve Fitting Given a set of data: x y 0 0.5 1 10.3 2 21.3 Select a curve that best fits the data. One choice is to find the curve so that the sum of the square of the error is minimized. CISE301_Topic1 11

  12. Interpolation Given a set of data: xi 0 yi 0.5 1 10.3 2 15.3 Find a polynomial P(x) whose graph passes through all tabulated points. y = ( ) is in the table P x if x i i i CISE301_Topic1 12

  13. Methods for Curve Fitting o Least Squares o Linear Regression o Nonlinear Least Squares Problems o Interpolation o Newton Polynomial Interpolation o Lagrange Interpolation CISE301_Topic1 13

  14. Integration Some functions can be integrated analytically: 3 3 1 9 1 = = = 2 4 xdx x 2 2 2 1 1 But many functions analytical no have solutions : a 2 dx = x ? e 0 CISE301_Topic1 14

  15. Methods for Numerical Integration o Upper and Lower Sums o Trapezoid Method o Romberg Method o Gauss Quadrature CISE301_Topic1 15

  16. Solution of Ordinary Differential Equations solution t A t x = differenti the o t x = + equation al : + ( ) 3 ( ) 3 = ( ) 0 x t ) 0 ( x ; 1 ) 0 ( x 0 function a is that satisfies equations. the x(t) Analytical * solutions available are for special cases only. CISE301_Topic1 16

  17. Solution of Partial Differential Equations Partial Differential Equations are more difficult to solve than ordinary differential equations: 2 2 u u + + = 2 0 2 2 x t = = = , 0 ( u ) , 1 ( u ) , 0 ( ) 0 , x sin( ) t t u x CISE301_Topic1 17

  18. Summary Topics Covered in the Course Numerical Methods: Algorithms that are used to obtain numerical solution of a mathematical problem. We need them when No analytical solution exists or it is difficult to obtain it. Solution of Nonlinear Equations Solution of Linear Equations Curve Fitting Least Squares Interpolation Numerical Integration Numerical Differentiation Solution of Ordinary Differential Equations Solution of Partial Differential Equations CISE301_Topic1 18

  19. Lecture 2 Number Representation and Accuracy Number Representation Normalized Floating Point Representation Significant Digits Accuracy and Precision Rounding and Chopping Reading Assignment: Chapter 3 CISE301_Topic1 19

  20. Representing Real Numbers You are familiar with the decimal system: + = + + + 2 1 0 1 2 312 45 . 3 10 1 10 2 10 4 10 5 10 Decimal System: Base = 10 , Digits (0,1, ,9) Standard Representations: 3 1 2 . 4 5 sign integral fraction part part CISE301_Topic1 20

  21. Normalized Floating Point Representation Normalized Floating Point Representation: n . 0 10 d d d d 1 2 3 4 sign mantissa exponent , 0 : integer d n 1 No integral part, Advantage:Efficient in representing very small or very large numbers. CISE301_Topic1 21

  22. Calculator Example Suppose you want to compute: 3.578 * 2.139 using a calculator with two-digit fractions * = 3.57 2.13 7.60 7.653342 True answer: CISE301_Topic1 22

  23. Binary System Binary System: Base = 2, Digits {0,1} n . 0 1 2 b b b 2 3 4 sign mantissa exponent = 0 1 b b 1 1 = + + = 1 2 3 . 0 ( 101 ) 1 ( 2 0 2 1 2 ) . 0 ( 625 ) 2 10 10 CISE301_Topic1 23

  24. 7-Bit Representation (sign: 1 bit, mantissa: 3bits, exponent: 3 bits) CISE301_Topic1 24

  25. Fact Numbers that have a finite expansion in one numbering system may have an infinite expansion in another numbering system: = ) 1 . 0 ( . 0 ( 0001100110 01100 ...) 10 2 You can never represent 0.1 exactly in any computer. CISE301_Topic1 25

  26. Representation Hypothetical Machine (real computers use 23 bit mantissa) Mantissa: 3 bits Exponent: 2 bits Sign: 1 bit Possible positive machine numbers: .25 .3125 .375 .4375 .5 .625 .75 .875 1 1.25 1.5 1.75 CISE301_Topic1 26

  27. 1 Representation Gap near zero 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -0.8 -1 CISE301_Topic1 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 27

  28. Remarks Numbers that can be exactly represented are called machine numbers. Difference between machine numbers is not uniform Sum of machine numbers is not necessarily a machine number: 0.25 + .3125 = 0.5625 (not a machine number) CISE301_Topic1 28

  29. Significant Digits Significant digits are those digits that can be used with confidence. CISE301_Topic1 29

  30. Significant Digits - Example 48.9 CISE301_Topic1 30

  31. Accuracy and Precision Accuracy is related to the closeness to the true value. Precision is related to the closeness to other estimated values. The degree of precision in a measurement is shown by using significant digits. CISE301_Topic1 31

  32. CISE301_Topic1 32

  33. How Many Significant Digits? By convention, a measurement is recorded by writing all exactly known numbers and 1 number which is uncertain, together with a unit label. Example: Blue line is 2.73 cm long. This measurement has 3 significant digits. First 2 digits (2.7 cm) are exactly known Third digit (0.03 cm) is uncertain because it was estimated 1 digit beyond the smallest graduation. CISE301_Topic1 33

  34. How Many Significant Digits? (Contd.) Rule: all non-zero digits are significant Rule: zeros between non-zero digits are significant Example: 205 m 3 SD Rule: zeros to the left of the first non-zero digit are NOT significant Example: 0.00345 s 3 SD Example: 2.00345 s 6 SD CISE301_Topic1 34

  35. How Many Significant Digits? (Contd.) Rule: if a number has a decimal point, then trailing zeros are significant Example: 0.275000 m 6 SD Example: 267.000 m 6 SD Rule: if a number has NO decimal point, then trailing zeros are NOT significant Example: 275 000 m 3 SD Example: 275 000. m 6 SD CISE301_Topic1 35

  36. How Many Significant Digits? (Contd.) Rule: for addition and subtraction, the answer has the same precision as the measurement with the LEAST precision Example: 375.4 m + 2.54 m = ? 377.9 m Rule: for multiplication and division, the answer has the same number of significant figures as the measurement with the FEWEST significant digits Example: (20.0 m)(3.0 m) = ? 60. m or 6.0 x 101 m CISE301_Topic1 36

  37. SDs Addition and Subtraction When adding or subtracting do NOT extend the result beyond the first column with a doubtful figure. For example,

  38. SDs Addition and Subtraction What is 16.874 + 2.6? What is 16.874 - 2.6?

  39. SDs Multiplication and Division When multiplying or dividing the answer will have the same number of significant digits as the least accurate number used to get the answer. For example, 2.005 g / 4.95 mL = 0.405 g/mL What is 16.874 x 2.6? What is 16.874 / 2.6?

  40. SDs and Calculations that Require Multiple Steps An average is the best estimate of the true value of a parameter. A standard deviation is a measure of precision. Averages and standard deviations require several steps to calculate. You must keep track of the number of significant figures during each step. Do NOT discard or round any figures until the final number is reported.

  41. SDs and Calculations that Require Multiple Steps 2 Significant Figures Significant Figures 2 Significant Figures 1 Significant Figure 1 Significant Figure 1 Significant Figure 0 Significant Figures

  42. What is average and standard deviation for the following 3 measurements of the same sample?

  43. Rounding and Chopping Rounding: Replace the number by the nearest machine number. Chopping: Throw all extra digits. CISE301_Topic1 43

  44. Rounding and Chopping - Example CISE301_Topic1 44

  45. Error Definitions True Error Can be computed if the true value is known: Absolute = True Error true value approximat ion t E Absolute Percent Relative Error true value approximat ion = * 100 t true value CISE301_Topic1 45

  46. Error Definitions Estimated Error When the true value is not known: Estimated = a E Absolute Error current estimate previous estimate Estimated Absolute Percent Relative Error current estimate previous estimate = 100 * a current estimate CISE301_Topic1 46

  47. Notation We say that the estimate is correct to n decimal digits if: n 10 Error We say that the estimate is correct to n decimal digits rounded if: 1 n Error 10 2 CISE301_Topic1 47

  48. Summary Number Representation Numbers that have a finite expansion in one numbering system may have an infinite expansion in another numbering system. Normalized Floating Point Representation Efficient in representing very small or very large numbers, Difference between machine numbers is not uniform, Representation error depends on the number of bits used in the mantissa. CISE301_Topic1 48

  49. Lectures 3-4 Taylor Theorem Motivation Taylor Theorem Examples Reading assignment: Chapter 4 CISE301_Topic1 49

  50. Motivation We can easily compute expressions like: 10 3 + x 2 ( 2 ) 4 But, How do you compute 4.1 , sin( ? ) 6 . 0 We can use the graphical definition to compute sin(0.6) !? is this a practical way? b a 0.6 Taylor series is used to express function in an approximate fashion CISE301_Topic1 50

Related


More Related Content