Accuracy and Precision
• Accuracy refers to how closely a computed or measured
value agrees with the true value, while precision refers to
how closely individual computed or measured values
agree with each other.
a) inaccurate and imprecise
b) accurate and imprecise
c) inaccurate and precise
d) accurate and precise
Error Definitions
• True error (Et): the difference between the
true value and the approximation.
• Absolute error (|Et|): the absolute difference
between the true value and the
approximation.
• True fractional relative error: the true error
divided by the true value.
• Relative error (t): the true fractional relative
error expressed as a percentage.
Error Definitions (cont)
• The previous definitions of error relied on knowing
a true value. If that is not the case, approximations
can be made to the error.
• The approximate percent relative error can be
given as the approximate error divided by the
approximation, expressed as a percentage - though
this presents the challenge of finding the
approximate error!
• For iterative processes, the error can be
approximated as the difference in values between
sucessive iterations.
Using Error Estimates
• Often, when performing calculations, we may
not be concerned with the sign of the error
but are interested in whether the absolute
value of the percent relative error is lower
than a prespecified tolerance s. For such
cases, the computation is repeated
until | a |< s
• This relationship is referred to as a stopping
criterion.
Roundoff Errors
• Roundoff errors arise because digital
computers cannot represent some quantities
exactly. There are two major facets of
roundoff errors involved in numerical
calculations:
– Digital computers have size and precision limits
on their ability to represent numbers.
– Certain numerical manipulations are highly
sensitive to roundoff errors.
Computer Number Representation
The IEEE double-precision format : eight bytes (64
bits) are used to represent floating-point numbers:
n = ±(1+f) x 2e
• The sign is determined by a sign bit
• The mantissa f is determined by a 52-bit binary
number
• The exponent e is determined by an 11-bit binary
number, from which 1023 is subtracted to get e
Expression of Binary Number
Floating point : 8 bytes=64 bits
Sign(부호): 1bit, Signed exponent (지수): 11 bit
Mantissa(가수): 52bit
Range
Max.: +1.1111….111X2+1023 (1.7977X10+308)
Min.: +1.0000…..000X2-1024 (5.5627X10-309)
Precision(정밀도)
Mantissa : 52 bit, Decimal number : 15 ~ 16 digits
> Realmax : Overflow
< Realmin : Underflow
IEEE Format
Biased Fractional part f of the normalized
s exponent c mantissa
(8 bits / 11 bits) (23 bits / 52 bits)
IEEE 32 : (1) 2 (1. f ) 2 (2 c 127 )10
Sign of mantissa (1 bit) IEEE 64 : (1) 2 (1. f ) 2 (2 c 1023 )10
(45.)10 (101101) 2 (.8125)10 (.110100) 2
(45.8125)10 ( 101101.110100) 2 (1.01101110100) 2 25
s 1 c 127 5 (132)10 (10000100) 2 f (0110 1110 1000 0000 0000 0000) 2
1 1000 0100 0110 1110 1000 0000 0000 0000 8
Floating Point Ranges
• Values of 1023 and +1024 for e are reserved for
special meanings, so the exponent range is 1022
to 1023.
• The largest possible number can store has
f of all 1’s, giving a significand of 2 2-52, or approximately 2
e of 111111111102, giving an exponent of 2046 1023 = 1023
This yields approximately 21024 = 1.799710308
• The smallest possible number can store with full precision
has
f of all 0’s, giving a significand of 1
e of 000000000012, giving an exponent of 11023 = 1022
This yields 21022 = 2.225110308
Floating Point Precision
• The 52 bits for the mantissa f correspond to
about 15 to 16 base-10 digits. The machine
epsilon - the maximum relative error between
a number and MATLAB’s representation of
that number, is thus
252 = 2.22041016
Roundoff Errors with
Arithmetic Manipulations
• Roundoff error can happen in several
circumstances other than just storing numbers - for
example:
– Large computations - if a process performs a large
number of computations, roundoff errors may build up to
become significant
– Adding a Large and a Small Number - Since the small
number’s mantissa is shifted to the right to be the same
scale as the large number, digits are lost
– Smearing - Smearing occurs whenever the individual
terms in a summation are larger than the summation
itself.
• (x + 10-20) x = 10-20 mathematically, but
x = 1; (x + 10-20) x gives a 0 in MATLAB!
Truncation Errors
• Truncation errors are those that result from
using an approximation in place of an exact
mathematical procedure.
• Example 1: approximation to a derivative
using a finite-difference equation:
dv v v(t i1 ) v(t i )
dt t t i1 t i
• Example 2: The Taylor Series
The Taylor Theorem and Series
• The Taylor theorem states that any smooth
function can be approximated as a
polynomial.
• The Taylor series provides a means to
express this idea mathematically.
The Taylor Series
f x i1 f x i f x i h
' f ''
x i 2
h
f (3)
x i 3
h
f (n )
xi n
h Rn
2! 3! n!
Truncation Error
• In general, the nth order Taylor series
expansion will be exact for an nth order
polynomial.
• In other cases, the remainder term Rn is of
the order of hn+1, meaning:
The more terms are used, the smaller the error,
and
The smaller the spacing, the smaller the error for
a given number of terms.
Numerical Differentiation
• The first order Taylor series can be used to
calculate approximations to derivatives:
Given: f (x i1 ) f (x i ) f '
(x i )h O(h 2
)
f (x i1 ) f (x i )
Then: f (x i )
'
O(h)
h
• This is termed a “forward” difference because
it utilizes data at i and i+1 to estimate the
derivative.
Differentiation (cont)
• There are also backward and centered difference
approximations, depending on the points used:
• Forward:
f (x i1 ) f (x i )
f (x i )
'
O(h)
h
• Backward:
f (x i ) f (x i1 )
f (x i )
'
O(h)
h
• Centered:
f (x i1 ) f (x i1 )
f (x i )
'
O(h 2 )
2h
Total Numerical Error
• The total numerical error is the summation of the
truncation and roundoff errors.
• The truncation error generally increases as the step
size increases, while the roundoff error decreases
as the step size increases - this leads to a point of
diminishing returns for step size.
Other Errors
• Blunders - errors caused by malfunctions of
the computer or human imperfection.
• Model errors - errors resulting from
incomplete mathematical models.
• Data uncertainty - errors resulting from the
accuracy and/or precision of the data.