You are on page 1of 17

Metode Numerik

Pertemuan 5, Minggu ke-3


Error Analysis
• Sources
• Howard Chapter 2
• Chapra Chapter 3-4

Internal Data
True Values Numerical Error
Storage

2
True values
• around  The class might start around 9 a.m.
• about  The train station is about 5 km away from here.
• rounding number to the closest tens or hundreds  the book price is
about IDR 20,000.

3
True values
• Suppose, the actual value is x  The closer to x, the better.
• How much error are we able to tolerate?

• Numerical error is composed of two components, precision and


accuracy.

𝑥 : true value
𝑥′ : measured value
𝜖 : error

4
True values

5
True values - Accuracy
• Accuracy measures how close an estimate is to the true value.
• Absolute accuracy or absolute error
𝜖𝐴 = 𝑥 − 𝑥′
• Measures the raw distance between the correct value of x and the measured value.
• This measue only partially conveys the context of the measurement and may not
present a meaningful error estimate in contect.
• Relative error
𝑥 − 𝑥′
𝜖𝑅 =
𝑥
• Unitless, can be compared across different systems.
• Can be interpreted as a percentage of the true value.
• See Chapra Example 3.1

6
True values - Precision
• Precision provides a measure for how specific a number is.
• Precision explains the level of detail in a measurement.
22
𝜋= or 𝜋 = 3.14
7
• Significant digits or significant figures are the parts of a number that
include the precision of that number.
• 𝜋 can be represented as 3, 3.1, 3.14, 3.142, 3.1416, 3.14159 and so
on.
• As the number of significant digits increases, so does the precision of
the estimate.
7
True values - Precision

8
Internal data storage
• R has variety of ways to store numbers, such as matrices and vectors.
• This section will focus on integer and numeric data types.

9
Internal data storage – Binary numbers
• The largest positive number R can hold as an integer is 231 or
2147483647
• as.integer is used to ensure the result is converted into an
integer.

10
Internal data storage – Floating point
numbers
• Floating point numbers provide the way around the limitations of
binary integers.
• Floating point numbers are capable of storing noninteger values and
storing much larger numbers.
• R defaults to storing the numerical data as floating point data 
numeric
• Floating point numbers also permit several special values to be stored
• NaN  not equal to anything, implies a result that cannot be calculated for
whatever reason, 0/0
• Inf  can be expressed as positive infinity (Inf) and negative infinity (-Inf)

11
Numerical error
• Some numbers can be represented precisely while others cannot.
• Numerical errors arise from the use of approximations to represent
exact mathematical operations and quantities.
• truncation errors, which result when approximations are used to represent
exact mathematical procedures.
• round-off errors, which result when numbers having limited significant figures
are used to represent exact numbers.

True value = approximation + error

12
Numerical error

13
Numerical error – Round-off error and
machine 𝜖
• The machine error, frequently just called machine 𝜖, captures the
spacing of numbers within the floating point space.
• Round-off error is due to the fact that computers can represent only
quantities with a finite number of digits.
• Truncation error is the discrepancy introduced by the fact that
numerical methods may employ approximations to represent exact
Mathematical operations and quantities.
• 1+𝜖 >1

14
Numerical error – Overflow and underflow
• Underflow is the
phenomenon that a
number is too small,
regardless of sign, to be
represented by the
computer as anything
other than 0.
• Overflow is when the
number is too large to be
expressed.

15
Numerical error – Error propagation and
stability
• Understanding how errors in one calculation affect other calculations
in a complex operation is known as error propagation.

16
Numerical error – Error propagation and
stability
• Numerical stability is another important goal of numerical analysis.
• Numerical stability is the property of numerical algorithm that the
approximation errors, from whatever source, are not amplified by the
algorithm.
• The first way it manifests is that numerically stable algorithms will not
produce drastic output changes after small changes in the input.
• The second manifestation of numerical stability refers to how the
algorithm behaves near certain boundary values or singularity points.

17

You might also like