12C and its financial algorithms



#2

I found a very interesting article by a UC Berkeley math & engineering professor (W. Kahan) about calculation roundoff errors and poor processor architectures. What's interesting is that he compares HP with TI financial calcs, and he was actually involved in the coding of the *original* 12C's algorithms. I'm posting this as a follow-up on the controversy about the 12C Platinum's "solving for i". Dr. Kahan's article (pp. 14-19) discusses this issue quite in depth (for the original 12C). You can be quite sure the 12C Platinum does not use his beautiful ideas or it would be *at least* as fast as the 12C. I wouldn't be surprised if HP simply "lost" the original coding ideas used for the 12C and tried to reinvent the wheel (and if you read the article, you'll see reinventing *this* wheel isn't quite as simple as it initially appears). The article, called "Mathematics Written in Sand", is linked to from Dr. Kahan's web page at:

http://www.cs.berkeley.edu/~wkahan/

The direct URL is:

http://www.cs.berkeley.edu/~wkahan/MathSand.pdf

Eduardo


#3

Thank you alot, Eduardo, for your information. It's very interesting.

#4

Yep, that's a great article. The 12CP is really a very interesting machine. Every day I see a new bug!<G>. Today I tried n=1 i=-.001 PV=100 PMT=0 and solved for FV=-99.999 which is correct. But i=-.0009 gives FV=100.0009. Yes, plus 100.0009! The answer should be -99.9991. I cannot imagine the coding that would do this magic. The old 12C does this correctly, so it is not something copied over. yesterday I noticed the 12CP does try and cheat when solving for i - but it only goes ahead and does it if the solution is exact.
Today's one only happens if i is between -.001 and 0.


#5

>FV=-99.999 which is correct. But i=-.0009 gives FV=100.0009

I tried this on my 17BII, and the answer I got is FV=100.009!


#6

here the 17bii is fine, n=1,i=-.0009,pv=100,pmt=0 gives fv=-99.9991.

#7

On page 15 of Prof kaplan's "Maths in the Sand" is a "Penny for your Thoughts" example with n=31,516,000 i=3.170979198 E-7 PV=0 PMT=-.01 END: solve for FV=331,667.0067. The 12CP resolves for i in 280 seconds giving i=3.107401823 E-7. That's within about E-4%. The 12C gives 3.197401823 -7 which is 1% out, but it only takes a few seconds. All is not lost on the 12CP though - i did a 250 (the limit, due to a bug) line i-solve program that never seems to take longer than 40 seconds - so the 12CP runs the prog well - and for the above case it resolves the i exactly!! Probably a fluke, but shows what the 12CP can do.


#8

whoops the 12CP gives 3.170982000 E-7 in 280 seconds - a pretty good answer in the end. Only 2.8E-13 too high or about E-4 %

Edited: 19 June 2003, 4:00 a.m.

#9

280 seconds! wait! whats's this. here comes the hp9g, cover flapping in the wind...

"I'll save you rpn mortals from evil tvm errors..."

"finding FV is easy with my 24 digit precision. don't panic kids, i'll just use the textbook formula fv=-amt*((1+i)^n-1)/i"
60*60*24*365->N
.1/N->I
.01*((1+I)^N-1)/I = 31,667.0067

"ah! that was easy, now to solve for I in only 5 seconds.. just whisk together a quick solver..."

INPUT L,H,E;
E=10^(-E)
X=L
GOSUB PROG 9;
A=Y
Lbl 1:
IF (ABS(H-L) < E*ABS(H)) THEN { GOTO 2; }
X=H
GOSUB PROG 9;
B=Y
C=H-B*(H-L)/(B-A)
L=H
A=B
H=C
GOTO 1;
Lbl 2:
X=C
END

"and the solve-for subroutine..."

Y=((1+X)^31536000-1)*.01/X
Y=Y-331667.0067
END

"put in L=1e-30, H=1e-7, E=8 and presto!"

x=3.1709792e-9 which is correct.


Gee, thanks 9g, i'll never doubt you again.


Possibly Related Threads…
Thread Author Replies Views Last Post
  10bii Financial Calculator is on launch sale - 0.99$ only John 4 2,053 11-10-2013, 08:02 PM
Last Post: BShoring
  OT--TI-36X Algorithms Matt Agajanian 48 11,729 09-01-2013, 08:13 PM
Last Post: robert rozee
  HELP WANTED ON ALGORITHMS Joerg Woerner 19 5,241 04-27-2013, 12:56 PM
Last Post: Eric Smith
  HP-80 Financial Calculator (1973) BShoring 3 1,727 03-25-2013, 11:39 PM
Last Post: BShoring
  Simple financial problem with a HP-12c Platinum Lapin 3 1,648 11-11-2012, 09:33 AM
Last Post: Lapin
  HP financial calculator prototypes Keith Midson 4 1,755 10-06-2012, 03:13 PM
Last Post: Harald
  OT: primitive mult/div algorithms Egan Ford 9 2,806 05-27-2012, 09:27 PM
Last Post: Egan Ford
  Financial Calculations for the HP41: another enhanced version Luiz C. Vieira (Brazil) 0 852 04-16-2012, 09:16 AM
Last Post: Luiz C. Vieira (Brazil)
  HP-41CX and Financial Decisions Module Cheyenne Whitley 22 5,465 04-07-2012, 07:51 PM
Last Post: Garth Wilson
  HP 34s: Three financial routines Miguel Toro 3 1,492 11-13-2011, 03:56 PM
Last Post: Miguel Toro

Forum Jump: