Thursday, July 22, 2021

What Does Accuracy to Three-decimal Places Mean?

I will be using some mathematical calculations and if you are not into it, kindly stop right here.

This is a pet peeve of mine, and as with most pet peeves, quite useless. Yet, please indulge me.

When I teach a class in the waning years of my professional engagement with engineering, I tell my students that when I mean “Do the problem to three-decimal accuracy”, it has a specific meaning. This is an effort to expose that meaning and hope that people would not think of it as trivial.

For example, suppose I need the cosine of 41.780, if I type out the number on my calculator, I get 0. 745708618.

Students tend to carry this precision of 9-decimals into their subsequent calculations, but not always and all through. And, how tedious it is, how prone to error it is, students can attest to. Upon my command, they fix the display in their calculator to three digits, which shows 0.746. They think they have satisfied the condition I have imposed.

They are not aware that what the calculator shows is not what it does. It is not GIGO either. It is somewhere in between – Betwexit, we may call it, sort of rhyming with Brexit.

The calculator still does the calculation with the full nine decimals. For example, I want 9.85 x Cos (41.78). My calculator, on which I have not stipulated the number of decimal places to be displayed as three, I get 7.345229887. Fine. I fix the number of decimal places to three, and I get 7.345 (I have checked this on my calculator).

Now, if I took only three decimal places (after rounding off) for the cosine of 41.78o and multiply that by 9.85, I get 9.85*.746 = 9.348. There is an error of the order of 10(-3).

No big deal, you say and I shout NO!

I do not insist on this curtailed precision for more than one problem I give in my classes, and that too, only to make the point my teacher of Numerical Analysis made in September-October, 1978.

That was Professor A C R Newberry, a Scotsman with an accent that was hard on everyone’s ears and almost indecipherable (there were no other Scot) in the class. He gave us a very simple problem, and at first glance, it looked too simple to be even insulting!

He asked us to write a Fortran programme (double precision demanded) and find

Σ (1/n!) for all integer ‘n’ between 1 and 30 (both inclusive). It is a two-line programme and I did it.

However, something struck me just as I was about to put the short output, (taken on a dot matrix printer) into my bag to go to my desk from the computer center. I said to myself: “ACR is not stupid! Why would he give such a simple problem? There must be something to it.” The assignment was not due till the next day; I had time to ponder over what ACR wanted us to learn.

Then, it struck me – precision! Yes, that is what it is.

I redid the problem and the programme, and this time, I went (1/30!) + (1/29!) + (1/28!) + …… + (1/3!) + (1/2!) + (1/1!). Yes, in double precision, there was a difference between going

1       30 and going 30       1!

As you go in the reverse order, you are adding a number that by itself is very small to another number that is smaller still; the chances of ignoring these very small numbers as they add up is extremely small. Yet, the sum of these numbers keeps getting bigger and bigger and tend to match the precision of the next number to be added. But doing it the “old fashioned way!”, going from 1 to 30 ignored all the numbers beyond a certain point. The difference between precision and accuracy hit me like a thunderbolt.

I got an ‘A’ grade for just this thought. The RoI was huge.

This is the point of numerical analysis beyond the syllabus I introduce to students in their Engineering Mechanics class, for good or bad. Just the flavour, and nothing more.

I open up an aspect of how their calculator works, at least to the curious among the student body.

Raghuram Ekambaram

 

 

No comments: