PC-1211, PC-1250, etc. TVM
|
06-05-2024, 07:16 PM
(This post was last modified: 06-08-2024 09:05 PM by robve.)
Post: #22
|
|||
|
|||
RE: PC-1211, PC-1250, etc. TVM
(06-05-2024 12:34 PM)Albert Chan Wrote: Since Sharp does not have EXPM1, LOGP1, lets try without them. Thanks, this is more clear. EXPM1 LNP1 are easy to implement to compute TVM more accurately using a few terms of their series when applicable (up to 4th term of the series with 10 digits precision since 1+0.01^4/4 is close to 1 no need to use 5th term): ' compute L=LN(1+J) and S=(1+J)^-N and R=S-1 40 J=.01*I,K=1+J*B,C=0 : IF ABS J>=.01 LET L=LN(1+J) : GOTO 42 41 L=J*J,L=J-L/2+J*L/3-L*L/4 42 S=-N*L : IF ABS S>=.01 LET S=EXP S,R=S-1 : RETURN 43 R=S*S,R=S+R/2-S*R/6+R*R/24,S=R+1 : RETURN With this, the secant method works quite well and is quick, small and simple. We just need to replace LN(1+J) with L and use the improved S and R: Code: 10 "B" B=B=0 : PRINT "BGN=";MID$("NY",B+1,1) : END Line 32 is added to avoid the initial secant slope to be zero in extreme cases when the rate is very small, such as in examples 3,4,5 below. The program always terminates with a result or gives an error (not likely, but could be in extreme and unrealistic TVM cases). When G counts down to zero from 9, the result is likely not correct because a root wasn't reliably found (not likely, but can happen in extreme TVM problems). 1) B=1,N=40,PV=900,FV=-1000,PMT=-40 comp I% => 4.753367189% is exact 2) B=1,N=40,PV=900,FV=-1000,PMT=-400 comp I% => 80% is exact in 10 digits, but 80.0000000009845% comp FV => -1462.657745 (should be -1000, but TI BA gives -900(*) and Sharp EL-735 gives -975.11 and HP prime gives -1001.6 so it's tricky to compute FV accurately) 3) from http://www.voidware.com/tvm.htm B=0,N=365*24*60*60,PV=0,PMT=-0.01,I%=10/N, comp FV => 331667.0067 is exact comp I% => 3.170979194E-07 is almost exact 3.170979198E-07 except for the last digit is 4 instead of 8 4) same as 3 but take N=365*24*60 and I%=10/N: comp FV => 5527.782898 is exact comp I% => 1.902587519E-05 is exact 5) same as 3 but take N=365*24*60 and I%=10/60/N: comp FV => 5260.377543 is exact comp I% => 3.170979051E-07 is very close to exact 3.170979198E-07 6) from http://www.voidware.com/tvm.htm (the hard example 2) B=0,N=32,PV=-999999,FV=1000000,PMT=0 comp I% => 3.125027014E-06 is very close to exact 3.125E-06 7) B=0,N=360,PV=0,PMT=-1000,FV=1000000 comp I% => 4.980365842E-01 is exact (note that this is 5.976% APR) EDIT: as a sanity check, I verified this program with 27 TVM problems with solutions posted by a university finance department's lectures. To use this program on a Sharp pocket computer: - Switch begin mode on/off: DEF-B - Enter values: DEF-N or DEF-J (I%) or DEF-V (PV) or DEF-M (PMT) or DEF-F (FV) - Calculate: press DEF-C (beep) then DEF-N or DEF-J or DEF-V or DEF-M or DEF-F EDIT 2: once the N, PV, PMT, FV and I% are entered or computed and BGN is on/off, you can obtain amortization by adding five lines to the program: Code: 50 "A" AREAD A : J=.01*I,R=P-F,T=0,V=0 Enter a period value then press DEF-A. When the interest paid and principle paid values are shown, press ENTER again to show the next period and so on. The values T, V and R are the accumulated interest, accumulated principal and remaining balance. It should be easy to amend the program for direct P1/P2 and ACC computations if so desired. EDIT 3: updated line 30 with I=1 to improve interest rate computation accuracy - Rob "I count on old friends to remain rational" |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 18 Guest(s)