Number Presentation & Accuracy PDF

Document Details

ExcellentRainbow

Uploaded by ExcellentRainbow

Imam Abdulrahman Bin Faisal University

Tags

number representation numerical methods physics computational physics

Summary

This document, titled "Number Presentation & Accuracy," discusses various aspects of number representation and accuracy, particularly within the context of computational physics. It delves into systems such as decimal and binary, and the concept of significant figures, highlighting their importance in computations. The aim is to present foundational concepts for understanding numerical methods in physics.

Full Transcript

Computational Methods in Physics I :PHY405 Lesson 2 Number Representation and Accuracy Chapter 3 and 4 on Textbook Representing Real Numbers Decimal System: Base = 10 , Digits (0,1,…,9) You are familiar with the decimal system: 312.45 = 3 ×10 2 + 1×101 + 2 ×1...

Computational Methods in Physics I :PHY405 Lesson 2 Number Representation and Accuracy Chapter 3 and 4 on Textbook Representing Real Numbers Decimal System: Base = 10 , Digits (0,1,…,9) You are familiar with the decimal system: 312.45 = 3 ×10 2 + 1×101 + 2 ×100 + 4 ×10 −1 + 5 ×10 −2 Standard Representations: ± 3 1 2. 4 5 sign integral fraction part part 2 Decimal system Normalized Floating Point Representation: ± d. f1 f 2 f 3 f 4 × 10± n sign mantissa exponent d ≠ 0, ± n : signed exponent Scientific Notation: Exactly one non-zero digit appears before decimal point. Advantage: Efficient in representing very small or very large numbers. 4 Binary system Binary System: Base = 2, Digits {0,1} ±n ± 1. f1 f 2 f 3 f 4 × 2 sign mantissa signed exponent (1.101)2 = (1 + 1 × 2 −1 + 0 × 2 − 2 + 1 × 2 −3 )10 = (1.625)10 5 Note Numbers that have a finite expansion in one numbering system may have an infinite expansion in another numbering system: (1.1)10 = (1.000110011001100...) 2 You can never represent 1.1 exactly in binary system. 6 IEEE 754 Floating-Point Standard The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point computation which was established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). The standard addressed many problems found in the diverse floating point implementations that made them difficult to use reliably and reduced their portability. IEEE Standard 754 floating point is the most common representation today for real numbers on computers, including Intel-based PC’s, Macs, and most Unix platforms. IEEE 754 numbers are divided into two based on the above three components: single precision and double precision. 7  Single Precision (32-bit representation)  Double Precision (64-bit representation) 8 SIGNIFICANT DIGITS Whenever we employ a number in a computation, we must have assurance that it can be used with confidence. For example, Fig. 3.1 depicts a speedometer and odometer from an automobile. Visual inspection of the speedometer indicates that the car is traveling between 48 and 49 km/h. Because the indicator is higher than the midpoint between the markers on the gauge, we can say with assurance that the car is traveling at approximately 49 km/h. We have confidence in this result because two or more reasonable individuals reading this gauge would arrive at the same conclusion. However, let us say that we insist that the speed be estimated to one decimal place. For this case, one person might say 48.8, whereas another might say 48.9 km/h. 9 9 Therefore, because of the limits of this instrument, only the first two digits can be used with confidence. Estimates of the third digit (or higher) must be viewed as approximations. It would be ludicrous to claim, on the basis of this speedometer, that the automobile is traveling at 48.8642138 km/h. In contrast, the odometer provides up to six certain digits. From Fig. 3.1, we can conclude that the car has traveled slightly less than 87,324.5 km during its lifetime. In this case, the seventh digit (and higher) is uncertain The concept of a significant figure, or digit, has been developed to formally designate the reliability of a numerical value. The significant digits of a number are those that can be used with confidence. They correspond to the number of certain digits plus one estimated digit. For example, the speedometer and the odometer in Fig. 3.1 yield readings of three and seven significant figures, respectively. For the speedometer, the two certain digits are 48. It is conventional to set the estimated digit at one-half of the smallest scale division on the measurement device. Thus, the speedometer reading would consist of the three significant figures: 48.5. In a similar fashion, the odometer would yield a seven-significant- figure reading of 87,324.45. 10 NOTE Zeros are not always significant figures because they may be necessary just to locate a decimal point. The numbers 0.00001845, 0.0001845, and 0.001845 all have four significant figures. Similarly, when trailing zeros are used in large numbers, it is not clear how many, if any, of the zeros are significant !! For example, at face value the number 45,300 may have three, four, or five significant digits, depending on whether the zeros are known with confidence. Such uncertainty can be resolved by using scientific notation, where 4.53 × 104, 4.530 × 104, 4.5300 × 104 designate that the number is known to three, four, and five significant figures, respectively. 11 Accuracy and Precision  Accuracy refers to how closely a computed or measured value agrees with the true value.  Precision refers to how closely individual computed or measured values agree with each other. 30/09/2024 12 13 Rounding and Chopping There are two commonly used ways of representing a given real number 𝑥𝑥 by a floating-point machine number, denoted by fl(𝑥𝑥), rounding and chopping. Consider a positive real number 𝑥𝑥 in the normalized decimal form 𝒙𝒙 = 𝟎𝟎, 𝒃𝒃𝟏𝟏 𝒃𝒃𝟐𝟐 … 𝒃𝒃𝒌𝒌 𝒃𝒃𝒌𝒌+𝟏𝟏 … 𝟏𝟏𝟏𝟏 × 𝟏𝟏𝟏𝟏𝒆𝒆 We say that the number is chopped to 𝒌𝒌 digits when all digits following the 𝒌𝒌th digits are discarded; that is, the digits 𝒃𝒃𝒌𝒌 𝒃𝒃𝒌𝒌+𝟏𝟏 … are chopped off to obtain 𝒇𝒇𝒇𝒇(𝒙𝒙) = 𝟎𝟎, 𝒃𝒃𝟏𝟏 𝒃𝒃𝟐𝟐 … 𝒃𝒃𝒌𝒌 𝟏𝟏𝟏𝟏 × 𝟏𝟏𝟏𝟏𝒆𝒆 Conversly, 𝑥𝑥 is rounded to 𝒌𝒌 digits when fl(x) is obtained by choosing fl(x) nearest to 𝒙𝒙 ; that is adding one to 𝒃𝒃𝒌𝒌 if 𝒃𝒃𝒌𝒌+𝟏𝟏 ≥ 𝟓𝟓 and chop all but the first k digits if 𝒃𝒃𝒌𝒌+𝟏𝟏 < 𝟓𝟓 14 Example 15 Error Definitions True Error: If the true value is known : Absolute True Error Et = true value − approximation Absolute Percent Relative Error true value − approximation εt = *100 true value 16 Estimated Error: If the true value is not known Estimated Absolute Error Ea = current estimate − previous estimate Estimated Absolute Percent Relative Error current estimate − previous estimate εa = *100 current estimate 17

Use Quizgecko on...
Browser
Browser