Finance in Prime: odd period...
|
05-21-2015, 10:40 AM
Post: #1
|
|||
|
|||
Finance in Prime: odd period...
hi all,
I need a hint to calc "odd period" for TVM in the Prime. (Odd period: period between the date interest begins accruing and the beginning of the first payment period, calculated generally with simple interest, but also sometime with compound...) An example (from the HP 12C Guide): *** «A 36-month loan for $4,500 accrues interest at a 5% annual percentage rate (APR), with the payments made at the end of each month. If interest begins accruing on this loan on February 15, 2004 (so that the first period begins on March 1, 2004), calculate the monthly payment, with the odd days counted on the basis of a 30-day month and compound interest used for the odd period.» *** DDAYS(2004.0215, 2004.0301) = 15 (16 in a base of 30 days, "financial year"), so 36 months + 16 days to add (at beginning of the first payment) is 36.53 If I put simply 36.53 as n, I%=5, PV=-4500, FV=0, I get PMT = -133.06 (end) The result in the 12C is pmt = -135.17... So, TVM as is, is not the solution... Thank you Salvo ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
05-21-2015, 08:39 PM
Post: #2
|
|||
|
|||
RE: Finance in Prime: odd period...
(05-21-2015 10:40 AM)salvomic Wrote: hi all, Salvo, I do not think you are making 36.53 month's payments, but are borrowing the monies for that duration. So at the start of the 36 month period you need to add the accrued interest for 16 days which is 4500x0.05/12*16/30 -> 10 So using N=36, PV=-4510 and I=5% you arrive at PMT= 135.17 Cheers, Terje |
|||
05-21-2015, 08:47 PM
Post: #3
|
|||
|
|||
RE: Finance in Prime: odd period...
(05-21-2015 08:39 PM)Terje Vallestad Wrote: Salvo, hi Terje, ok, but see the example above (and here, page 64). 36.53 is a mode typic of HP 12C to tell the calc that there are odd periods, not a real period... You're right about the calc, and in fact I would like to have the calculation made ...by the Prime ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
05-22-2015, 01:48 PM
(This post was last modified: 05-22-2015 05:36 PM by salvomic.)
Post: #4
|
|||
|
|||
RE: Finance in Prime: odd period...
(05-21-2015 08:39 PM)Terje Vallestad Wrote: ... at the start of the 36 month period you need to add the accrued interest for 16 days which is 4500x0.05/12*16/30 -> 10 hi Terje, a first version of a program to calculate odd period with the Prime, giving that period and all parameters to call Finance.CalcPMT() to get TVM *with* "odd period" added, like you say... For now the program check for Financial/Actual (360/365) year, BEGIN/END, it calculates date with DDAYS (for actual year) or my formula (financial year: 30*(mm2-mm1)+dd2-dd1; it works well in my Simple Interest program, on HP Software Library of the Forum), "odd period" only with simple interest, not still with compound option... In the evening I hope to add this option or more. If you want, please, check it. Any advice is welcome Salvo Code:
∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
05-22-2015, 10:06 PM
(This post was last modified: 05-22-2015 10:44 PM by salvomic.)
Post: #5
|
|||
|
|||
RE: Finance in Prime: odd period...
This version calculates also payment for compound interest of "odd period", but I've some doubt about the results (Terje, fhub (Franz), others, please help):
the result are *about* those of 12C, but with some rounding (±0.007 or more). odd with year=360, simple interest is the same in both calc: es. 135.1687459 (about 135.17, as first, using the above example) odd with year=365, simple int. 12C->135.1500141, Prime->135.14616 odd with year 360, compound interest 12C->135.1684, Prime->135.16181 odd with year=365, compound int. 12C->135.1497, Prime->135.13973 Particularly, I use this formula for compound interest to add to PV to calc PMT: inte:= pv*((r/100+1)^(gg/anno)-1) where gg are the odd days, anno is 360 or 365, r=5 (i.e.), gg in the example is 15 (actual year) or 16 (financial year)... then pmt:=Finance.CalcPMT(n, r, (-(pv+inte)),0,12,12,beg) to calc PMT. (beg is 1 for "end period", 0 for "beginning period") HP 12C use an internal routing in this case. It's activated when the period is non integer (es. 36.5333 or 36.5, in our cases), pressing STO+EEX (to give "C" symbol)... I would like to understand the difference and if the results in Prime are exacts or where I'm wrong... After that, I'll complete with the calculation for rate or other things... Thank you, Salvo Code:
∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
05-23-2015, 08:39 AM
(This post was last modified: 05-23-2015 09:01 AM by salvomic.)
Post: #6
|
|||
|
|||
RE: Finance in Prime: odd period...
a better, neat and reordered code, with Choose menu.
It calculates payment for difference of dates or giving number of days... More modular. I'm going to add solving for rate of interest (APR %). It would be better, however, to have (in a Drawmenu, maybe) a softkey "Solve", like that in the Finance App: I need help, please Code:
∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
05-23-2015, 10:21 AM
Post: #7
|
|||
|
|||
RE: Finance in Prime: odd period...
Hi Salvo,
You sure have been burning the midnight candles on the finance programs! Your latest work has compiled without error and seems to run ok. I wanted to look through your coding to try to understand your approaches, so I took the liberty of adjusting the layout, in order for me to read through it better. I was wondering if you would find it useful to control the number of digits in the user interface, (HDigits variable)? When the result screens have been presented to the user, a helpful hint to let users know what to do next, might be useful. For example, "Press the Esc Key to continue..." or something. It looks like you've figured out how to use INPUT() to your advantage. That function is not very well described in the help texts, as you might agree. It takes a little trial and error to get it working just the way a person might like! Once a program accomplishes the basic goals, one can always tweak it for an enhanced user presentation / interface. Minimally, you've included textout_p() coding, which could also include color, and text size to help focus the user experience, for visual enhancement. The use of rectangular colored boxes for titles, and other interactions can aid visual interest. You might enjoy a little time off from the grind of getting the basic functions working, and have fun with the graphical user interface! I hope these suggestions are useful. -Dale- Here's your program with formatting that makes it a bit easier for my eyes: Code:
|
|||
05-23-2015, 11:33 AM
Post: #8
|
|||
|
|||
RE: Finance in Prime: odd period...
(05-23-2015 10:21 AM)DrD Wrote: Hi Salvo, I Dale, thank you. You are right about the imperfect formatting and ...about midnight candles :-) The principal reason of ugly formatting is because yesterday I worked mostly directly in the Prime, so the aim was to go new line (this is better in the calc)... Now I'm inserting your better formatting and including it also in the new two functions I'm developing (to calc APR). I'm going to improve TEXTOUT_P and helping, sure! I've a question, however: what's the difference between TEXTOUT_P and TEXTOUT? the help seems to be ...the same Then I'll look at also for more graphic. Salvo ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
05-23-2015, 01:00 PM
Post: #9
|
|||
|
|||
RE: Finance in Prime: odd period...
(05-23-2015 11:33 AM)salvomic Wrote: I've a question, however: what's the difference between TEXTOUT_P and TEXTOUT? the help seems to be ...the same According to the USER GUIDE: "Twenty-six functions can be used to modify graphics variables. Thirteen of them work with Cartesian coordinates using the Cartesian plane defined in the current app by the variables Xmin, Xmax, Ymin, and Ymax. The remaining thirteen work with pixel coordinates where the pixel 0,0 is the top left pixel of the GROB, and 320, 240 is the bottom right. Functions in this second set have a _P suffix to the function name." Since most of my graphics work uses direct pixel values, not graphics variables, I mostly use functions with the _P suffix. -Dale- |
|||
05-23-2015, 01:11 PM
Post: #10
|
|||
|
|||
RE: Finance in Prime: odd period...
(05-23-2015 01:00 PM)DrD Wrote: According to the USER GUIDE: thank you, the Help in the Prime is not so clear. For now I'm using mostly the "_P" set also. Salvo ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
05-23-2015, 02:41 PM
(This post was last modified: 05-23-2015 03:47 PM by salvomic.)
Post: #11
|
|||
|
|||
RE: Finance in Prime: odd period...
Almost complete (for now) version: I've added calculation of APR rate (in Italy TAEG).
But, please, control the formulas, as I get still results that differs from those on HP 12C about 0.01-0.03 (with these new formulas), few for % but not indifferent... I'm following this example: «A 42-month loan of $3,950 for a used car began accruing interest on July 19, 2004, so that the first period began on August 1, 2004. Payments of $120 are made at the end of each month. Calculate the annual percentage rate (APR), using the actual number of odd days and simple interest for the odd period.» Having not an amount of interest to reverse the formula and get the rate, I presumed to get the interest (then the rate) in this way: I calculate the compound rate with Finance.CalcIPYR() for the integer periods (42), then I convert it (effective?) to nominal rate, at the end I get interest, add it to PV and recalculate with Finance.CalcIPYR() the presumed rate. This one is "about" the calculations made by 12C, with a little difference (i.e. for the example above -year 365, simple interest- 12C-> 13.947814, Prime->13.96389). If you have another (and better method), please, advice... A last thing: for now the rate (simple and compound) are compounded always 12 times per year. Sure, it would be better to give more control in that, but... User can choose from END and BEGINNING mode of payment. Now they are been exported three variables: OP_pmt and OP_rate (payment, APR rate -with monthly rate- and interest of odd period). Code:
∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)