Scientific calculators, usage of exp



#26

I have wondered whether there is still much use of scientific (as oppposed
to 'ordinary') calculators outside of school; for instance in mechanical or
optical engineering, is most calculation done on software loaded on desktop or
other computers, using high-end tools such as Mathematica, Maple or other
software packages? Has the scientific calculator gone the way of the slide
rule?
Also, I wondered why it is often the case that the squaring function was
provided on calculators, but an extra button provided for performing other
exponentials? Why wasn't/isn't a general exponential button provided? Is this
because in the common usage of statistics or geometry, only the 2nd power is
used?
Thank you for any information you can provide.
Lesley Evensen


#27

I have found that most real scientific calculators have a general (Y^X) function key... certainly all the HP's do.

Since X*X is so common they also have this as a shortcut. It is also implemented by direct multiplication and is much faster and more accurate than the Y^X function that uses LOG, MULTIPLY, ANTILOG internally.


#28

BTW, regarding y^x, have you tried on a 21:

2

enter

3

y^x

8

-

This is caused by the log-antilog algorithm, and is documented in a HPJ article that I remember reading in the 80s. I guess other woodstocks have the same rounding error


#29

Yes, the article is in:

Hewlett-Packard Journal, November 1976

"The New Accuracy: Making 2**3 = 8"

The HP-25C (for instance) had the innacurate algorithm
while the HP-67 used the new one, if I'm not wrong. I also
remember that the first calculator to feature the improved
algorithm was the Topcat series HP-91.

As for implementing x^2 by direct multiplication
instead of using the much slower y^x algorithm (which
does it as log, multiplication, antilog as stated), one
of the worst cases I've ever seen was the computation of
sqr(x) [square root of x] in the Sinclair Spectrum
micro-computer of the 80's [sold in USA under the namebrand
Timex].

Usually the square root is computed using a very fast
algorithm, so fast that computing a square root takes
almost the same time as a single division operation. But
in the Spectrum, it was computed so:

sqr(x) = x^0.5 = exp(0.5*log(x))

so it took a log, a multiplication, and an antilog as well.
Both the log and the antilog used Chebyshev series
expansions, i.e.: many, many multiplications and divisions.
The final result was that on the Sinclair the square root,
far from being comparable in speed to a single division, was in fact one of the slowest math functions available.
It wasn't the slowest, either, because there were
others that did use sqr itself ! Some trigonometric
functions were calculated as functions of others, so
they ended using square roots, and they were incredibly slow !!

Why did the people who wrote the BASIC interpreter use
such an inefficient way of computing the square root ?
Simple: because of lack of space in the ROM. They had just
16 Kbytes (!!) to implement a complex dialect of BASIC, with
many, many commands plus an underlying 'operating system'.
So they had to economize and optimize as much as possible.
And computing sqr(x) as e^(0.5)*log(x)) saved a *lot* of
bytes, badly needed for other features.

Has this anything to do with HP calcs ? Yes. If you
get a copy of the *wonderful* HP-15C "Advanced Functions"
manual, you'll read the experts at HP discussing the
necessary tradeoffs between accuracy and speed/space needed.
In the case of the HP-15C, this has to do with the
guaranteed accuracy for the complex functions, which
cannot be computed to the same accuracy as their real-only
equivalents unless you make them *four* times slower and
use a lot of valuable ROM for very unfrequent, boundary cases.

In HP-15C AF you'll learn why this is so, and specific
worst cases are given, as well as sample programs to
demonstrate how it could be done if necessary. Although
the examples are given for the HP-15C, all the discussion
applies equally well to the next generations of HP calcs
which followed the HP-15C, all of them using the same
algorithms, for instance:

  • - the 41C Advantage ROM advanced functions for SOLVE
    and INTEGRATE were taken from the HP-15C.

  • - the HP-71B equivalent advanced functions present in the Math ROM, FNROOT and INTEGRAL, as well as
    complex functions, were also taken from the HP-15C, while
    the matrix functions were taken partly from the HP-15C
    and partly from the HP-75C Math ROM and the HP-85 Matrix ROM.

  • - all subsequent Saturn-based calculators, such
    as the HP-42S up to the latest HP48/49, did inherit
    those basic algorithms as well.

So, you, see, the HP-15C AF manual is essential
reading if you are interested in this particular topic.


#30

Great! I also remember a Byte magazine article about calculating day-of-week using zeller congruence formula - a wonderful algorithm, taught me how to use integer arithmetics instead of "if"s.
Does anyone know what algorithm is used for day-between-dates ?

#31

I am familiar with the Sinclair ZX81/Timex-Sinclair 1000 computer to which you referred.

I believe that their improved floating-point BASIC plus the "OS" (NEW, LOAD, SAVE, etc. as well as video management firmware - very clever!) fit in an *8K* byte masked ROM, not the 16KB one you indicated. Not a bad job when you think about it. I looked at its ROM dump once and it was just a few bytes from being "full".

Their predecessor, the Sinclair ZX80, had a simpler integer BASIC that was contained in a 4Kbyte mask ROM. By contrast, a machine like the Commodore 64 had an 8KB version of Microsoft BASIC with a 4KB "Kernal" (meaning OS/system services) ROM. 6502 Ataris were probably about the same.

I believe quite a few other BASICs only offered minimal transcendental/ math functions - usually it was SQR(X) for square root, EXP(x) for e^x, LOG(X) for ln(x), and SIN(X), COS(X) and ATN(x). The "**" operator was for raising to a power and used log-multiply-antilog method. Other trig functions and Briggs logs would have to be derived by user and perhaps defined via DEF FNA(x) = (expression).

And given that floats were 32 bit or 40 bit (Commodore), accuracy was about 7 dec digits (for 24bit mantissa) or 9.6 dec digits for 32bit mantissa.

I once looked at the log/trig function accuracy on some of these BASICs and thought the calcs were a bit better at small argument values. (BASICs used Chebyshev polynomials & range reduction). Repeated [argument],[OP],[Inverse-OP] sequences on calculators returned orig value whereas with the BASICs, there would be gradual drift away from the orig supplied argument.

Bill Wiese
San Mateo, CA
wmwiese@yahoo.com


#32

Bill Wiese posted:

"I am familiar with the Sinclair ZX81/Timex-Sinclair 1000 computer to which you referred."

Wrong. If you read my post again carefully you
will see that I did not refer to the ZX81 but to the
ZX Spectrum, which is the much improved successor (kinda
"ZX82").

This ZX Spectrum machine did have a *16 Kbyte*
ROM (not 8K) which included the BASIC and the opertating system.
It featured many improvemente over the ZX81 you are
familiar with, such as: color screen, graphics commands
(LINE, CIRCLE), lowercase, up to 48 K RAM built-in,
better support for machine code programming, it
always ran in FAST mode with a perfectly steady screen,
it could use microdrives and ROM cartridges, etc, etc.

This machine was highly successful, many million
were sold, and many very good machine-language games were
developed for it. A book was published which included the
entire contents of the 16K ROM, commented and explained,
and it made very interesting and enlightening reading,
specially the apendices where the implementation of the
floating-point calculator and the trascendental math
functions were detailed at length.

By the way, HP did once the same, with the HP-71B
IDS volumes. I've read both (the Spectrum's and the 71B's)
and certainly the 71B BASIC functions are much more
efficiently and accurately implemented, state-of-the-art
in fact,
though of course comparing them isn't fair: 71B BASIC is
intended for engineers and higly technical applications,
and it's 64 Kbytes long, while Spectrum's BASIC is just
for the hobbyist, mostly teenager computer user, intended
mainly for games and home applications, and only 16 Kb
in length. That its programmers could fit so much
functionality in only 16 Kb of Z80 8-bit machine code is
an amazing feat of space optimization.


