PDA

View Full Version : Internal Mechanism of a Calculator

AceRegen
09-04-2001, 11:09 AM
I was fiddling around my calculator one day when I realised tt i have been using its functions blindly. For example, how can the calculator calculate the values at such a fast rate?

What actually took place inside the calculator during the process? for example, the calculation of 69! which will take men for god knows how long to calculate can be calculated in fractions of a sec.

Are there any formulas they used within the calculator? And if I'm interested to know more, which field in engineering/ mathematics should i read up on? I dunno the specific chapter to look information on these.

friedo
09-04-2001, 11:33 AM
What you want to read about is Computer Science. CS is a big field of course, and the specific discpipline dealing with this sort of thing is is a mish-mash between Computer Engineering, Circuit Design and Electrical Engineering.

The calculator has certain hard-wired processes ("algorithms") built into its electronics. Various pieces of data are stored in the microprocessor in easily accessable spots called registers. The microprocessor is capable of performing very simple operations, such as addition and subtraction, and these operations can be strung together with logic for more complicated things. Here is an example of the process for addition:

Put the first number in register A.
Put the second number in register B.
Add the two numbers and put the result in register X.
Display the value in register X.

For multiplication it's a bit more involved.

For square roots, it's even more involved. As technology improves and the electronics are capable of holding more procedures, the calculator can do more functions.

Some fancy calculators, like TI's graphing calculators, are totally software based and can be programmed. The disadvantage is that they are quite slow for complex calculations.

yabob
09-04-2001, 12:03 PM
I think the OP wants to know the algorithms.

What you want to look up in a good elementary calculus text is "power series expansions" or "taylor series". Power series expansions are the fundamental way in which most elementary functions, like "log()", "sin()", etc are calculated.

With the relative cheapness of memory these days, sometimes in-memory tables are used for elementary functions, rather than computing them, with an interpolation step to obtain about another decimal place of accuracy. This probably won't be done for your calculator, though.

One interesting side topic to this area goes by the name "economization of power series", often using something called the "Chebychev polynomials". Thing is, the standard series expansions out of your math book, when cut off after a given number of terms, produce rotten error distribution - typically very accurate near the expansion value, with the error increasing dramatically out near the boundaries of the interval you apply the series to. The economization techniques give you a way of adjusting the series coefficients so that the error is more evenly distributed, allowing you to get acceptable accuracy with fewer terms. This has applicability to things like calculators, and is a topic you will find in numerical methods texts.

astro
09-04-2001, 12:10 PM
http://www.math.tamu.edu/~jmorgan/Right_Angle_March_99/calculator.htm

Jeff Morgan

Have you ever wondered how your calculator computes different values? I've asked my students this question almost every year, and they typically have no clue. There really isn't any reason for them to give it much thought. Still, I like to hear their responses. Some of them have interesting ideas.

Basically, all a calculator can do is add, subtract, multiply and divide. They don't store entire tables for the sine, cosine and log functions, but they definitely compute the values rapidly, and with tremendous accuracy. If your students have had enough calculus to be exposed to Taylor polynomials, then some of them will probably respond that the sine function is evaluated using a Taylor polynomial."

etc etc

From Cecil

How does a calculator percent key work?
http://www.straightdope.com/mailbag/mpercent.html

And so much more than you ever wanted to know in your most desperate dreams...

Microcode: Electronic Building Blocks For Calculators
Hewlett Packard Personal Calculator Digest
Vol. 3, 1977 pp 4-6
http://www.public.usit.net/rfurr/hp-code.htm

and

THE CALCULATOR REFERENCE
http://www.public.usit.net/rfurr/

Calculating Machines
http://www.webcom.com/calc/

What the heck is this "Curta" thing hmmmm....

erislover
09-04-2001, 01:18 PM
I hope the OP is only asking about algorithms. I built a binary adder with an LCD display once just for kicks. Seeing the size it took up on my breadboard made be laugh about how much a figgin claculator can do in such a tiny package.

RE: Numerical Analysis
Do specific claculators use more than one method? For example, Simpson's Rule gives 100% accuracy for polynomials up to the third power after a given number of terms (though I can't remember the number). So is Simpson's Rule incorporated here, then another there for other numbers, etc, or are the Cheby-whatever methods so darn successful that you just need the one and then forget it?

SmackFu
09-04-2001, 02:50 PM
Logarithms are the secret to a lot of this stuff. They let you convert a multiplication into an addition, and a division into a subtraction. So roots and such become much easier.

Kalashnikov
09-04-2001, 05:54 PM
Originally posted by friedo
What you want to read about is Computer Science. CS is a big field of course, and the specific discpipline dealing with this sort of thing is is a mish-mash between Computer Engineering, Circuit Design and Electrical Engineering.

You mean electronic engineering. Electrical engineering deals with motors, generators, transformers etc. but not computers and microelectronics.

Balthisar
09-04-2001, 06:06 PM
Originally posted by kalashnikov
Originally posted by friedo
What you want to read about is Computer Science. CS is a big field of course, and the specific discpipline dealing with this sort of thing is is a mish-mash between Computer Engineering, Circuit Design and Electrical Engineering.

You mean electronic engineering. Electrical engineering deals with motors, generators, transformers etc. but not computers and microelectronics.

No, friedo was right. It's "electrical engineering" or "computer engineering." There's not such thing as "electronic engineering" from the academic standpoint. You could be thinking of "electronic engineering technology" which is not an engineering degree; it's an "engineering technology" degree. This is the type of degree you can get at a community college, Devry institute, etc.

Every "electronics engineer" that I know (that has a degree) has an "electrical engineering" degree. In school, and after, you specialize in electronics to become an "electronics engineer."

AceRegen
09-04-2001, 09:55 PM
Originally posted by SmackFu
Logarithms are the secret to a lot of this stuff. They let you convert a multiplication into an addition, and a division into a subtraction. So roots and such become much easier.

I'm curious as to how the logarithm function works. SmackFu do u mean examples like

lg5 + lg4 = lg(20) -1
lg5 - lg4 = lg(5/4) -2

So how r they related? For example, the user keys in (5+4) and the calculator process it like (1) above? in a more complicated manner?

P.S: How does the log function come about anyway?

Kalashnikov
09-04-2001, 11:43 PM
Of course there is plenty of overlap, but the IEEE draws a distinction between the two, as do some schools, especially outside the US.

from http://www.ieee.org:
"Electrical engineers generally deal with large-power applications, such as utility and industrial power systems, whereas electronics engineers deal with low-power systems such as computers and communications."

Who said we were talking about what's on someone's diploma anyway? I have never heard of anyone with a degree in "Circuit Design", have you?

RufusLeaking
09-04-2001, 11:45 PM
Just for grins, hold down more than one key at a time on your calculator. On most calculators, you will see extra segments activated in the display. Try different combinations of multiple keys. The keys on a calculator do not have a separate wire for each key but rather an X - Y matrix that is designed to only detect one key at a time (the function/shift keys being an exception to this). Thus a row of eight wires against a column of eight wires could detect 64 different keys. Furthermore, these same rows and columns of wires are multiplexed with the LCD display which is why the display goes nuts when you hold multiple keys down.