# HP Forums

Full Version: 12c Solving for n
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I'm hoping someone can lend their wisdom here. As most of you will well know, when using the 12c to solve for n, it will only solve as an integer, always rounding up. I tried to search but did not come across a solution.

The user manual offers the following solution for when a PMT amount is involved;
10.5 g i
35000 PV
325 CHS PMT
n (=328)

To find the partial last payment;
FV (181.89)
RCL PMT (-325)
+ (-143.11) which is the final fractional payment

To then make the answer correlate with other financial calculators I came up with the following;
(with the -143.11 still on screen)
RCL PMT X><Y %T (44.03) e.g. .4403 of a total payment.
So the answer is 327.44, which is what other calculators report.
This would be really simple to program, however it's simple enough to just remember or re-logic my way through

However, when a PMT value is not involved, I can't find a simple way of performing the same calculation. My math just isn't strong enough.
e.g. PV 1250, FV 2500, i=9% compounded annually, solve for n?
12c gives 9, and when you re-solve for FV it gives 2714.87
Other calculators will give n=8.04

Is there a simple way to calculate what the extra 214.87 represents in terms of time?
I have read that there was a program solution for this, but could not find it in part 3 of the manual or in the solutions handbook. If someone could point it out for me that would be greatly appreciated.

Many thanks,

Zac

EDIT to fix values.
Note: edited to address some more questions.

(07-24-2017 11:27 AM)Zac Bruce Wrote: [ -> ]To then make the answer correlate with other financial calculators I came up with the following;
(with the -143.11 still on screen)
RCL PMT X><Y %T (44.03) e.g. .4403 of a total payment.
So the answer is 33.44, which is what other calculators report.

?!? Where do you get this 33,44 from? I'd say this is 327 full periods plus 0,4403 = 327,44 periods.

But this is only an approximate answer, it is a linear interpolation of a nonlinear function. The true result here is not 327,4403 but 327,4393. Rounded to two decimals the difference in this particular case does not show up. But don't try this with smaller n. Anyway, at least you get an approximate result.

(07-24-2017 11:27 AM)Zac Bruce Wrote: [ -> ]However, when a PMT value is not involved, I can't find a simple way of performing the same calculation. My maths just isn't strong enough.
e.g. PV 1250, FV 2500, i=9% compounded annually, solve for n?
12c gives 9, and when you re-solve for FV it gives 2714.87
Other calculators will give n=8.04

Without PMT the solution is trivial. If you really need the fractional answer for n this can be calculated directly, either manually or with a small program:

RCL FV
RCL PV
/
CHS
g LN
1
RCL i
%
+
g LN
/

For the example this yields n = 8,0432.

Of course you can always use your own little program for calculating n without rounding up to the next higher integer. The formulas are known, so just "code your own". ;-) As shown, the PMT=0 case is trivial, but even with PMT the formula is quite simple. For your example (no FV, "end" mode assumed) and i decimal (i.e. 0,00875 here) n = – ln(1 + i·PV/PMT) / ln(1+i).

(07-24-2017 11:27 AM)Zac Bruce Wrote: [ -> ]Is there a simple way to calculate what the 714.87 represents in terms of time?

What 714,87? I just see 2714,87 which is the FV after 9 periods.

Dieter
It was late last night when I posted, so yes the figure you gave for the first question is correct and I have edited the post. The second figure I meant 214.87 I.e the amount over what we expected or wanted.

I'm guessing that there is not a simple solution similar to the first problem.

Can you explain a little more about it being only an approximate answer? Is this the case will other financial calculators? And what causes it to be so?

I notice using your program method it give the same answer as my HP Prime,(edit) and using the program solving for n that Paul suggested below (which is just a more complex version of yours to allow for PMT values) it gives the same values as my Prime. These answers also correspond with the correct value you suggested in the first example.

Zac
Hi Zac,
Please check "HP 12c Calculator - Actuarial Calculations"
at https://support.hp.com/us-en/document/bpia5043 for a program to calculate n as a real number.

Regards,

Paul
(07-25-2017 04:52 AM)paul0207 Wrote: [ -> ]Hi Zac,
Please check "HP 12c Calculator - Actuarial Calculations"
at https://support.hp.com/us-en/document/bpia5043 for a program to calculate n as a real number.

Regards,

Paul

Thank-you for this Paul,
Somehow I had not come across those articles before in my searches, I have a dozen of them that were presented as training modules that I believe I downloaded from some HP fan site, but there is a great deal more contained there.

Regards,
Zac
(07-25-2017 02:38 AM)Zac Bruce Wrote: [ -> ]It was late last night when I posted, so yes the figure you gave for the first question is correct and I have edited the post. The second figure I meant 214.87 I.e the amount over what we expected or wanted.

OK, then this is the additional amount you get after full 9 periods. You can also enter n=8 and get the (lower) amount after 8 periods.

(07-25-2017 02:38 AM)Zac Bruce Wrote: [ -> ]I'm guessing that there is not a simple solution similar to the first problem.

You mean a solution for the PV=1250 and FV=2500 problem? There is a very simple solution. I even posted the steps to calculate n as a fractional result. ;-)

