0

I calculated the following in Matlab 2019a, see code below. I was surprised about the big difference in present values (DiffPV, DiffPVpercentage) for only a small difference (DiffIRR, DiffIRRpercentage) in discount rates. Is there a coding error somewhere? Or is it maybe just the normal effect of discounting? How could I check for that? As it does not occur for other cashflow data I thought it was a coding/programming problem, but I am not sure how I can check.

clc
clear
close all

CF = 1.0e+12 * [-1.767330098188526...
   0.060733504300760...
   0.060733504300760...
   0.060733503508760...
   0.060733504300760...
   0.060733504300760...
   0.060733503508760...
   0.060733504300760...
   0.060733504300760...
   0.060733503508760...
   0.060733504300760...
   0.060733504300760...
   0.060733501978648...
   0.060733502770648...
   0.060733502770648...
   0.060733501990451...
   0.060733502770648...
   0.060733502770648...
   0.060733502002254...
   0.060733502770648...
   0.060733502770648...
   0.060733502014057...
   0.060733502770648...
   0.060733502770648...
   0.060733502025860...
   0.060733502770648...
   0.060733502770648...
   0.060733502037663...
   0.060733502770648...
   0.060733502770648...
   0.060733502049466...
   0.060733502770648...
   0.060733502770648...
   0.060733502061269...
   0.060733502770648...
   0.060733502770648...
   0.060733502073072...
   0.060733502770648...
   0.060733502770648...
   0.060733502084875...
   0.060733502770648...
   0.060733502770648...
   0.060733502096678...
   0.060733502770648...
   0.060733502770648...
   0.060733502108481...
   0.060733502770648...
   0.060733502770648...
   0.060733502120284...
   0.060733502770648...
   0.060733502770648...
   0.060733502132087...
   0.060733502770648...
   0.060733502770648...
   0.060733502143890...
   0.060733502770648...
   0.060733502770648...
   0.060733502155693...
   0.060733502770648...
   0.060733502770648...
   0.060733502167497...
   0.060733502770648...
   0.060733502770648...
   0.060733502179300...
   0.060733502770648...
   0.060733502770648...
   0.060733502191103...
   0.060733502770648...
   0.060733502770648...
   0.060733502202906...
   0.060733502770648...
   0.060733502770648...
   0.060733502214709...
   0.060733502770648...
   0.060733502770648...
   0.060733502226512...
   0.060733502770648...
   0.060733502770648...
   0.060733502238315...
   0.060733502770648...
   0.060733502770648...
   0.060733502250118...
   0.060733502770648...
   0.060733502770648...
   0.060733502261921...
   0.060733502770648...
   0.060733502770648...
   0.060733502273724...
   0.060733502770648...
   0.060733502770648...
   0.060733502285527...
   0.060733502770648...
   0.060733502770648...
   0.060733502297330...
   0.060733502770648...
   0.060733502770648...
   0.060733502309133...
   0.060733502770648...
   0.060733502770648...
   0.060733502320936...
   0.060733502770648...
   0.060733502770648...
   0.060733502332739...
   0.060733502770648...
   0.060733502770648...
   0.060733502344542...
   0.060733502770648...
   0.060733502770648...
   0.060733502356345...
   0.060733502770648...
   0.060733502770648...
   0.060733502368148...
   0.060733502770648...
   0.060733502770648...
   0.060733502379951...
   0.060733502770648...
   0.060733502770648...
   0.060733502391754...
   0.060733502770648...
   0.060733502770648...
   0.060733502376682...
   0.060733502770648...
   0.060733502770648...
   0.060733502389829...
   0.060733502770648...
   0.060733502770648...
   0.060733502402976...
   0.060733502770648...
   0.060733502770648...
   0.060733502416123...
   0.060733502770648...
   0.060733502770648...
   0.060733502429270...
   0.060733502770648...
   0.060733502770648...
   0.060733502442416...
   0.060733502770648...
   0.060733502770648...
   0.060733502455563...
   0.060733502770648...
   0.060733502770648...
   0.060733502468710...
   0.060733502770648...
   0.060733502770648...
   0.060733502481857...
   0.060733502770648...
   0.060733502770648...
   0.060733502495004...
   0.060733502770648...
   0.060733502770648...
   0.060733502508150...
   0.060733502770648...
   0.060733502770648...
   0.060733502521297...
   0.060733502770648...
   0.060733502770648...
   0.060733502534444...
   0.060733502770648...
   0.060733502770648...
   0.060733502547591...
   0.060733502770648...
   0.060733502770648...
   0.060733502560738...
   0.060733502770648...
   0.060733502770648...
   0.060733502573884...
   0.060733502770648...
   0.060733502770648...
   0.060733502587031...
   0.060733502770648...
   0.060733502770648...
   0.060733502600178...
   0.060733502770648...
   0.060733502770648...
   0.060733502613325...
   0.060733502770648...
   0.060733502770648...
   0.060733502626472...
   0.060733502770648...
   0.060733502770648...
   0.055556792699142...
   0.055556792830172...
   0.055556792830172...
   0.055556792710061...
   0.055556792830172...
   0.055556792830172...
   0.055556792720980...
   0.055556792830172...
   0.055556792830172...
   0.055556792731900...
   0.055556792830172...
   0.055556792830172...
   0.055556792742819...
   0.055464744371412...
   0.055464744371412...
   0.055464744294978...
   0.055464744371412...
   0.055464744371412...
   0.055464744305897...
   0.055464744371412...
   0.055464744371412...
   0.055464744316816...
   0.055464744371412...
   0.055464744371412...
   0.055464744327735...
   0.055464744371412...
   0.055464744371412...
   0.055464744338654...
   0.055464744371412...
   0.055464744371412...
   0.055464744349574...
   0.055464744371412...
   0.055464744371412...
   0.055464744360493...
   0.055464744371412...
   0.055464744371412...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.055464745842000...
   0.105013255842000...
   0.105136510842000...
   0.105259765842000...
   0.105383020842000...
   0.105506275842000...
   0.105629530842000...
   0.105752785842000...
   0.105876040842000...
   0.105999295842000...
   0.106122550842000...
   0.106245805842000...
   0.106369060842000...
   0.106492315842000...
   0.106615570842000...
   0.106738825842000...
   0.106862080842000...
   0.106985335842000...
   0.107108590842000...
   0.107231845842000...
   0.107355100842000...
   0.107478355842000...
   0.107601610842000...
   0.107724865842000...
   0.107848120842000...
   0.107971375842000...
   0.108094630842000...
   0.108217885842000...
   0.108341140842000...
   0.108464395842000...
   0.108587650842000...
   0.108710905842000...
   0.108834160842000...
   0.108957415842000...
   0.109080670842000...
   0.109203925842000...
   0.109327180842000...
   0.109450435842000...
   0.109573690842000...
   0.109696945842000...
   0.109820200842000...
   0.109943455842000...
   0.110066710842000...
   0.110189965842000...
   0.110313220842000...
   0.110436475842000...
   0.110559730842000...
   0.110682985842000...
   0.110806240842000...
   0.110929495842000...
   0.110929495842000...
   0.110929495842000...
   0.110929495842000...
   0.110929495842000...
   0.110929495842000...
   0.110929495842000...
   0.110929495842000...
   0.110929495842000...
   0.110929495842000...
   0.110929495842000...
   0.110929495842000...
   0.110929495842000];

%% Test
IRR1 = 0.034366083131917;
IRR2 = 0.034364293602634;

DiffIRR = IRR1-IRR2
DiffIRRpercentage = (IRR1-IRR2)/IRR2

% PV1
for index = 1:length(CF)
    CFdiscounted1(index) = CF(index)/((1+IRR1)^(index-1));
end
PV1 = sum(CFdiscounted1)

% PV2
for index = 1:length(CF)
    CFdiscounted2(index) = CF(index)/((1+IRR2)^(index-1));
end
PV2 = sum(CFdiscounted2)

DiffPV = PV1-PV2
DiffPVpercentage = (PV1-PV2)/PV2
LenaH
  • 313
  • 2
  • 14
  • I am using MATLAB 2018b and the result is: `DiffPV = 1.00000000061042`. Is it a big or small difference? – Rotem May 30 '19 at 15:11
  • That is what I get, too, I think i.e. PV2 is double the amount of PV1, whereas the IRRs are less than 2*e^(-6) apart. Doesn't that seem odd? Or what am I missing? – LenaH May 31 '19 at 07:35
  • I think you have a formula problem. The `Present Value` formula you are using is correct, but each index tells you the PV _at that index_ (or at that _period_)... I don't think it makes sense to _sum_ all these PVs and compare the sums. – Hoki May 31 '19 at 10:04
  • @Hoki, I tend to disagree, as my formula CFdiscounted1 calculates the discounted values of all cashflows. Hence I have to sum them in the end to get the PV. Do you agree? – LenaH Jun 03 '19 at 08:37
  • That's not the way I understand the formula I know, but I can't be sure of your formula just given the numerical data. It would be useful if you could find documentation with an applied example. – Hoki Jun 03 '19 at 17:06
  • @Hoki, this NPV formula should help, it is exactly my PV formula: https://en.wikipedia.org/wiki/Net_present_value#Formula – LenaH Jun 04 '19 at 07:19
  • PS. I corrected a typo in my formula, now DiffPV = -1.6e9 and DiffIRR = 5.2e-5. Question and problem still the same! – LenaH Jun 05 '19 at 07:44
  • 1
    There is no problem in your formula. You are unsure of the magnitude of the result because it looks large yet caused by only a small difference in inputs. What you did not consider is the _very large_ other input: the actual initial outflow of cash: `-1,767,330,098,188.53`. This is 1.7 **quadrillion**. Any small % of difference of such a large number (compounded 300 times) will still produce large results. Your PV compared together looks quite differents, but if you rationalise them to the actual initial outlay, they are both quite small and not that different. – Hoki Jun 05 '19 at 11:41
  • You are right, but not because of the INITIAL outflow of cash (it's not discounted as it occurs today), but because of the magnitude of the later inflows. When I take away the factor of 1e12, the differences in percentages still stay the same, but IRR1-IRR2 and PV1-PV2 are both very small numbers. If you submit an answer, I can accept it! – LenaH Jun 07 '19 at 07:07

0 Answers0