Numbers are represented in binaries, thus creating errors.
Numerical procedures also introduce errors.
Numerical analysis is the study of the behaviour of errors in computation.
Write the following code and study the response.
Write the following code and study the response (http://siber.cankaya.edu.tr/ozdogan/NumericalComputations//mfiles/chapter0/chop.m chop.m).
Write a code that adds 0.0001 one thousand times. The result should equal 1.0 exactly but this is not true for single precision.
Example output;
k =
1.0000e+00
a =
1.0001e+00
Write the following code and study the response.
Taylor Series Approximations to (Example m-file: http://siber.cankaya.edu.tr/ozdogan/NumericalComputations//mfiles/chapter0/demoTaylor.m demoTaylor.m)
Consider the function
Make the Taylor series expansion of this function up to third order.
>>demoTaylor(1.6,0.8)
All of the Taylor polynomials agree with near . The higher order polynomials agree over a larger range of .
Home Study:
Suppose that
is an approximation to . The (absolute) error is
, and the relative error is
, provided that .
Let
(approx. ?) and
; then the error is
and the relative error is
Let
and
; then the error is (large?)
and the relative error is (small?)
Let
and
; then the error is (small?)
and the relative error is (large?)
The relative error is a better indicator of accuracy and is preferred for floating-point representations since it deals directly with the mantissa.
Given that
It is approximated by using Taylor series as
Calculate and using 6 digits and rounding, with
Solution:
We have
Note that is algebraically equivalent to , but
is more accurate than to the true answer
to six digits.
Let
,
. Use 3-digit rounding arithmetic to compute
:
Solution:
The errors are 0.015159 and -0.004841, respectively. Thus the approximation
has less error.
Consider the Taylor polynomial expansions
What is the order of error term for summation, subtraction and multiplication?
Solution:
With
, we have the sum