# HP Forums

Full Version: LOG function or ln
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

My last visit here, you guys came up with a perfect and simple solution for me. Thank you.

Question #2:

Finding the Term, n when the Amount is Known.

I am supposed to use the LOG function, which i do and have successfully answered my questions, with other calculators... however!

I am now needing to know how to preform this function on the HP12c.

Quick example:
\$200 is deposited at the END of each quarter, how many years will it take to amount to \$12,000 if the interest rate is 16%, compounded quarterly?

Answer: n=31.20227 quarters or 7.8 years

If anyone is interested in helping me, simply lay out the key commands as such or a similar manner: 12000 FV > 16 Enter 4 ÷ i > 200 PMT (etc...) this is where i am now unclear.

Warmly,

CaribbeanHP12c

I'm not a financial guy, but this sequence would seem logical to me:

```
CLR FIN
g END
200
CHS
PMT
12000
FV
4
i
n
n=32```

"Caribbean12C" --

It appears that you're asking how to get the exact mathematical answer using the HP-12C, rather than the answer rounded to the nearest integer that its standard TVM supplies.

I also got 31.20227 using an HP-10B.

You're on the right track with logarithms, but the correct function is the natural logarithm denoted "LN" on the HP-12C. ("LOG" denotes the base-10 common logarithm on HP calculators.)

Solve algebraically the Compound Interest equation in Appendix D (p. 207) of the Owner's Handbook, for a non-integer value of n. You'll need LN to obtain the answer.

-PV - PMT/i = -(PMT/i)*[1+i]-n + FV*[1+i]-n

-PV - PMT/i = [-(PMT/i) + FV]*[1+i]-n

0 - 200/0.04 = [-200/0.04 + (-12000)]*[1+0.04]-n

(-5000) / (-5000 - 12000) = 1.04-n

-5000 / -17000 = 1.04-n

n = -ln(5/17) / ln(1.04)

n = 31.20227

-- KS

Edited: 8 Apr 2008, 11:50 p.m. after one or more responses were posted

Thank you Don, (is that like El Patron?)

That is perfect and very logical, however, how do i set it up so i get the exact above answer rather than rounding it to 32 periods exactly, where the actual answer should be 31.20227 or when divided by quarters 7.8 years and not 8 Years from 32 periods?

I render the same result with entering the 16% Compounded Quarterly as well... see below.

CLR FIN g END 200 CHS PMT 12000 FV 16 ENTER 4 ÷ i n

n=32

Your help has been more valuable than you can imagine, thank you again.

CaribbeanHP12c

I'll read up on the manual, i have purchased the Mac HP12c Emulator for OSX, I am loving the features.

Also i used the HP-67 emulator to arrive at the same answer as you Karl.

I'll post the correct set of functions once i figure it out on the HP12c.

I have a number of PDF help docs, but nothing of the original manual, one goes up to page 210 but page 207 is only the index.

But you've put me on the correct path, so thank you for that.

Again, thank you for all the help on this forum.
Anything i can do in return for the forum?

CaribbeanHP12c

I don't have my 12C with me at work, but here is a webapp I made for my ipod touch to do those calculations. It's not what was asked for, but may help to check numbers. I also have it as a bookmarklet that can be used offline (good for the ipod touch)

It's a similar solver as in the TI-84 calculators, but formatted for the iphones:

Set it up as:

```
N=             Click Solve after the values below are entered.
I%=16
PV=0
PMT=-200
FV=12000
P/Y=4
C/Y=4
```

This only does ordinary annuities (end of month). I might annuities due later. I'll look into the HP12 commands when I get home.

CHUCK

Carribean, out of curiousity, are they wanting you to solve the annuity formula by hand, and then evaluate for n on the calculator. If so, it doesn't matter whether you use the ln(x) function or Log(x) function. Here's the ordinary annuity formula

```
N
(1+r/n)  - 1
FV = pmt -------------
r/n
Solving for N I get...
ln(FV r /(n pmt)+1)
N = --------------------
ln(1+r/n)
Substituting in FV=12000, n=4,  pmt=200  and r=0.16  gives
the desired result.
```

Still not sure if this is what you wanted.

CHUCK

Chuck:

First off... thanks for the knowledgeable reply. I love that app you built, do you distribute the same thing as in .app for the iTouch... that would be great to have!

So, yes i use the same formula:

```                ln{(12000/200).04 +1}
n=         ------------------------
ln (1+.04)
ln{3.4}
n=     --------
ln(1.04)
n=  31.20227
```
I can arrive at the correct answer, but chuck as you have already illustrated and proved with your great app, i would like to KEY in the same values (as i did in your app) and get the exact answer, not 32 which the HP12c is giving me, with my Entered values that i wrote above in this post. When it comes to the exams and such i don't really want to be messing about with 2 different calculators and and solving annuity formulas by hand.

Plus, i am stuck on the HP12c, as a good friend and CFO of a company i started several years back swears buy it and would brag about it while he was depreciating the value of servers and then on to projecting stock prices. I have no choice but to learn. :)

Thanks again... long post, opps.

Caribbean, or better (Blake, but i live there)

```REPLACE THIS TEXT WITH YOUR LISTING
```

Edited: 8 Apr 2008, 10:22 p.m.

So Blake, you know the formula that gives you what you want, you want to be able to key in the values for i, PV, PMT, and so on, and you want to do it on the 12c. No problem. Keystroke programming will give you exactly what you want. Have you tried it? If not, look at the section in the 12c manual on programming. You will be absolutely amazed with what that capability can do.

I haven't written it as an app, just a bookmarklet (code stored as a bookmark. Crazy) Here's a link to the bookmarklet. After it loads save it as a bookmark, then you can use it whenever. (I don' think this will load in "normal" browser. But I may be mistaken.

It'd be nice to make an RPN calculator (11C) as one of these. Maybe next month.

Cheers,
CHUCK

Edited: 9 Apr 2008, 2:17 a.m.

@CaribbeanHP12c

32 IS the correct answer, as you will have to pay 32 times. The answer 31.something is not a practical answer in real life. What you have to compute instead is how much you'll have to pay the 32nd time - which is described in the downloadable manual.

See on page 41 of

Edited: 9 Apr 2008, 6:03 a.m.

Hi Caribbean.

Don is right in that you cannot make 31.something payments. That is in fact the exact value for N that makes the formula work, but in reality you'll either make 30 of these payments and a larger 31st payment, or you'll make 31 of these payments and a slightly smaller 32nd payment.

Still, if you want the exact value for n on a 12c, you'll need to key in the program below. To use it, enter the values for i, PMT and FV as you would normally, but then instead of pressing n (which would give you 32 as the answer), press R/S.

```RCL FV
RCL i
1
0
0
divide
x
RCL PMT
CHS
divide
1
+
g LN
RCL i
1
0
0
divide
1
+
g LN
divide
R/S
GTO 01
```

This should work. And, yes, I know I could shorten it a bit. :-)
Gene

I think 31.something is a very practical answer in real life. In real life I would like to be the one to make the decision of an additional small payment (if T=31.1) or a slightly larger last payment (T=30.9). It's nice to have a calculator do some of the calculating and thinking for us, but I don't want it to make all the decisions, i.e., 32 payments, that's it, done, final.

Quote:
I think 31.something is a very practical answer in real life. In real life I would like to be the one to make the decision of an additional small payment (if T=31.1) or a slightly larger last payment (T=30.9). It's nice to have a calculator do some of the calculating and thinking for us, but I don't want it to make all the decisions, i.e., 32 payments, that's it, done, final.

Read page 41 of the manual (as I mentioned in my post above), it will tell you exactly how to calculate both ways. The 12c provides you with all necessary data.

Still, in reality n can only be an integer, no matter what you can calculate. You can only make an integer number of payments (31 or 32, not 31.7), as a real woman can only have an integer number of kids - even if a statistical woman bears 1.7 kids each. ;-)

Edited: 9 Apr 2008, 11:43 a.m.

Gene: Can you see my comment at the end of your Program, please.

```RCL FV
RCL i
1
0
0
divide
x
RCL PMT
CHS
divide
1
+
g LN
RCL i
1
0
0
divide
1
+
g LN
divide
R/S
GTO 01  (at this point everything seems to calculate and program but the "GTO 01"  i get nothing after that?
```

And just a quick question... i can't find the manual online... the only link is to buy it from someone's site... but i just paid for the Emulator and have found a plethora of similar manual builds but not the one HP original... Are you aware of a PDF version i can download?

And thank you all for the help, it has been extremely valuable for my advancement in this program. I am doing it all by correspondence and the tutors that are assigned are not quite as articulate as the real pros of the Calculators here.

Warmly,
Blake

Quote:
"...I don' think this will load in "normal" browser. But I may be mistaken."

Chuck, so you know that loads up perfectly, i am using OSX 10.4.11 and FF3 beta 5.

I'm also starting to build Cocoa and Carbon apps for Mac... this would be a fun thing to develop as a co-project if you have any interest in that or something else in the future. Feel free to contact me..

Thank you again for you help... i am looking into the final payment, i.e. the one that is the 32nd but less than the original 31 payments.

Who knew math could be so fun.

Best,

Blake

Blake, the link to the manual is in message #12 above.

Quote:
See on page 41 of

Missed this comment and pdf manual link...

Sorry disregard my latest comment on the manual.

Thank you.

best,
blake

Hi Don,

... i was too busy reading and inserting the methods on the HP12c emulator.

Thank you for the heads up.

The instructions that end the program: R/S and GTO 01 (well, it is actually g GTO 01), are designed to allow you to press R/S each time you wish to solve for a new value of n.

Just enter the values into i, PMT, and FV, then press R/S whenever you want to solve for n. Seems to work on my 12c. :-)

Conclusion:

With the above info:

I have concluded that i will make 30 regular payments and one larger 31st payment of a grand total of \$340.29.

Thank you for all the help.
Blake

Edited: 9 Apr 2008, 3:53 p.m.

Just to bring it to life...

:)