The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Comparison (34C-59) R⇄P conversion
05-21-2024, 01:00 AM
Post: #1
Comparison (34C-59) R⇄P conversion
An excerpt from Lecture Notes in Computer Science, 142, Problems and Methodologies
in Mathematical Software Production
, International Seminar Held at Sorrento, Italy, November 3-8,1980

     We motivate our concerns for the environment and for the design and implementation of algorithms by experimenting with some simple programs. Consider the evaluation of the magnitude of a complex number z = x + iy, where i = √(-1).
By definition,
                                         〡z〡 = √(x2 + y2).

This definition corresponds to the theoretical method for determining 〡z〡, and suggests the obvious algorithm of squaring the components, summing them, and extracting the square root. Suppose we implement that algorithm on a programmable hand calculator, a TI 59, say, and run it with x = 3 and y = 4. Then we find that 〡z〡 = 5, which suggests that we have implemented the algorithm correctly. Now suppose we scale the original data by 10-50 , and try again. This time the calculator stops with a blinking display of '1.-99'. Clearly there is an error of some sort in the calculation. Even though the data and correct result are all representable within the machine, the program is unable to return the correct result. At least the blinking display warns of trouble.
     When we try the same experiment on an HP 34C calculator, we obtain the result '4.00-50' for the scaled problem. The result is again in error, but it is different from the previous one. Even worse, there is no indication of trouble this time. We conclude that the obvious algorithm is not necessarily the best algorithm, and that implementations on different machines behave differently. This conclusion reinforces our decision to distinguish between the algorithm and its implementation.
     Each of these calculators contains a built-in program, accessible with a simple keystroke, for conversion between rectangular and polar coordinates. Such a program automatically determines 〡z〡as the radial coordinate. If we use the conversion program on a TI 59 with the scaled test data, we obtain the puzzling result '4.472136-50', again with no indication of error. This is more serious than before because we have used a 'system program' that is supposed to be correct, not one that we wrote. When systems programs contain errors, especially programs built into calculators, they are hard to correct. Happily, the conversion program built into the HP 34C returns the correct result '5.00-50'.

The results of this demonstration are not reassuring.

BEST!
SlideRule
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Comparison (34C-59) R⇄P conversion - SlideRule - 05-21-2024 01:00 AM



User(s) browsing this thread: 1 Guest(s)