Post Reply 
Prime and Saturn calculators
07-07-2024, 01:37 PM
Post: #15
RE: Prime and Saturn calculators
(07-06-2024 10:44 PM)Albert Chan Wrote:  HP-12c internals is still a mystery ... Why would it overshoot to negative rate?

Here is plot of {NPV, NPMT, NFV}, rate = ± 10%
Curves practically overlap when rate are tiny.

plot {
  ((1e-10-10/x)*((1+x)^-10-1)+(-100+1e-10)),
  (((-100+1e-10)/((1+x)^10-1)-100)*x+10)*10,
  ((-100+10/x)*((1+x)^10-1) + (-100+1e-10))
}, x = -0.1 .. 0.1


Unlike NPMT or NFV, NPV is concaved up.
Rate guess from the right, NPV=0 with Newton's method may overshoot, even to negative rate.
But, overshoot should occur only once, which means we won't notice.

We see the issue with NPV zoom-in (±1e-6%). Line look like a smudge.
This explained why we observed multiple overshoots, even to final iteration.

plot {((1e-10-10/x)*((1+x)^-10-1)+(-100+1e-10))}, x = -1e-8 .. 1e-8

With good expm1/log1p, fuzziness will be lessened, but still a smudge.
If rate=0, formula resulted in nan. This is why small rate branch is needed.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Prime and Saturn calculators - dm319 - 07-05-2024, 06:37 PM
RE: Prime and Saturn calculators - dm319 - 07-05-2024, 07:57 PM
RE: Prime and Saturn calculators - dm319 - 07-06-2024, 12:03 AM
RE: Prime and Saturn calculators - dm319 - 07-06-2024, 08:27 AM
RE: Prime and Saturn calculators - dm319 - 07-06-2024, 02:29 PM
RE: Prime and Saturn calculators - dm319 - 07-06-2024, 05:31 PM
RE: Prime and Saturn calculators - Albert Chan - 07-07-2024 01:37 PM
RE: Prime and Saturn calculators - dm319 - 07-06-2024, 06:22 PM
RE: Prime and Saturn calculators - dm319 - 07-07-2024, 10:11 AM
RE: Prime and Saturn calculators - dm319 - 07-07-2024, 08:24 PM



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