Looking for TVM contributions
|
06-22-2024, 11:58 PM
Post: #81
|
|||
|
|||
RE: Looking for TVM contributions
(06-22-2024 08:00 PM)robve Wrote: - The 3rd case FVerror=100 looks really bad, but it means that we computed FV=-900 instead of FV=-1000 which was discussed in this thread before why this happens. This example jogged my memory. I finally get what you mean by FVerr! I had thought FVerr = NFV(n,i2,pv,pmt,fv), calculated at higher precisions. Then, FVerr can be used tell if i2 is good, or bad. Because we have direct formula for FV, it can save a lot of time. But it is really testing BASIC FV code, run in 10 decimals, can round-trip back. Even if i2 was really bad, as long as FV can round-trip, it is considered good. Conversely, if solved i2 was dead on, npmt=0, huge FVerr can make it bad. Quote:It is very hard (impossible?) to improve this result with only 10 digits BCD precision as the least significant digit in i% causes FV to sway. Perhaps we can! On this thread, post#61, I mentioned with i*n>0, r=(1+i)^n-1 is better. Since i*n>0 is more common, this r should benefit every part of your code (*) S=(1+J)^-N and R=S-1 --> 1 = S-R Let r, s = R,S, but with N negated --> R/S = 1-1/S = 1-s = -r We just replace (R,S) with (r,s): F = (K*M*R/J-P)/S = K*M/J*(R/S) + P*(1-1/S) - P = -(K*M/J+P)*r - P P = K*M*R/J-F*S = S*(K*M/J*(R/S)-F) = -(K*M/J*r+F)/s M = (P+F*S)*J/K/R = ((P+F)*S-R*P)*(J/K)/R = -((P+F)/r+P)*(J/K) Edge case J=0: P+F+N*M*K = 0 --> M = -(P+F)/(N*K) npmt' = (P+F)/r*(1-N*s/(r+r/J)) + P npmt = ((P+F)/r + P)*J + M*K Newton: J = J - npmt/npmt' (*) there are other factors to consider besides r, so mileage may vary. Post #45 of this thread, HP71B reduce size of P, using time-symmetry. It also adjusted B to 0 --> K=1+B*J = 1, making code more accurate. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 24 Guest(s)