HP -15C Advanced Functions Handbook page 197

Hide thumbs Also See for HP-15C:
Table of Contents

Advertisement

Appendix: Accuracy of Numerical Calculations
195
for the figure shown below. Engineering and scientific calculations
often require that the angle 6 be calculated from given values p, q,
and r for the length of the triangle's sides. This calculation is
feasible provided 0 <p^q + r, 0<q^p + r, andO ^ r^p + q, and
then
cos-\((p
2
+ q
2
) -
otherwise, no triangle exists with those side lengths, or else Q = 0/0
is indeterminate.
The foregoing formula for 6 defines a function 6 — f(p,q,r) and also
in a natural way, a program F(p,q,r) intended to calculate the
function. That program is labeled "A" below, with results
F
A
( p , q , r ) tabulated for certain inputs p, q, and r corresponding to
sliver-shaped triangles for which the formula suffers badly from
roundoff. The numerical unreliability of this formula is well known
as is that of the algebraically equivalent but more reliable formula
6 = f(p,q,r) — 2 ian~
l
\fab/(cs), where s = (p + q + r)/2, a — s — p,
b = s — q, and c = s — r. Another program F ( p , q , r ) based upon this
better formula is labeled "B" below, with results F
B
(p,q,r) for
selected inputs. Apparently F
B
is not much more reliable than F
A
.
Most of the poor results could be explained by backward error
analysis if we assume that the calculations yield F(p,q,r) —
f(p + 6p,q + 8q,r + 8r) for unknown but small perturbations
satisfying \5p\ 10~
9
|p| , etc. Even if this explanation were true, it
would have perplexing and disagreeable consequences, because the
angles in sliver-shaped triangles can change relatively drastically
when the sides are perturbed relatively slightly; f(p,q,r) is
relatively unstable for marginal inputs.
Actually the preceding explanation is false. No backward error
analysis could account for the results tabulated for F
A
and F
B
under case 1 below unless perturbations 8p, 8q, and 8r were
allowed to corrupt the fifth significant digit of the input, changing
1 to 1.0001 or 0.9999 . That much is too much noise to tolerate in a
10-digit calculation. A better program by far is F
c
, labeled "C" and
explained shortly afterwards.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents