HP 15c User Manual
Page 160
160
Appendix: Accuracy of Numerical Calculations
160
Example 6: The Smaller Root of a Quadratic. The two roots x and y of the quadratic
equation c − 2bz + az
2
= 0 are real whenever d = b
2
− ac is nonnegative. Then the root y of
smaller magnitude can be regarded as a function y = f(a,b,c) of the quadratic's coefficients
otherwise.
2
/
)
/
(
0
if
/
))
sgn(
(
)
,
,
(
b
c
a
a
b
d
b
c
b
a
f
Were this formula translated directly in a program F(a, b, c) intended to calculate f(a, b, c),
then whenever ac is so small compared with b
2
that the computed value of d rounds to b
2
,
that program could deliver F = 0 even though f ≠ 0. So drastic an error cannot be explained
by backward error analysis because no relatively small perturbations to each coefficient a, b,
and c could drive c to zero, as would be necessary to change the smaller root y into 0. On the
other hand, the algebraically equivalent formula
otherwise
0
nonzero
is
divisor
if
))
sgn(
/(
)
,
,
(
b
d
b
c
c
b
a
f
translates into a much more accurate program F whose errors do no more damage than would
a perturbation in the last (10th) significant digit of c. Such a program will be listed later (page
172) and must be used in those instances, common in engineering, when the smaller root y is
needed accurately despite the fact that the quadratic's other unwanted root is relatively large.
Almost all the functions built into the HP-15C have been designed so that backward error
analysis will account for their errors satisfactorily. The exceptions are _, f, and the
statistics keys S, L, and j which can malfunction in certain pathological cases.
Otherwise, every calculator function F intended to produce f(x) produces instead a value F(x)
no farther from f(x) than if first x had been perturbed to x+δx with |δx| ≤ η|x|, then f(x+δx)
were perturbed to(f+δf)(x+δx) with|δf| ≤ ε|f|. The tolerances η and ε vary a little from function
to function; roughly speaking
η = 0 and ε < 10
-9
for all functions in Level 1,
η < 10
-12
and ε < 6×10
-10
for all real and complex functions.
For matrix operations, the magnitudes |δx|, |x|, |δf|, and |f| replaced by matrix norms ||δx||, ||x||,
||δf||, and ||f|| respectively, which are explained in section 4 and evaluated using > 7 or
> 8. Then all matrix functions not in Level 1 fall into Level 2 with roughly
η ≤ 10
-12
n and ε < 10
-9
for all matrix operations (other than
determinant > 9, ÷, ⁄)
η < 10
-9
n and ε < 10
-9
for determinant > 9, ⁄,
and ÷ with matrix divisor
where n is the largest dimension of any matrix involved in the operation.
The implications of successful backward error analysis look simple only when the input data
x comes contaminated by unavoidable and uncorrelated noise Δx, as is often the case. Then