HELP WANTED ON ALGORITHMS  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: HELP WANTED ON ALGORITHMS (/thread242802.html) 
HELP WANTED ON ALGORITHMS  Joerg Woerner  04262013 Hello community, I received this email:
I am a maths teacher at a Collège (high school I believe) in Geneva, My student would have preferred to do her work on the calculator she uses (TI30XS MultiView already a little further on than the basic models), but we were not able to find specific information on this model on the internet and Texas Instruments wasn't willing to share either, maybe because the model is too recent ?
Would you have any idea where my student could find information ANY IDEAS?
Regards, Re: HELP WANTED ON ALGORITHMS  Gerson W. Barbosa  04262013 Here is an article on transcendental function algorithms from the TI graphic products team you might want to take a look at: ftp://ftp.ti.com/pub/graphti/calcapps/info/cordic.txt
P.S.: Yet another one, in French: Edited: 26 Apr 2013, 8:57 p.m.
Re: HELP WANTED ON ALGORITHMS  Thomas Klemm  04262013 Cochran's patent: DIGITAL CALCULATOR SYSTEM FOR COMPUTING SQUARE ROOTS
Re: HELP WANTED ON ALGORITHMS  Thomas Klemm  04262013 If she owns an iPhone I suggest to install rpn21 which provides a debugger:
This allows to track a calculation and thus gives an impression of its complexity.
Kind regards Re: HELP WANTED ON ALGORITHMS  Namir  04262013 The family of CORDIC algorithms are able to calculate square root, exponential, logarithm, trigonometric functions, and inverse trigonometric functions. The heart of the CORDIC algorithm resembles a hilow number guessing game.
Namir
Re: HELP WANTED ON ALGORITHMS  Thomas Klemm  04262013 Quote:
From the same source: Re: HELP WANTED ON ALGORITHMS  Thomas Klemm  04262013 Quote: Coconut VASM Listing by Jackie F. Woldering If she's not afraid of assembler it might be enlightening to compare the description of the algorithm in Cochran's patent with it's implementation in the HP41C. Here's the core of the routine:
279 336 SQR60 1042 C=C+1 PT Re: HELP WANTED ON ALGORITHMS  Thomas Klemm  04272013 From SQRT_CORDIC:
for i = 1 : n Probably not the most efficient way to do that.
Cheers Re: HELP WANTED ON ALGORITHMS  Namir  04272013 Very easy to read and understand, especially for a high school student. Edited: 27 Apr 2013, 12:46 a.m.
Re: HELP WANTED ON ALGORITHMS  Mic  04272013 TI30XS MultiView is nit programmable ! Here is a review of the calc :
http://www.calcbank.com/index.php?mod=archives&ac=voir&id=841
Re: HELP WANTED ON ALGORITHMS  Thomas Klemm  04272013 Given the task to produce a list of squares these are two ways to do it:
0 0 0 * 0 0 The left one uses multiplication and doesn't use the previous result. The right one reuses the previous result and thus needs only addition which is more efficient. I assume a high school student will understand both solutions. But when somebody wants to know how a calculator works I prefer to point to the real thing. Because it's not Matlab code running within a calculator. But I like this example because it shows that it's worth to ask yourself: what do I know and how can I use that to improve my next step?
Re: HELP WANTED ON ALGORITHMS  NateB  04272013 Inside Your Calculator: From Simple Programs to Significant Insights by Gerald R. Rising may be useful. Re: HELP WANTED ON ALGORITHMS  Eddie W. Shore  04272013 Quote:
Re: HELP WANTED ON ALGORITHMS  Eddie W. Shore  04272013 From my understanding CORDIC is used for transcendental functions. (sin, cos, ln, e^x, etc) As far as arithmetic is concerned (+, , x, ÷), I believe binary representations of numbers are used to carry out these operations. An example for addition in an eight bit system: 17 + 54
17 in binary is 000010001 The sum is 71, 71 in binary is 001000111 In a bit system, there is n1 bits that are dedicated to number representation, with the left most bit being the "sign bit". If the sign bit is 1, the number is negative.
I found this video Hope this helps,
Eddie
Re: HELP WANTED ON ALGORITHMS  Eric Smith  04272013 Usually CORDIC isn't used for logs and exponentials, although it is possible to do so by using hyperbolic CORDIC. CORDIC is in the general class of shiftandadd algorithms, and there is a simpler one for logs and exponential first published in 1624, only ten years after the invention of logarithms by Napier. I'm not sure whether the HP 9100A (1968) used Briggs' algorithm, but all of HP's handheld and handheldderived calculators from the HP35 (1972) through the Saturnbased and Saturnemulating calculators have used it. Recent HPdesigned calculators such as the HP 10bII+, 20b, 30b, and 49gII apparently use a math library based on that from Saturn calculators, so they presumably also use Briggs' algorithm. There is a good description of Briggs' algorithm on Jacques Laporte's "Briggs and the HP35" web page. Another excellent reference for algorithms for transcendental functions is Elementary Functions: Algorithms and Implementations by JeanMichel Muller, second edition, which covers many classes of algorithms including shiftandadd (Briggs', CORDIC, and others), and has especially good coverage of accurate argument range reduction algorithms. It should be noted that the HP algorithms for sine and cosine use CORDIC, but not in the most basic method normally described. Instead, they compute the tangent (or cotangent), and use an identity to compute the sine (or cosine) from it. This avoids an issue with each CORDIC iteration effectively multiplying the resulting sine and cosine by a scale factor; by using tangent (or cotangent), these scale factors cancel out. In binary CORDIC, the number of CORDIC iteration is fixed, so the result can be multiplied by the inverse of the product of the scale factors, which is constant. In decimal CORDIC as implemented by HP, the number of CORDIC iterations is variable, so it would take more work to compensate for the nonconstant product of the scale factors.
For specifics of the algorithms used by HP, see:
Edited: 27 Apr 2013, 1:04 p.m.
Re: HELP WANTED ON ALGORITHMS  Eric Smith  04272013 Note that in binary floatingpoint arithmetic, two's complement representation is almost never used. For the significand (also known as the coefficient, and often incorrectly referred to as the mantissa), signmagnitude representation is normally used, and for the exponent, a biased integer representation is normally used.
However, the BCD floating point used in most HP calculators uses ten's complement representation for the significand.
Re: HELP WANTED ON ALGORITHMS  Matt Agajanian  04272013 Y'know, as I have some of these RPNWoodstock and RPNSpice calcs on my iPhone, I've wondered what that code was. Now I know it's the debugger. Thanks for the explanation.
Re: HELP WANTED ON ALGORITHMS  Namir  04272013 Does a high school student want to know the machine code for ANY calculator????? Really??????? If he/she does, then he/she is truly exceptional and should contact Cyrille who conveniently (for the Geneva student) lives near Geneva. Cyrille may well put that student on HP's R&D payroll. I am not knowledgeable in machine code for any machine and I doubt the high school student in Geneva is either. However, I can understand the algorithm used. When that algorithm is expressed in high level languages like Matlab or Visual Basic, I can get a better grasp of it. Namir
Edited: 27 Apr 2013, 10:08 p.m.
Re: HELP WANTED ON ALGORITHMS  Thomas Klemm  04282013 Cyrille described the method to calculate the square root in HP Solve: Quote:cf. Computing Square Roots Donald Knuth uses assembly language, which runs on the hypothetical MIX computer, to describe the algorithms in The Art of Computer Programming. And he has some good reasons to do so. That's only one example where assembler is used as an educational programming language. I don't mind a high level description of an algorithm. There's a nice flowchart diagram in Cochran's patent which describes it best IMHO. There are different levels of understanding and some may be satisfied with that. But I think it's worth the effort to go one step deeper and then you might end up stepping through assembler code using a debugger. Hopefully this will give you a more profound understanding. As source code was requested I pointed to the VASM listing. We are lucky that we have the original with comments in a searchable format. What else could you want? Just hope you might take the occasion and start having a look at MCODE. After all it's not that difficult.
Kind regards Re: HELP WANTED ON ALGORITHMS  Joerg Woerner  04282013 She ;)
Joerg