(07-25-2017 02:38 AM)Zac Bruce Wrote: [ -> ]Can you explain a little more about it being only an approximate answer?

Note: in the following formulas all values are unsigned, e.g. PMT=325 and not –325 due to the HP sign convention.

I assume you mean the first problem here, the one with a given PMT.
The basic annuity formula for this case is
$PV=PMT \cdot \frac{1-(1+i)^{-n}}{i}$
Your approximate approach in effect calculates PV for n=327 (=34991,78) and n=328 (=35010,44) and then interpolates the "correct" n for PV=35000 between these two (your %T method is mathematically equivalent). But PV is not a linear function of n. For instance, the PV for n=11 is not the mean of the PVs for 10 resp. 12 periods. The exact value can be calculated with the given formula:
$n=- \frac{\ln(1 - \frac{i \cdot PV}{PMT}} {\ln(1+i)}$
(07-25-2017 02:38 AM)Zac Bruce Wrote: [ -> ]Is this still the case using the formula you presented as a program as a solution to the second problem?

No, this calculation is exact.
The basic formula is  $FV=PV \cdot (1+i)^{n}$
Solve for n and get  $n=\frac{\ln \frac{FV}{PV}}{\ln(1+i)}$
That's what these steps calculate.
Here is a short program that does these two calculations, depending on whether PMT=0 or not.

Code:
01 RCL PMT 02 x=0? 03 GTO 15 04 1 05 RCL i 06 RCL PV 07 x 08 RCL PMT 09 / 10 % 11 + 12 LN 13 CHS 14 GTO 20 15 RCL FV 16 RCL PV 17 / 18 CHS 19 LN 20 1 21 RCL i 22 % 23 + 24 LN 25 / 26 GTO 00

(07-25-2017 02:38 AM)Zac Bruce Wrote: [ -> ]Is it just beyond the capabilities of the calculator to give an exact answer? Or is further information needed? I know it works with certain assumptions e.g. periods of equal length, payments always made on either exactly the end or start of a period, all of which would effect real world accuracy.

The point is: there are two "exact" answers. One of them is mathematically exact. That's the n that solves the TVM equation, resp. the FV resp. PV equations given above. Here the answers are n=8,0432 and n=327,4393.

But these answers are not valid in the real world. They assume than n is a continuous variable, which is not true. There are no 0,0432 or 0,4393 periods. You can have either 8 or 9 periods at the end of which interest is accumulated. You can make either 327 or 328 payments to get a little less or a little more than $35000. And this is the approach of the 12C. It's a tool for real world applications, and less so for students that want a textbook answer for a mathematical formula. The 12C tells you that, if you deposit$1250 at 9% it will take 9 years until you have $2500. After 8 years it's only 2490,70 and after 9 years it's 2714,87. After 8 years your bank will not pay the missing$9,30 for another 0,0432 years, so you have to wait one more year before the next interest payment gets you beyond $2500. So the 12C handles fractional periods different from the theoretical textbook solution. That's not less exact, it's simply a real-life approach for real-life problems. Dieter Deiter, Thankyou very much for that very thorough and detailed reply. I feel I have a much better understanding of the topic now. I can see my flaw in logic with regards to the problem of e.g. n=8 or n=9, thinking that there would indeed be some period in between where the e.g. bank/investment would pay an amount of interest closer to the desired value, but of course this is not the case. So I can now see that in my original calculation it is more applicable to the real world to then recalculate FV for n=9, and see what the amount will be, or recalculate for n=8 and make an informed decision whether you are happy to be$9.30 short of your goal of $2500, or wait the extra period and have an extra$214.87

With the first question, where PMT is involved, it is still important to be able to calculate the final fractional payment. As in when you have loaned an amount of money, it may take 328 payments (n) to fully pay the loan, but it is important to know that the final payment will indeed be a fractional payment (not a fraction of time). Is there anything wrong with the solution given by HP for calculating that final, fractional payment? (i.e. recalculate FV, RCL PMT +) I now understand that taking that final fractional payment and trying to relate it to a fractional period of time is the wrong (or not practical) way to be thinking about it, but I want to be sure that the calculation of the fractional payment is correct. In place of my original approximate solution (n=327.44), it would instead be interpreted as "327 full payments of $325, plus a final payment of$143.11" and not in terms of time.

The site that Paul suggested included a program to solve for a mathematically correct value of n, which is slightly different to your suggestion (allows for END or BEGIN by storing 1 in either STO 1 or STO 2) but comes up with the same results.

Quote: ...There is a simple solution
I guess if I do the work to internalize and memorize the equation, then yes, very simple! I'm perhaps too blessed to have constant access to electronics and the internet to do the "hard" work for me!

I bought a copy of Gene Wright's book, I think I might go and get it printed and bound tomorrow, start reading and try actually understand the maths, rather than just understanding which buttons to press!

Regards,

Zac
(07-25-2017 10:52 AM)Zac Bruce Wrote: [ -> ]So I can now see that in my original calculation it is more applicable to the real world to then recalculate FV for n=9, and see what the amount will be, or recalculate for n=8 and make an informed decision whether you are happy to be $9.30 short of your goal of$2500, or wait the extra period and have an extra $214.87 Exactly. (07-25-2017 10:52 AM)Zac Bruce Wrote: [ -> ]With the first question, where PMT is involved, it is still important to be able to calculate the final fractional payment. As in when you have loaned an amount of money, it may take 328 payments (n) to fully pay the loan, but it is important to know that the final payment will indeed be a fractional payment (not a fraction of time). Is there anything wrong with the solution given by HP for calculating that final, fractional payment? (i.e. recalculate FV, RCL PMT +) I'd say this is fine. Especially if this is the way suggested by HP. ;-) You essentially calculate FV as the amount you have overpaid the loan with full 328 payments of$325. So the final payment can be lowered by this.

Here is another approach: Enter n=327 and get PV=$34991,7839. This is the amount you have paid off after 327 periods. So$8,2161 are still missing. For the 328th payment this means you have to pay (1+i)328 times this, which again is $143,11. Clear Fin 35000 PV –325 PMT 10,5 g i n => 328 327 n PV => 34991,78 35000 – PV 0 PMT 328 n FV => 143,11 OK, that's a lot more complicated. #-) (07-25-2017 10:52 AM)Zac Bruce Wrote: [ -> ]In place of my original approximate solution (n=327.44), it would instead be interpreted as "327 full payments of$325, plus a final payment of $143.11" and not in terms of time. I'd say that your approximate result of n=327,4403 may be interpreted as 327,4403 payments, i.e. 327 full and one final payment of 0,4403... times$325 = \$143,11.

(07-25-2017 10:52 AM)Zac Bruce Wrote: [ -> ]The site that Paul suggested included a program to solve for a mathematically correct value of n, which is slightly different to your suggestion (allows for END or BEGIN by storing 1 in either STO 1 or STO 2) but comes up with the same results.

Yes, my little program does only a very basic calculation for this particular case. Real TVM programs do a lot more stuff. ;-)
On the other hand the HP-41 standard pac's TVM program (cf. line 06...20) shows how various scenarios (OK, END mode only) can be handled with one simple formula for n. Here is a translation for the 12C:

Code:
01 RCL FV 02 CHS 03 RCL PMT 04 RCL i 05 / 06 EEX 07 2 08 x 09 + 10 RCL PV 11 LstX 12 + 13 / 14 LN 15 1 16 RCL i 17 % 18 + 19 LN 20 / 21 GTO 00

(07-25-2017 10:52 AM)Zac Bruce Wrote: [ -> ]I guess if I do the work to internalize and memorize the equation, then yes, very simple! I'm perhaps too blessed to have constant access to electronics and the internet to do the "hard" work for me!

C'mon, this compound interest formula is as basic at it gets. ;-)

(07-25-2017 10:52 AM)Zac Bruce Wrote: [ -> ]I bought a copy of Gene Wright's book, I think I might go and get it printed and bound tomorrow, start reading and try actually understand the maths, rather than just understanding which buttons to press!

I think there are three levels involved here:
(0) Knowing which buttons to press
(1) Knowing the math behind this
(2) Knowing the meaning of the math. ;-)

Regarding the latter I'm sometimes a bit lost myself.

Dieter
Dieter,

I've made some progress through Gene's book now, and you're right about it being pretty simple. My math is not strong so I didn't know that the log of a number to a power is equal to the power multiplied by the log of that number. What a mouthful.

Gene does offer a quick and dirty way to approximate, but it's really no simpler than just working through the formula.

I still don't understand was a logarithm really is, but at least compound interest is starting to make sense. So I guess I'm at stage two, at least!

Regards,

Zac
(07-27-2017 12:19 PM)Zac Bruce Wrote: [ -> ]My math is not strong so I didn't know that the log of a number to a power is equal to the power multiplied by the log of that number. What a mouthful.
(...)
I still don't understand was a logarithm really is, but at least compound interest is starting to make sense.

Power and exponential functions as well as their inverses (roots and logs) are basic math that is not too hard to understand. If it can be done at school in grade 8 or 9 you will be able to get it as well. All this stuff is required to understand the concept of the time value of money, both in simple compoud interest problems, in annuities and in other basic concepts like NPV or IRR. So every minute you spend on this for a better understanding of these basics will pay off later. Financial math simply is not possible without this. There is a reason why the 12C has only a few scientific functions while it does have y^x, e^x and ln x. ;-)

Dieter
Dieter,

When I tell people that I'm studying accounting/finance, usually the first question I get asked is, "Are you good at maths? (sic)". Usually I just laugh and say, "Yeah."

The truth being that I'm very systematic and I enjoy processes and logic. So, I would have been good at math if only I'd been paying more attention! I took advanced math in year 10, but I don't remember ever bringing my notebook or doing exercises. I did pass, but I remember very little.

Last trimester I did my first statistics for business course and really enjoyed it, and topped my class. The math involved in (basic) probabilities and statistics is not so difficult to understand.

But I realize that I lack any strong foundation, so I'm currently doing a self-paced bridging course offered by my university. Then it's on to quantitative skills with applications, which covers logarithmic, exponential and inverse functions in greater detail, among other things.

Regards,

Zac
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :