Re: 12C and its financial algorithms Message #8 Posted by hugh on 19 June 2003, 4:48 p.m., in response to message #6 by Tony
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.
|