#33

This reminds me that time when in college my brother and I bought together a BBC model B 32K (all other popular home computers such as Vic20, ZX81, TRS-80, ... had 8 or 16K). Powered by a motorola 6502 processor, it had a double disc drive, a 80 cpl Epson printer and a small Sony TV that was used as colour monitor. In 83 we paid more than $3.000 for it...

Of course I am of the opinion that my home computerwas far better than the C64 or the ZX Spectrum :-)


#34

Thibaut.be posted:

"my brother and I bought together a BBC model B 32K
...
In 83 we paid more than $3.000 for it
...
Of course I am of the opinion that my home computerwas far better than the C64 or the ZX Spectrum :-)"


You are right, it was a better computer, and faster
too. It used a 6502 at 2 Mhz and still was faster than
the Spectrum's Z80A at 4 Mhz. Why ? Because its BASIC was
less 'cramped' than the Spectrum's, not so much compromise
between speed and space. It was also a better version of
BASIC, with many advanced capabilities.

However, the comparison is not fair, again. The
BBC machine wasn't for everyone, at $3,000. On the other
hand the Spectrum was, at something like $200. That's
why the Spectrum sold millions, while the BBC didn't.
And that's why there were tons of quality software
developed for the Spectrum, less so for the BBC, which
only had a minimum presence in the market for it being
nearly mandatory at British schools.

The exact analogy for HP calcs would be comparing
the $750 HP-71B versus the $100 TRS-80 PC-1 Pocket
Computer of the time.


#35

Yes, you're right, the Spectrum was far cheaper, but it appeared quite later than the BBC, and its price was lined up wih the C64... The Acron 64 was more its competitor, and was also in the same price range of the Spectrum...


#36

"The Acron 64 was more its competitor, and was also in
the same price range of the Spectrum..."


Is "Acron 64" a typo and you really mean "Acorn"
computers ?

If yes, the Acorn were kinda "BBC Lite Edition", so to say,
very capable machines but that were marred for their
strange dialect of BASIC, which was cryptic and terse to
the point of being unreadable.

So much so in fact, that Acorn BASIC programs were
practically incompatible with other BASICs, and very hard
to decipher. When printed, they looked much more like
some kind of assembler than BASIC, to be sure. They
frequently used the local equivalents of PEEKs, POKEs,
CALLs, and VDUs, absolutely non-portable. Also, everyone
used the abbreviated form of the BASIC commands, and
little or no spacing or formatting. The result was
frightening, perhaps like RPN or RPL seems to AOS users ! :-)


#37

Yes, I of course meant Acorn. I often make typos because I'm browsing the site while I'm working and sometimes write a message whili I'm having a phone conversation.

VDU and on top of that *FX functions were my preferred : they are in some sense similar to some flags of the 41 ;-)

But you're right, the Basic of these machines was not protable but was quite enhanced : they englobed Pascal functions such as REPEAT, DO ... WHILE, PROC and DEF FN functions that were really useful... I had a great time working with these machines...

#38

> Powered by a motorola 6502 processor[...]

Hmm. I could have sworn that the 6502 was made by someone other than Motorola. I seem to recall that Motorola produced the 6800 and that the 6502 was a slightly improved version
produced by a different company (whose name escapes me). The story, as my swiss-cheese-like memory wants to recall it, is that the other company was either founded by, or hired away,
several of the 6800's key design people.

Does that sound correct to anybody else?

<crickets chirping>

Anybody?

Please...?


#39

You're right. The 6502 was produced by a company called MOS Technology. They were later purchased by Commodore and produced an enhanced version of the 6502, called the 6510, which was
used in the Commodore 64.

#40

The 6502 was an original product of MOS Technology and was second sourced by Rockwell (and others). Part of the genealogy is 8080 -> 6800 -> 6502, each successive design being a simplification and therefore a cost reduction of the previous. I seem to recall that MOS Technology was started by some Motorola engineers, possibly with seed money from Motorola. Mr. Wozniak (spelling?), I have read, used the 6502 for the Apple 1 design because he was able to buy one from a sales rep at a trade show for about $15, while other microprocessers cost $hundreds for one piece. I think it was Rockwell that he originally used.

Rockwell made their own line of industrial control computers based on the 6502, and RCA had a similar line based on the 1802. I am fascinated by the microcomputer products that microprocessor manufacturers sold (or tried, anyway!), as far as it expresses the vision a company had of what you could do with a microprocessor. Most companies had a development system, sometimes based on their industrial single board computer line, like the Intel "blue boxes" and the Motorola "ExorTerm". Then there were the educational boards like the Motorola "D2" kits and the Kim and Sym - I know of these two but I don't know the details, I think they were both 6502 from different second source manufacturers - I think Sym was from Synertek. These generally had a hex keypad and a few LED digits or attached to an ascii terminal. Rockwell had the king of such educational products, the AIM 65, which was a 6502 computer with a full keyboard, an alphanumeric LED display and a strip printer. (Kind of like an HP9825, now that I think of it.)

Then there are actual end-user microcomputers built by microprocessor manufacturers - two I know of are the TI home computer and the Western Digital microengine (somehow, I always come back to this one! anybody know where I can get a boot disk for it?) But did MOS Technology beget Commodore or did Commodore buy MOS Technology?

#41

Motorola should be a 6802, MOS Technology may be a 6502 (the kind used in the Apple II, among others)

At that time, I liked the RCA Cosmac 1802, a nice CMOS microprocessor, but rather weak as an architecture (sort of a V-RISC-i: VERY RISC indeed!!)


#42

I don't remember exactly what processor it was... I thought it was a Motorola and/or a 6502. Maybe Mr EX-PPC member could confirm...


#43

It was indeed a 6502 at 2 Mhz.

If I remember correctly, the 6502 was conceived and developed
by Chuck Peddle while working for MOS Technology. It
was more or less inspired on the Motorola 6800, but was
considerably cheaper than the $200 the 6800 commanded at
the time.


#44

I found the reference to ZX Spectrums very interesting with regard to efficiency in the ROM.

The square root algorithm could, as has been pointed out, been implemented more efficiently with the standard division-like method. It could also have been done using Newton's method (on the mantissa only, range -1 < mantissa +1). By efficiency, I mean speed _and_ space taken.

The HP calculators use the CORDIC method of calculating transcendental functions such as SIN, LOG etc.

I feel that the Z80 code in the Spectrum and other similar machines would have been more compact with this method, as opposed to Chebyshev routines (I can't prove this - not enough time!). It would also have been a hell of a lot quicker. I'll pass silently over the Spectrum's circle routine..

Also, I've heard that machines like the BBC and Commodore 64 used look-up tables with interpolation - dirty but quick!

Yet again, this seems to demonstrate the superb software engineering inside the HP calculators..

Kelvin


#45

Kevin posted: "I found the reference to ZX Spectrums very interesting with regard to efficiency in the ROM."

Thank you

Kevin: "The square root algorithm could, as has been pointed out, been implemented more efficiently with the standard division-like method. It could also have been done
using Newton's method (on the mantissa only, range -1 < mantissa +1). By efficiency, I mean speed _and_ space taken."


No way. When I said that the programmers of
the ZX Spectrum's ROM had done an incredible job of
optimizing for space I meant it. Their implementation
of the square root function SQR(x) takes just *7 bytes*
(that's right, seven bytes !!) of Z80 machine-language
code in the ROM.

No other approach is likely to take less, not
certainly Newton's method, don't you agree ?


Kevin: "It would also have been a hell of a lot quicker. I'll pass silently over the Spectrum's circle routine.."


I did remember what was the slowest math function
in the ZX Spectrum's implementation. It was arc cosine,
because it used the arc sine function, which in its
turn used the square root function, and that was computed
using log and antilog. Of course, it was done that way
for efficiency purposes: arc cosine takes only another
7 bytes of ROM !!

Just in case you are curious, a little table showing
the bytes required to implement various math functions:

Square root ............   7 bytes
Arc cosine ............. 7 bytes
Tangent ............... 8 bytes
Cosine ................. 11 bytes
Arc sine ............... 16 bytes
x raised to yth power .. 29 bytes

How's that for efficiency ?


Kevin: "Yet again, this seems to demonstrate the superb software engineering inside the HP calculators.."

Yes, I agree. But let's not forget that the ZX Spectrum with 48 K RAM was more than 8 times cheaper than the HP-71B with 16 K RAM. And the poor ZX programmers had to fit their BASIC plus operating system into just 16 Kb, while HP engineers had 64 Kb to do their marvels.

#46

Whoops!

>Bill Wiese originally wrote:
> "I am familiar with the Sinclair ZX81/Timex-Sinclair
> 1000 computer to which you referred."

>ExPPCMember wrote:
> "Wrong. If you read my post again carefully you
> will see that I did not refer to the ZX81 but to
> the ZX Spectrum, which is the much improved
> successor (kinda "ZX82")."

Yep, you got me. Yes, the Spectrum would've had to have had 16K for the advanced BASIC and graphics.

Wow, didn't know there were any Timex Spectrums sold in the USA - thought they died in Waterbury before they could cross the pond from Sinclair.


Bill Wiese
San Mateo, CA


#47

Yes, very nearly.

The Timex 2068 was an "enhanced" Sinclair Spectrum, and it was to originally be a 20"48", having 48K of User RAM. But thanks to (perhaps excessive) tweaking by Timex, and then having to jump the hurdles of FCC certification of what WAS a newly-designed computer, Timex came round to trying to meet the Commodores and TIs and Ataris of the world by eventually boosting the user RAM to 60K, implementing a bank-switching scheme to support the extra User RAM-- plus an enhanced cartridge slot-- in the area Speccys had ROM in.

By the time they brought this wonder to market, TI had started the home computer bloodbath. They gave up on the market entirely, in the meantime dumping their considerable stock of machines on the market AT COST and virtually sucking all home computer sales down into the swirling drain with them.

Many will remember better than I, I believe it was August '82 (or was it '83?), when TI pulled the plug. Then followed a Toys'R'Us holocaust, with Coleco Adam and Mattel Aquarius and so on following shortly thereafter, then even solid systems like Commodore and Atari swimming in red ink and beseiged by panicked investors. Timex rolled out the 2068 in the January following and began their "fire sale" almost immediately, running direct sales ads in March/April. By June, Timex Computer Corporation, a wholly-owned subsidiary of the privately-held Timex Corporation, folded their operations.

The 2068 probably sold 10 to 15 thousand machines, almost all orphans by the time the users unboxed them. It was an extraordinarily GOOD machine, very easy to use, powerful for its price, and with a remarkable lot of software quickly ported from the popular Sinclair Spectrum catalog in the UK.

Unfortunately, it contained a CMOS PAL chip for many of its internal functions, and these 2068s have not proven very robust over the years since. The PAL chip, once it is gone, has no replacement, since it was proprietary and neither Timex nor Sinclair were free enough of legal fetters to release to hobbyists the formulae of its internal design.

The Spectrum remained popular in the UK, even went through several incarnations to include storage cassetes, etc. and I think they were selling the thing into the early 90's.

#48

Impressive to see these responses, someone could write a history book...part 2 or question 2 was/is: any of you mechanical/optics/other engineers using calculators (rather than desktop/other 'computers' w/fancy packages such as Maple/Mathematica) in daily work?


#49

@ Lesley:
To answer your question: YES. Doing a design job I certainly use work stations with customized programs. Besides that one has a calculator on the desk to estimate tendencies before starting complicated computations.

On site the scientific calculator is all you carry in your pocket. Or could you imagine anybody climbing onto a power transformer with a notebook under his arm? Of course you also have to have the principals either programed or in your memory (mind). Same if you are called to the test bay in cases products do not behave as expected. First analysis on temperatures, overvoltages or what ever is done using a calculator. You would be astonished how close such estimations come to the final analysis done back in the design office. Precondition is you know your job.

All colleagues have one or more calculators, most common is the HP 32SII, but there are even two HP85 still in operation (for engineers with large finger tips). I still use my old 15C (and recently purchased a 48G with memory upgrade to play with).

My opinion is that before one starts to use large software packages, he should have understood the principals behind and be able to judge results. Sometimes problems are not well conditioned and could get one on the wrong track. And before one starts using calculators, he should be able to do calculations by approximations using log tables and slide rules. In short: using a calculator with little knowledge doesnt make sense, using powerful software under this circumstances makes even less sense.

I simply cannot do my job without a reliable calculator and I hope the 15C will last until retirement, because as I had to learn here I will not be able to get any quality calculator anymore (new models like 6S, 30S, 49G and such nobody in our design department likes, because they are too flimpsy).

In case my English yield to misunderstandings, please activate your error corretion algorithm.

Best regards,

Stephan


#50

Stephan wrote:

"In case my English yield to misunderstandings, please activate your error corretion algorithm."

First, let me say your English is many times better than my German (I do have ein bisschen!)

I love your closing statement because it resonates with an idea I like to think about. It is probably a well described scientific fact to linguists but to me, it is just a fascinating notion: the idea that all languages contain large amounts of redundancy that make it possible for "mere mortals" to communicate easily and reliably. An example of the result is having a conversation in a room full of other conversations. I understand enough of mathematical error detection and correction schemes to know that what makes them possible is redundant information and I think human communication must rely on a similar method. Grammer is a set of code rules that defines some patterns as illegal and that is a form of redundancy. But even when grammer is violated, communication can take place. There must be multiple levels of redundancy, like CD-Audio. The final level with CD-Audio, when the information is just lost, is to interpolate a sample between two good samples, to avoid a "pop". As Simon and Garfunkle said, "... a man hears what he wants to hear, and disregards the rest."


Possibly Related Threads...
Thread Author Replies Views Last Post
  Availability of scientific HPs Matt Agajanian 4 988 08-28-2013, 07:40 AM
Last Post: Eddie W. Shore
  [HP Prime] - EXP() or e Jean-Michel 6 1,414 08-27-2013, 03:22 PM
Last Post: deachp
  JOT scientific calculator Richard Berler 4 1,253 08-21-2013, 05:25 PM
Last Post: Richard Ottosen (Denver, CO, USA)
  Our 11C Scientific Calculator Android app is on launch sale, 0.99$ only John 1 806 06-22-2013, 01:38 PM
Last Post: Marcus von Cube, Germany
  Vicinno 11C Scientific Calculator app is on Android now John 0 637 06-14-2013, 02:28 PM
Last Post: John
  Great news - Vicinno's HP 15C Scientific Calculator iPhone app is FREE now John 21 4,251 06-07-2013, 05:49 AM
Last Post: Mike (Stgt)
  HP35s scientific calculator GREG W THOMAS 4 1,261 03-22-2013, 06:49 AM
Last Post: Thomas Radtke
  Yet another new scientific HP calculator ! Mic 24 4,358 11-04-2012, 04:53 PM
Last Post: NateB
  O.T. Sinclair Scientific Lars Bergström 14 2,886 04-08-2012, 07:51 AM
Last Post: ClausB
  Scientific version of 30b by HP? kc 26 4,340 02-13-2012, 07:24 PM
Last Post: db (martinez, ca.)

Forum Jump: