Documente Academic
Documente Profesional
Documente Cultură
1
ERRORS and COMPUTER NUMBERS
Computer Numbers, Roundoff Error
Floating Point Number Representation: any real number
y can be put in floating point form
y = .d1d2 . . . dk . . . bn
for base b, with 0 < d1 < b, 0 di < b, i > 1.
E.g. (.1)10 = +(.1100)2 23.
Conversion from decimal to binary?
Integer part:
repeatedly divide by 2, saving remainder digits di.
Fraction:
repeatedly multiply by 2, saving remainder digits di.
3
COMPUTER NUMBERS CONTINUED
4
COMPUTER NUMBERS CONTINUED
5
COMPUTER NUMBERS CONTINUED
6
LOSS of SIGNIFICANT DIGITS
7
LSD EXAMPLES
b) 1/(1 + x) 1/(1 x) for small x.
Matlab Check:
for x = 10.^[-2:-2:-8]
disp([x (1-sec(x))/tan(x)^2 -cos(x)/(1+cos(x))])
end
0.01 -0.499987499790956 -0.499987499791664
0.0001 -0.499999993627931 -0.49999999875
1e-06 -0.500044450290837 -0.499999999999875
1e-08 0 -0.5
d) (ex 1)/x for small x (Taylor series sometimes helps).
8
NUMERICAL SOFTWARE
Numerical algorithms in texbook and written for class
will be short algorithms, designed to illustrate primary
algorithm features and problems.
Software Libraries: numerical methods described and an-
alyzed in textbook and class have been placed in
software libraries.
Software libraries contain carefully documented software
for algorithms carefully implemented as language depen-
dent functions and procedures: e.g.
CACM, NAG, IMSL, STATLIB, WWW,
for standard computer languages, and environments: e.g.
MATLAB, MAPLE, MATHEMATICA, R, GAUSS
for interactive work; e.g.
FORTRAN, C, C++, JAVA, PYTHON
for high performance computation.