Post Reply 
Finance in Prime: odd period...
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:

EXPORT odd_period()
BEGIN
local days1, days2, n, flg, r;
local dd1, dd2, mm1, mm2, yy1, yy2;
local pv, beg, inte;
local comp, pmt, anno,gg;

input ({ 
{dd1,[0],{15,15,1}}, 
{mm1,{"1","2","3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}, {40,15,1}}, 
{yy1,[0],{70,15,1}},
{dd2,[0],{15,15,3}}, 
{mm2,{"1","2","3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}, {40,15,3}}, 
{yy2,[0],{70,15,3}},
{pv, [0], {15,15,4}}, 
{n, [0], {40,15,4}},{r,[0],{70,15,4}},
{beg,0, {15,2,5}}, {comp,0,{50,2,5}}, {flg,0,{80,2, 5}}
}, 
"Calc difference days", {"d1", "m1", "y1", "d2", "m2", "y2", 
"PV", "N","r%", 
"End","Compound","Financial"}, 
{"Day 1", "Month 1", "Year 1", "Day 2", "Month 2", "Year 2", 
"Present value", "Yearly pmt n", "Yearly rate%", 
"Begin or End", "Compound interest", "Financial year (360)"
}, 
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0,0}, 
{1, 1, 2015, 1, 1, 2015, 1000, 36, 5, 1,0, 1} );
dd1:=EVAL(dd1); mm1:=EVAL(mm1);
dd2:=EVAL(dd2); mm2:=EVAL(mm2);
yy1:=EVAL(yy1); yy2:=EVAL(yy2);
days1 := yy1+mm1/100+dd1/10000;
days2 := yy2+mm2/100+dd2/10000;
IF (flg==0) THEN // Actual year
gg:= DDAYS(days1, days2);
anno:=365;
ELSE // Financial year
gg:= 30*(mm2-mm1)+dd2-dd1;
anno:=360;
END; //if
IF (comp==0) THEN // Simple interest
inte:=(pv*(r/100)*(gg))/anno;
ELSE // Compound interest
inte:= pv*((r/100+1)^(gg/anno)-1);
END;
pmt:=Finance.CalcPMT(n, r, (-(pv+inte)),0,12,12,beg);
RECT_P();
TEXTOUT_P("Odd period " + EVAL(gg), 25,50);
TEXTOUT_P("Interest odd period " + EVAL(inte), 25, 70);
TEXTOUT_P("Monthly payment " + EVAL(pmt), 25, 90);
WAIT;
RETURN pmt;
END;

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Finance in Prime: odd period... - salvomic - 05-21-2015, 10:40 AM
RE: Finance in Prime: odd period... - salvomic - 05-22-2015 10:06 PM
RE: Finance in Prime: odd period... - DrD - 05-23-2015, 10:21 AM
RE: Finance in Prime: odd period... - DrD - 05-23-2015, 01:00 PM



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