Post Reply 
Help for a student project on calculator algorithms
08-13-2018, 02:55 AM
Post: #1
Help for a student project on calculator algorithms
Marty Cox is a student currently doing a homework assignment on how special functions (e.g. exp, sin, ln) are calculated on scientific calculators. He contacted Joerg Woerner at Datamath.org who asked if I could help, but I do not know anything about the subject

Does anyone have answers for Marty and can point at readings on the subject for him?

Thank you for your help

Benoit
Find all posts by this user
Quote this message in a reply
08-13-2018, 03:35 AM
Post: #2
RE: Help for a student project on calculator algorithms
Hi, Benoit,

Try this book: Scientific Analysis on the Pocket Calculator, by Jon Smith
Find all posts by this user
Quote this message in a reply
08-13-2018, 03:44 AM
Post: #3
RE: Help for a student project on calculator algorithms
This is an awesome book!! Thanks a million for the link to the pdf file!!!

Namir
Find all posts by this user
Quote this message in a reply
08-13-2018, 06:55 AM (This post was last modified: 08-13-2018 06:57 AM by Dieter.)
Post: #4
RE: Help for a student project on calculator algorithms
(08-13-2018 02:55 AM)Benoit Maag Wrote:  Does anyone have answers for Marty and can point at readings on the subject for him?

In the 1970s there was an HP Journal article series on calculator algorithms that discuss exactly this topic. Somewhere there must be a PDF which includes all these articles in one file, but of course you can also get the individual HP Journal issues.

Take a look at this thread, it includes links to the respective journals as well as some other info.
And finally you can do a search for the CORDIC algorithm that is used here.

Dieter
Find all posts by this user
Quote this message in a reply
08-13-2018, 12:04 PM
Post: #5
RE: Help for a student project on calculator algorithms
Suggest to attend the HHC 2018 and interview David S. Cochran.

Kind regards
Thomas
Find all posts by this user
Quote this message in a reply
08-13-2018, 08:07 PM
Post: #6
RE: Help for a student project on calculator algorithms
The book you need is "Algorithms for RPN calculators" by John A Ball.
Hard to track down either in print or PDF - I've been looking for a copy for a couple of years.
There's one on Amazon at the moment - £35 + postage - ridiculous.
The HPCC has one in its library - as a member I requested to borrow it from the librarian over a year ago but nothing ever materialised.
If you do find a PDF please send me a copy!

Denny Tuckerman
Visit this user's website Find all posts by this user
Quote this message in a reply
08-13-2018, 09:56 PM
Post: #7
RE: Help for a student project on calculator algorithms
(08-13-2018 08:07 PM)Leviset Wrote:  The book you need is "Algorithms for RPN calculators" by John A Ball.
Hard to track down either in print or PDF - I've been looking for a copy for a couple of years.
There's one on Amazon at the moment - £35 + postage - ridiculous.
The HPCC has one in its library - as a member I requested to borrow it from the librarian over a year ago but nothing ever materialised.
If you do find a PDF please send me a copy!

Someone is selling it on eBay for USE35.90.
Find all posts by this user
Quote this message in a reply
08-13-2018, 10:13 PM
Post: #8
RE: Help for a student project on calculator algorithms
I know that at least one Member has a copy Ball's book. Or at least did have one as of (as I recall) a San Diego HPCC meeting, at which he won a copy I had donated to the drawing.
Find all posts by this user
Quote this message in a reply
08-13-2018, 11:50 PM
Post: #9
RE: Help for a student project on calculator algorithms
(08-13-2018 03:35 AM)Albert Chan Wrote:  Hi, Benoit,

Try this book: Scientific Analysis on the Pocket Calculator, by Jon Smith

(08-13-2018 06:55 AM)Dieter Wrote:  
(08-13-2018 02:55 AM)Benoit Maag Wrote:  Does anyone have answers for Marty and can point at readings on the subject for him?

In the 1970s there was an HP Journal article series on calculator algorithms that discuss exactly this topic. Somewhere there must be a PDF which includes all these articles in one file, but of course you can also get the individual HP Journal issues.

Take a look at this thread, it includes links to the respective journals as well as some other info.
And finally you can do a search for the CORDIC algorithm that is used here.

Dieter


Agreed! I’ve got a well-read copy myself. One of the best!
Find all posts by this user
Quote this message in a reply
08-14-2018, 04:12 AM
Post: #10
RE: Help for a student project on calculator algorithms
(08-13-2018 08:07 PM)Leviset Wrote:  The book you need is "Algorithms for RPN calculators" by John A Ball.
Hard to track down either in print or PDF - I've been looking for a copy for a couple of years.
There's one on Amazon at the moment - £35 + postage - ridiculous.
The HPCC has one in its library - as a member I requested to borrow it from the librarian over a year ago but nothing ever materialised.
If you do find a PDF please send me a copy!
Please another electronic copy for me too. The Library of the Exact Sciences Faculty in Buenos Aires has a copy, but they do not lend it to you.
Pedro
Find all posts by this user
Quote this message in a reply
08-14-2018, 01:39 PM
Post: #11
RE: Help for a student project on calculator algorithms
(08-13-2018 06:55 AM)Dieter Wrote:  In the 1970s there was an HP Journal article series on calculator algorithms that discuss exactly this topic. Somewhere there must be a PDF which includes all these articles in one file, but of course you can also get the individual HP Journal issues.
Dieter

Indeed there is a pdf of the series:

Algorithms Series

Bill
Smithville, NJ
Find all posts by this user
Quote this message in a reply
08-14-2018, 03:06 PM (This post was last modified: 08-13-2019 10:17 PM by Albert Chan.)
Post: #12
RE: Help for a student project on calculator algorithms
(08-14-2018 01:39 PM)Bill (Smithville NJ) Wrote:  Indeed there is a pdf of the series:

Algorithms Series

Thanks for the link. I were peeking the first article on doing square root.
I thought Newton's method is great for doing square root.

Seems, the old calculator is too under-powered to do that.
Even squaring a number is too costly, replace by sum of odd numbers.

The algorithm turns out to be like doing it by hand, grade-school style.
Guess the hundreds, guess the tens, ..., like this:

SQRT(x = 1936) = 40 + b

b error = x - (40+b)^2 = (x - 1600) - 80b - b^2
0 1936 - 1600 = 336
1 336 - 80 - 1 = 255
2 255 - 80 - 3 = 172
3 172 - 80 - 5 = 87
4 87 - 80 - 7 = 0 --> SQRT(1936) = 44

Edit: HP engineer were amazing. Subtractions cut in half:

b 5*error = 5x - 5(40+b)^2 = (9680 - 8000) - (400b + 5b^2)
0 9680 - 8000 = 1680
1 1680 - 405 = 1275
2 1275 - 415 = 860
3 860 - 425 = 435
4 435 - 435 = 0 --> SQRT(1936) = 44
Find all posts by this user
Quote this message in a reply
08-14-2018, 04:19 PM
Post: #13
RE: Help for a student project on calculator algorithms
(08-14-2018 03:06 PM)Albert Chan Wrote:  HP engineer were amazing. Subtractions cut in half:

Cf. Patent US3576983A by David S. Cochran
Digital calculator system for computing square roots

It contains a flowchart of the algorithm.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
08-14-2018, 05:49 PM (This post was last modified: 08-15-2018 07:32 AM by ijabbott.)
Post: #14
RE: Help for a student project on calculator algorithms
My guess is that CORDIC isn't used by calculators that run on generic CPU architectures with fast multiplication and sufficient ROM for storing plenty of coefficients. Rather, sine and cosine of an angle within a certain domain of width pi/2 can be approximated by a polynomial of sufficiently high degree and particular coefficients.

Key phrases to look up are "Taylor series" and "Chebychev polynomials" (also transliterated as "Tchebycheff").

The polynomials can be calculated using Horner's method. That's another thing to look up. Charles Babbage's mechanical "Difference Engine" also used Horner's method to evaluate polynomials for calculating log tables etc., although a complete Difference Engine was not constructed until a century or so after Babbage's death.

EDIT: Ignore what I wrote about Babbages's Difference Engine above. It does use polynomials, but doesn't use Horner's method. It uses the finite difference method (hence the name) to evaluate successive elements of a sequence defined by a polynomial.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
08-14-2018, 08:35 PM
Post: #15
RE: Help for a student project on calculator algorithms
The HP-15C Advanced Functions Manual has a section on using Horner's method in user programs to speed up evaluation of polynomials.
Find all posts by this user
Quote this message in a reply
08-16-2018, 01:20 PM
Post: #16
RE: Help for a student project on calculator algorithms
In addition to Scientific Analysis on the Pocket Calculator, I also recommend Inside Your Calculator by Gerald R. Rising (Wiley). I ordered my copy from Abe Books.

the book has a supplement web page: https://www.acsu.buffalo.edu/~insrisg/In...ulator.htm
Visit this user's website Find all posts by this user
Quote this message in a reply
08-17-2018, 06:08 AM (This post was last modified: 08-17-2018 06:09 AM by Matt Agajanian.)
Post: #17
RE: Help for a student project on calculator algorithms
An added goldmine of Algorithms for RPN Calculators, found on pages 62-86, is a complete 25 page listing of all possible stack rearrangements given A, B, C, D, and 0 on the stack and how to use RPN to create any arrangement.
Find all posts by this user
Quote this message in a reply
08-17-2018, 01:25 PM
Post: #18
RE: Help for a student project on calculator algorithms
(08-17-2018 06:08 AM)Matt Agajanian Wrote:  An added goldmine of Algorithms for RPN Calculators, found on pages 62-86, is a complete 25 page listing of all possible stack rearrangements given A, B, C, D, and 0 on the stack and how to use RPN to create any arrangement.

Tony Hutchins made an excellent and really handy document based on this section in John's book. Here's a link for a copy.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
08-17-2018, 07:05 PM
Post: #19
RE: Help for a student project on calculator algorithms
(08-17-2018 01:25 PM)rprosperi Wrote:  
(08-17-2018 06:08 AM)Matt Agajanian Wrote:  An added goldmine of Algorithms for RPN Calculators, found on pages 62-86, is a complete 25 page listing of all possible stack rearrangements given A, B, C, D, and 0 on the stack and how to use RPN to create any arrangement.

Tony Hutchins made an excellent and really handy document based on this section in John's book. Here's a link for a copy.

Yes, excellent! Very nice. Thank you.
Find all posts by this user
Quote this message in a reply
08-24-2018, 07:13 PM
Post: #20
RE: Help for a student project on calculator algorithms
Benoit,
I've just bought the John A Ball Algorithms for RPN calculators from Amazon UK for just £6.25 including postage from US to UK. There are 2 more copies there at the same price.

Denny Tuckerman
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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