04-15-2018, 08:39 AM

Looking at the recent contributions to the General Software Library made me once again think about solving the classic TVM equation for the interest rate. Since there is no closed solution an iterative method is required, for instance the classic Newton method. This requires an initial guess for the interest rate, and I wonder if there is some kind of "best practice" to do so.

Some time ago this has been discussed in the old forum. Maybe you want to take a look at this thread. But maybe we don't have to reinvent the wheel: I wonder how the algorithms in existing financial calculators do it. So if anyone has some insights on this please let the world know.

Then I have been looking at various programs for programmable calculators:

- The TVM program in the HP41 Standard Pac starts with + or – 1E–9.

- The Advantage ROM seems to simply take 1/n as the initial guess (please correct me if I'm wrong here). This seems to work surprisingly well. The guess may be far from the final result, but it converges well from there. At least in the examples I tried and for i>0.

- The TI58/59 Master Library program (ML-19) takes a slightly different approach (it distinguishes between PV and FV problems) and starts with dedicated guesses, for instance with FV/PMT – PMT/(FV·n²) for PV=0.

- I remember I saw a flowchart of the HP80 algorithm somewhere in an old HP Journal. Maybe this has some information on how the HP80 did it.

- The 12C... no idea. I just tried this on the "official" HP 12C emulator:

CLEAR FIN

10 [n]

–1000 [PMT]

10000 [FV]

[i] returns exactly 0, as expected.

Change FV:

15000 [FV]

[i] yields 8,732%

Change FV back to the previous value:

10000 [FV]

[i] now returns 4,334 E–11%

OK, this is sufficiently close to zero, but why does this return a different result than before where it was exactly zero?

12000 [FV]

[i] => 3,989%

10000 [FV]

[i] => 2,146 E–11%

10000 [FV]

[i] => 0%

So the result seems to depend on previous input ?!

All in all:

- What formulas would you suggest to set an initial guess for calculating the interest rate?

- What is going on in the 12C (see above)?

Dieter

Some time ago this has been discussed in the old forum. Maybe you want to take a look at this thread. But maybe we don't have to reinvent the wheel: I wonder how the algorithms in existing financial calculators do it. So if anyone has some insights on this please let the world know.

Then I have been looking at various programs for programmable calculators:

- The TVM program in the HP41 Standard Pac starts with + or – 1E–9.

- The Advantage ROM seems to simply take 1/n as the initial guess (please correct me if I'm wrong here). This seems to work surprisingly well. The guess may be far from the final result, but it converges well from there. At least in the examples I tried and for i>0.

- The TI58/59 Master Library program (ML-19) takes a slightly different approach (it distinguishes between PV and FV problems) and starts with dedicated guesses, for instance with FV/PMT – PMT/(FV·n²) for PV=0.

- I remember I saw a flowchart of the HP80 algorithm somewhere in an old HP Journal. Maybe this has some information on how the HP80 did it.

- The 12C... no idea. I just tried this on the "official" HP 12C emulator:

CLEAR FIN

10 [n]

–1000 [PMT]

10000 [FV]

[i] returns exactly 0, as expected.

Change FV:

15000 [FV]

[i] yields 8,732%

Change FV back to the previous value:

10000 [FV]

[i] now returns 4,334 E–11%

OK, this is sufficiently close to zero, but why does this return a different result than before where it was exactly zero?

12000 [FV]

[i] => 3,989%

10000 [FV]

[i] => 2,146 E–11%

10000 [FV]

[i] => 0%

So the result seems to depend on previous input ?!

All in all:

- What formulas would you suggest to set an initial guess for calculating the interest rate?

- What is going on in the 12C (see above)?

Dieter