Date: Jul 2, 2013 12:31 AM
Author: Sseziwa Mukasa
Subject: Re: Cashflow and TimeValue Question

This will happen whenever the next period occurs in a leap year:

(Debug) In[2]:= cf = Cashflow[{{{2003, 12, 29}, a}, {{2003, 12, 30}, b}, {{2003, 12, 31},
c}}];
(Debug) In[3]:= Rationalize[TimeValue[cf, r, cf[[1, 1, 1]]], 0]
(Debug) Out[3]= a + c/(1 + r)^(1/183) + b/(1 + r)^(1/366)

This is of course correct if you want to compute the time value at {2004,12,31} of this cash flow whereas using 365 is not correct. So the real question is what happens for the defined cash flow in 2005?

(Debug) In[15]:= Rationalize[TimeValue[cf, r, {2005, 12, 31}], 0]
(Debug) Out[15]= c (1 + r)^2 + b (1 + r)^(731/365) + a (1 + r)^(732/365)

I suspect this will disagree with a simple spreadsheet's answer but is more correct, assuming daily compounding.

Regards,
Sseziwa

On Jul 1, 2013, at 5:47 AM, Dana DeLouis <dana01@icloud.com> wrote:

> Hello. When doing Net-Present value types of problems, I seem to
> occasionaly get slightly different answers when compared to a very
> popular spreadsheet program. The Spreadsheet program uses a standard
> 365 day year, yet I don't see anything in the Mathematica documentation
> on this.
> I've reduced the issue down to these two simple examples.
>
> 1. 3 simple daily cash flows in a row.
> cf[[1,1,1]] is returning the start date, or time 0.
> The days per year is a fraction, so I use Rationalize to return
> the values used for easy viewing.
>
> cf=Cashflow[{
> {{2009,12,29},a},
> {{2009,12,30},b},
> {{2009,12,31},c}
> }];
>
> Rationalize[TimeValue[cf,r,cf[[1,1,1]]],0]
>
> a + b/(r+1)^(1/365) + c/(r+1)^(2/365)
>
> It appears the program uses 365 days/year also. This example would most
> likely match.
> We just note that the year 2009 is not a leap year.
>
> 2. However, If I change the year to 2007, which is also not a leap
> year, it appears that the program is using a 366 day year. These types
> of problems are giving slightly different answers then spreadsheets that
> use a constant 365 day year.
>
>
> cf=Cashflow[{
> {{2007,12,29},a},
> {{2007,12,30},b},
> {{2007,12,31},c}
> }];
>
> Rationalize[TimeValue[cf,r,cf[[1,1,1]]],0]
>
> a + b/(r+1)^(1/366) + c/(r+1)^(1/183)
>
> Note: it's using 366 day year...
> {1,2}/366
> {1/366,1/183}
>
> Does anyone have any insight? I'm not sure what the standard convention is.
> I just note that both years are non leap years, yet different methods of calculations.
> It appears to me that the random use of 366 is causing the slightly different answers.
>
>
> Thanks in advance. :>)
> Mac, and Mathematical v 9.
>