Post Reply 
TVM solve for interest rate, revisited
11-10-2024, 10:44 PM (This post was last modified: 11-11-2024 11:40 AM by Albert Chan.)
Post: #62
RE: TVM solve for interest rate, revisited
Previous post TVM with steps option, for HP71B (updated npmt_step())

Code:
10 DESTROY ALL @ INPUT "N,S,P,M,F= ";N,S,P,M,F
20 DEF FNM(N,I,P,M,F)=((P+F)/EXPM1(LOGP1(I)*N)+P)*I+M
30 DEF FNP(N,I)=(1+N)/2*(1-(1-N)*I*(2-I)/12)
40 DEF FNF(I) @ DISP I @ IF ABS(I)>.0001 THEN FNF=FNM(N,I,P,M+S/I,F-N*S/I) @ END
50 FNF=(P+F+N*M+P*I*FNP(N,I)+(F*I-N*S)*FNP(-N,I))/N @ END DEF
60 DEF FNI(A,B)=FNROOT(A,B,FNF(FVAR))
70 INPUT "GUESS I= ";I @ DISP FNI(I-.001,I+.001)

>run
N,S,P,M,F= 5,5,-25,10,0
GUESS I= 0.7
.699
.701
.567068171084
.633034085542
.567230379538
.567230334434
.567230334434

>run
N,S,P,M,F= 36,0,30000,-550,-15000
GUESS I= 0
-.001
.001
5.86958536385E-3
5.80447251183E-3
5.80507274543E-3
5.83732905464E-3
5.80507281939E-3
5.82120093702E-3
5.80507281943E-3
5.80507281943E-3
>res * 1200 ! APR %
6.96608738332
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: TVM solve for interest rate, revisited - Albert Chan - 11-10-2024 10:44 PM



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