You are on page 1of 8

Six, Lies, and Calculators

Author(s): R. M. Corless
Source: The American Mathematical Monthly, Vol. 100, No. 4 (Apr., 1993), pp. 344-350
Published by: Mathematical Association of America
Stable URL: .
Accessed: 09/04/2011 14:50

Your use of the JSTOR archive indicates your acceptance of JSTOR's Terms and Conditions of Use, available at . JSTOR's Terms and Conditions of Use provides, in part, that unless
you have obtained prior permission, you may not download an entire issue of a journal or multiple copies of articles, and you
may use content in the JSTOR archive only for your personal, non-commercial use.

Please contact the publisher regarding any further use of this work. Publisher contact information may be obtained at . .

Each copy of any part of a JSTOR transmission must contain the same copyright notice that appears on the screen or printed
page of such transmission.

JSTOR is a not-for-profit service that helps scholars, researchers, and students discover, use, and build upon a wide range of
content in a trusted digital archive. We use information technology and tools to increase productivity and facilitate new forms
of scholarship. For more information about JSTOR, please contact

Mathematical Association of America is collaborating with JSTOR to digitize, preserve and extend access to
The American Mathematical Monthly.
Six,Lies,and Calculators
R. M. Corless

Thisaitcle attempts to alleviatesomedismal'mpressionsthatmightbe inadver-

tently otherwise
leftafterreadingYves Nievergelt's paper[1].In particu-
lar,thepresentarticleshowsthatin a certainsense,theanswersprovidedbythe
fora verylargeclass
as usefulas theuniqueexactsolution,
calculatorar precisely
of problems,en whenthe calculatorsolutionsare notat all close to theexact
solution.It is furthershownthat even the exact answerby itselfis usually
of the problemunderconsideration,and
fora completeunderstanding
thatsomesortof sensitivitanalysis(suchas computing thecondition numberof
the problem)is also required.It is also sho thatunexpectedbehaviourof a
computedsolutioncan be extremely usefulpedagogically.
The behaviour ofthecalculator is byno meansunique.All othercomputers and
softwarepackagesexhibitsimilarly usefulquirks.Further,the behaviouris not
restrictedto the solution of linear equations, holding true also for function
the solution of differentialequations, and many other
evaluation, rootfinding,
practicalproblems.There is a strongconnectionwiththe theor of chaotic
dynamicshere,whichmay also be of interest.

SUMMARYOF Y. NIEVERGELTS PAPER. Nievergelt's paper[11reportswhat

happenswhenyou tryto solvethe linearsystemAx - b, givenbelow,on the
888445 887112] 1
887112 885781 0
Severalmethodsare tried,and onlyone producestheexactanswer.
ProfessorNievergelt corectlypointsout thatthematrixA is ey close to a
singularmatrix, and thusis extremely havinga conditionnumber
greaterthan 1012, A succinctand accuratealgebraicdefinition of condition
numberis givenin [1] (and henceis notrepeatedhere),and Professor Nievergelt
also pointsout thatthedefinition,
meaning, and use ofthecondition numberare
not sufficientlywell knownoutsideof the numericalanalysiscommunity, and
shouldbe taught morewidely. I agreewhole-heartedly withthis.
In factthis
be easy,because thereis a strongconnectionbetweenthe conditionnumberin the
moregeneralcomputational offirst
and differentials
situation yearcalculus,andso
in some sense the teachingof the of
"conditioning" a problemis a simple
application calculus.
Of coursethereare manytextbooks whichdiscussconditionnumberin the
contex of numericallinear algebra and findingrootsof polynomials(e.g. [2]), and
numberof function
othersthatdiscussthecondition (e.g. [3]),and still
othersthatdo so for equations(eg. [41).
differential This paper attemptsan

TION. The key rationale for having to deal with condition numbers is not
numericalanalysisand the problemof computationalerror.A verylarge number
of mathematicalproblemsare derivedfrom"real-world"origins,and containboth
modellingerror(e.g. neglectedtermsin the equations) and data or measurement
error.These are unavoidable,while computationalerroris avoidable, at least in
principle,ifyou wishto pay the price fordoingexact arithmetic,
a symbolicmanipulationpackage such as Maple [5].
It is a veryuseful featureof numericalanalysisthat the techniquesused for
monitoringthe effectsof computationalerrorscan oftenbe used to monitorthe
effectsof modellingerrorand measurementerror.
The basic principle is Wilkinson'sidea of backward erroranalysis: a good
numericalmethodwill giveyou the exact solutionof a nearbyproblem.This very
powerfulidea reduces the studyof computationalerrorsto the studyof modelling
or measurementerrors,whichwe have to studyanyway.
This principlewas firstelucidated in the contextof the solution of linear
systemsof equations and in the contextof polynomialrootfinding.Instead of
repeatingdetailsof these,I urgethe readerto examinethe technicaland historical
discussionsin [2]. Examinationof Figure 1 at thispoint may make the basic idea
more clear.

"Real World" Problem


residual .'Exact Solution loe

"Nearby" Problem _\
, ~~~~~~Exact
Solution { odel
SpecifiedProblem A

Figure1. Modelingbased on a nearbyproblem.

The fundamentalpointis thatwe getinsightfromknowingexactsolutions-that

is, fromknowingboththe questionand the answer.If whatthe computerproduces
is the exact solutionofjust as good a modelof the physicalsystemas was originally
writtendown,we can get just as much insightfromthe computersolutionas we
can fromthe exact solutionof the originallyspecifiedproblem.
The idea of allowingthe calculatoror computerto change theproblem,albeit
not byverymuch,in some norm,is upsettingto manymathematicians, because one
of the most powerfulideas in mathematicsis that the irrelevantdetails of the
physicalcontextof a problemcan be ignored.However,mostpeople will have to
deal eventuallywiththe fact that mathematicalproblemsencounteredin science


and engineeringare usuallymerelyone representative class of
out of an infinite
mathematical modelsforthephenomenon in question,and furtherthattheinput
data to the modelwill usuallybe of low accuracycomparedto the precision
availableon mostcomputers In suchcases,fanatical
or calculators. obsessionwith
accuratelysolvingthe specifiedmodel problemis neithernecessarynor appropri-
of the inputdata and/orthe
ate, whileanalysisof the effectof perturbations
modelis essential.
I remarkthatsometimesthe methodor the programor the computerwill
changetheproblembya largeamount, way.
orbya smallamountin a nonphysical
For example,the computermtaynot preservethe physicalinvariants of the
problem.In suchcases,we say thatthe numericalmethodis at faultand must
searchfora bettermethod.

NIEVERGELT'SPROBLEM REVISITED. The objectofbackwarderroranalysis

errorsintothecontextof modelling
is to putcomputational errors.However,no
examplewas givenin [1],so whatfollowsis
Perhaps,then,A aroseas
and A is symmetric.
The elementsof A are integers,
the normalequationsfromsome least-squaresproblemwherethe entriesof
rectangular) We found
matrixB whereA = BTB werealso integers.
[666 6651
B 667 666j
thenA = BTB. Theremaywellbe othersuch B (of different dimensions), as an
exhaustive searchwas not carriedout. (The occurrence of the digit"6" in the
entriesof B is one reasonforthe"Six" in thetitle,bytheway.)
It is well-known in numerical analysiscirclesthatusingthe normalequations
can increasethe conditionnumberdrastically, makingthe problemmuchmore
sensitive the case herethatA is muchmore
thanit need be, and it is certainly
ill-conditioned thanB.
On theotherhand,det(B) = det(A) = I and theentriesare integers, so itmay
be thattheproblem wascombinatorial inorigin.In thiscase,nothingshortofexact
arithmetic sinceno perturbation
is sufficient in thedata is allowed.The factthat
Cramer'srulegottherightanswerforthisproblemin [1]was accidental: Cramer's
ruleis unstable, evenforthe2 by2 case [6].We notethatthereare manydifferent
waysof doingexactcomputations on computers nowadays, includingthe use of
symbolic manipulation programs suchas Maple,or perhapsinterval arithmetic.
We nowlooka bitmorecloselyat theapparently randomdigitsoftheanswers
producedbythevariousmethodstriedin theNievergelt paper.Notethatafterthe
resultsof thedifferent methodsweregiven,thequestionwas asked:
"Whatmightinstructors and textbooks tellstudents,whocarefully copydown
theirsupercalculator's resultswithouteversuspecting thattheyare copyingran-
If we computetheratiox/y foreach of thesolutions produced,including the
exact solution,we get x/y = - 0.9984996258,for all solutionsexceptthesingular
value decompositionsolution.The solutionsare not randomdigits!What,then,are
a multiple
they?Clearlythevector[x y] producedis to highaccuracy
vector.Whatunitvector?The answerlies in a detailedlookat thesingular
decomposition.This mightbe beyondwhatis desiredto teach,at least in an
course(see [7] forsomedetailsoftheuse oftheHP28S at Western).


However,it is instructiveto pursue this here. We firstnote that if the singular
value decomposition(see [8]) of B is B = UYVT where U and V are orthogonal
and I = diag(o1, o2) where a, > a2> 0, then A = Vi2VT and the singular
values of A are the squares of the singularvalues of B. We can writethe solution
to Ax = b in terms of these singular values as

X= U)1 2 l[Vi] + 02 2V[ V121

and we note that o- 1332.00075075033while (r2 = 0.00075075033.The singular

values were computedby MATLAB [9], and separatelychecked by hand and by
Maple [5].
For small u2, the solutionis clearlydominatedby the second term,and hence
the near-constantratioof the computedsolutionsobservedearlier.However,if o2
is smallcomparedto o1, thenthe matrixis ill-conditioned, and perturbationsin the
data will change the value of o-2 drastically.The singular-value decomposition
solutionobtained in [1] is just the firsttermabove, on the other hand, and it is
robustunder perturbations.
It is remarkablethatthe solutionproducedby the HP keysdirectlycorrespond
to the above with Or2= 1/1601, while usingGaussian eliminationas programmed
gives o-2 1/1413, and the eigenvalue approach gives u2 1/1332.13, whereas
the exact solutionhas 0U2= 1/1332.00075075.
MORAL 1: Each method gives the exact solution for a slightlyperturbed
matrix,all withsmall U2. Each solutionis just as good as the exactsolution,in view
of the possibilityof data error.Note particularlythat this problemdoes not go
away ifyou use anothersoftwarepackage, even if it givesthe exact solution.
MORAL 2: Explaining the unexpected behaviour of the calculator involves
more seriousmathematicsthan(perhaps)was anticipated.This seems to be one of
the better argumentsfor using such equipmentin a classroom setting,in that
usingthe calculatorcan enrichthe mathematicalcontentof the course.


behaviour of computationalequipment is quite general. The idea of condition
numbercan be used in any computationalproblem,to assess (to firstorder) the
effectsof perturbationsin the model or the data. This is a good idea, even ifyou
have the exact solutionto yourproblem,and providesan excellentmotivationto
studyperturbationtheory.I give some examplesbelow.

FunctionEvaluation.In evaluatingthe functiony = f(x), we considerthe relative

effectof a smallchange Ax on y. Of course thisleads to the firstorderexpression
Ay (xf'(x) Ax
y f(x) jx

and the expressionin bracketsis called the conditionnumberof f, and often

denoted by C (see e.g. [3]). Note that this is just an applicationof the theoryof
a standardtopic in mostcalculus courses.
This numberC is an appropriatenumberto look at if x is not zero and f(x) is
not zero, in which case absolute errors,as opposed to relative errors,are the
quantitiesof interest.Here, we look at onlytwoexamples,the tangentfunction, for
whichC = x/(sin(x)cos(x)), and the exponentialfunction,for which C = x. Con-
sider the exponentialfunctionfirst.If x = 100, then C = 100. If we know x only


to two figures,how accuratelycan we know y = exp(x)? The relativeerrorin y is
on the orderof 1. That is, we are not sure of anyfiguresof our answer.Note that
the precisionused to calculate exp(x) is almostirrelevant,and in particulargoing
to "double precision"doesn't help. The difficulty is that data erroris amplified,
not thatcomputationalerrorsare amplified.
Now consider r/2 which is 1.57079632680to the precisionof the calculator.
The calculated value of tan(7/2), using the calculator in radians, is
- 195948537906.This result shows that someone took fanatical care with the
programmingof the calculator, because it is correct to all figures given the
assumptionthat we wanted the tangentof 1.570796326800000000... and not
tan(&/2). In degree mode, takingtan(90) givesTAN Error: InfiniteResult,with
the infiniteresultflagset. What is the conditionnumberof tan(x) near x = 7/2?
-T 1
C ( - /2) - 1 - - (x - w/2) + O((x - 7/2)

to data
In the lightof thisextremesensitivity
givingclear evidenceof the difficulty.
error, what purpose is served by getting 12 figures correct for
tan(1.570796326800000000... )? The assumption that all the unknown figuresare
zero is simplynot always tenable.
In some sense, the paper [1] contendedthatthe HP28S is not precise enough.
The above exampleshowsthatin fact,it is too precise,at least forsome problems.

Rootfinding.Wilkinson[10] has givena superblyclear accountof the sensitivity of

some polynomialroots to verysmall changes in the polynomialcoefficients. I will
not repeat the analysis here of the now-famousWilkinsonpolynomialp(x) =
(x - 1)(x - 2) ... (x - 20), exceptto note thatmanypeople take the sensitivity
an input polynomialroot as a motivationto use higherprecisionin rootfinding,
perhaps even using arbitraryprecision. The sad truthis that if the roots are
ill-conditioned,then small changes in the inputdata can drasticallychange the
roots,irrespectiveof thesolutionmethodused.

Solutionof DifferentialEquations. As a finalexample,we look at some differential

equations. These, too, have conditionnumbers,and not surprisingly we findthat
some ill-conditionedd.e.'s are of great interest:all chaotic problems are (by
definition)exponentially ill-conditionedas initial-valueproblems.It turnsout that
a systemis chaotic if the trajectoriesare bounded but C exp(At) for some
A > 0. In fact,A is preciselythe largestLyapunovexponent.This means thatfora
chaotic problem,data errors(i.e. in the initialcondition),modellingerrors,and
computationalerrorsare amplifiedat an exponentialrate.This impliesthata good
approximatesolution,good in the sense of being close to the "exact" solutionof
the specifiedproblem,is impracticalto compute,since good accuracyat the end of
the range of integrationrequires exponentiallyhigh precision for the initial
conditions(regardlessof the solutiontechnique-this would hold even ifyou knew
the exact solution).However, in the contextof modellingerrors,and given the
point of view that a good numericalmethodwill giveyou the exact solutionof a
nearbydifferential equation (i.e. just as good a model of the underlyingphysical
problem as the specified model), much insightcan still be gained from such
numerical computations,even though the computed solutions are practically
guaranteedto be nothinglike the exact solutions.See [11] fordetails.


So whatdoes thisall have to do withthe calculator?This materialis almost
certainly too advancedfora firstcoursein calculus,afterall. However,thereis an
exampleofa differential equationthatdoes comeup in anyfirst yearcourse,and
the HP28S even has a keyfornumerically solvingit. Of course,thisis the d.e.
y'(t) = f(t)-that is,computethedefinite integralf,'Iffr)dr. The performance of
thiskeyis quiteremarkable, and iftheHP28S is used in class,thestudents likeit
verymuchindeed.The following example(perhapsevenmorehorrifying thatthe
linearalgebraexampleof [1] at firstglance)providesan excellentpedagogical
Problem:compute, on thecalculator,
The calculatorwilltakemorethanan hour,almostregardless oftheinputerror
tolerance,to returnits answer22.82... -which, of course,is nothinglike the
Thisexampleis accessibleto studentsveryearlyon inthecurriculum. Manyare
extremely startledby the peculiarbehaviorof the calculator.Of course,the
calculator an errormessage(albeitintheverycryptic
returns andeasilyoverlooked
formof a negativereported estimatederror),so it is notquiteas bad as it seems.
However,thisexampleprovokesa verydesirabledegreeof skepticism in the
student,and givesstrongmotivation for the studyof improperintegrals(and
The observation
thatthecalculator is in factgiving
exactanswerto f1(dr/r)+ fJO(r)forE = 10-10and Kr) = 10-12 provides them
withwelcomereliefand understanding ofwhatthecalculator has done.Afterthe
reliefcomesthe realizationthatmostof the area of the figurelies nextto the
whichis a valuablepedagogicalpoint.
Conclusions.The point of view of backwarderroranalysis,i.e. that a good
numerical methodgivestheexactsolutionto a nearbyproblem, is veryhelpfulin
explaining the unexpectedbehaviourof calculatorsand computers on sensitive
problems. Thispointofviewis nota panacea,as someproblemcontexts preclude
thenecessary changesin theproblem.In particular, ProfessorW. Kahancautions
thatbackwarderroranalysisis intendedonlyas explanation and not as justifica-
tion,andwarnsthatthereare problems forwhichbackward erroranalysisfails.A
simpleexampleis composition offunctions-ifwe havea wayofcomputing f(x)
withgoodbackward error,and a wayofcomputing g(u) withgoodbackward error,
thenit is notnecessarilytruethatwe can compute(g of)(x) withgoodbackward
error.But,thereis no questionthatbackward erroranalysisdoeshelpwitha large
Thispaperechoesthecallof[1]fortheteaching ofthetheory ofconditioning of
problems. Sincethisis merely an application or thefirsttermin a
Taylorseries,or the firsttermin a perturbation expansion, thistaskis actually
In essence,thispaperhas shownthatthedifficulties exhibited in [1] werenot
the faultof the calculator, but ratherthe faultof the problem,in some sense.
Further,these difficulties actuallyprovidemotivation forthe studentto learn
sensitivityanalysisand the use of differentials,
norms,perturbation series,and
othermore sophisticated mathematical topicsthan thosejust to "solve" the
problem.In viewof data error,thesetopicsshouldbe learnedanyway. It has also
been made clear that the theoryof conditionnumbersis not restricted to
numerical linearalgebra,butis in factofwidepracticalutility.Thisusefulness is
onlyenhancedbytheexistence bywhichmanyofourstudents


are exposedtoverypowerful
and sophisticated
ACKNOWLEDGMENTS. I wouldliketo thankMs. AmandaConnellforprogramming assistancein
B. Figure1 was preparedby Professor
finding GeorgeCorliss.Doug Moseleyand ProfessorChris


1. Y. Nievergelt,NumericalLinearAlgebraon theHP-28or How to Lie withSupercalcualtors,this

MONTHLY, VOl98,no. 6, pp. 539-543,June-July 1991.
2. D. Kahaner,C. Moler,andS. Nash,Numerical Methods andSoftware, 1989.
3. G. DahlquistandAkeBj6rk,Numerical Methods, 1974.
4. U. Ascher,R. M. M. Mattheij,andR. D. Russell,Numerical Solution
ofBoundary ValueProblems
Equations, 1988.
5. B. Char,K. 0. Geddes,G. H. Gonnet,M. B. Monagan,and StephenWatt,TheMapleReference
Manual,5thed.,WATCOM 1988.
6. G. W. Stewart,"Cramer'sRule,"USENET posting to sci.math.num-analysis,
No. 249,Message-
ID:(42829?, 12 Nov91.
and P. A. Rosati,Use of theHP28S Supercalculator
7. R. M. Corless,C. Essex,P. J.Sullivan,
FirstYear Engineering Mathematics Courses,Proc. 7thCanadianConference on Engineering
Toronto, June1990.
8. G. Goluband C. Van Loan,MatrixComputations, JohnsHopkins,1983.
9. The MATLABReference Guide,The MathWorks, 1989.
10. J.H. Wilkinson,Rounding ErrorsinAlgebraicProcesses, 1963.
11. R. M. Corless,"Defect-ControlledNumerical Methodsand Shadowing forChaoticDifferential
Equations",PhysicaD, vol.60, 1992pp. 323-334.

of WesternOntario
London, Canada N6A 5B9

Accordingto cable reportsfrom

London,the Council of TrinityCol-
has removedProfes-
sor BERTRANDRUSSELLfromhis lec-
tureshipin logic and principlesof
mathematics on accountof his having
been convictedunderthe defenseof
the realmact forpublishinga leaflet
defendingthe "ConscientiousObjec-
tor" to servicein the Britisharmy.
ProfessorRussellis wellknownin this
countrythroughhismathematical writ-
23,(1916)p. 317