# financial functions

### [1/6] from: gchiu::compkarori::co::nz at: 17-Apr-2002 23:21

Does anyone have an internal rate of return function?
something like
irr [ 0 -1073 -1459 -1364 -1247 -1110 31789 ]
= 70.56%
This example is from a book, and Excel says the IRR is 60%
The irr function I wrote says 61%, but it is very messy...
--
Graham Chiu

### [2/6] from: chalz:earthlink at: 17-Apr-2002 13:27

Heh! Perhaps if I had some idea as to what internal rate of return meant, I could give
you a hand ;)
Perhaps the difference between your function and Excel's function is a matter of rounding?
Since I see no decimals in your comparative values, and they are so close, it almost
seems to suggest that you rounded up, where Excel rounded down No?
Original Message:
-----------------
From: Graham Chiu

**[gchiu--compkarori--co--nz]**Date: Wed, 17 Apr 2002 23:21:27 +1200 To:**[rebol-list--rebol--com]**Subject: [REBOL] financial functions Does anyone have an internal rate of return function? something like irr [ 0 -1073 -1459 -1364 -1247 -1110 31789 ] = 70.56% This example is from a book, and Excel says the IRR is 60% The irr function I wrote says 61%, but it is very messy... -- Graham Chiu -- To unsubscribe from this list, please send an email to**[rebol-request--rebol--com]**with "unsubscribe" in the subject, without the quotes. -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ .### [3/6] from: gchiu:compkarori at: 18-Apr-2002 12:31

On Wed, 17 Apr 2002 13:27:59 -0400
"

**[chalz--earthlink--net]**" <**[chalz--earthlink--net]**> wrote:> Heh! Perhaps if I had some idea as to what internal
> rate of return meant, I could give you a hand ;)

Hi,
I found this definition "The internal rate of return is the
interest rate that makes the present value of the
investment's income stream -- its costs and payoffs -- add
up to 0. "
from http://hadm.sph.sc.edu/COURSES/ECON/irr/irr.html
which is an economics lecture about the value.

> Perhaps the difference between your function and
> Excel's function is a matter of rounding? Since I see no
> decimals in your comparative values, and they are so
> close, it almost seems to suggest that you rounded up,
> where Excel rounded down No?

I think the maths is okay, but I'm sure the way I'm doing it
is not at all economical. As far as I can tell, you have to
approximate to solve for the irr, and keep approximating
till you reach 0.
--
Graham Chiu

### [4/6] from: greggirwin:mindspring at: 17-Apr-2002 18:49

Hi Graham.
<< Does anyone have an internal rate of return function? >>
I didn't, but I had started on some simple financial functions recently. I
found a couple resources today and hacked something up that seems to work.
No guarantees. Mine is probably worse than yours as far as cleanliness but
could almost certainly be cleaned up an REBOLized if it turns out to work
correctly.
<< The irr function I wrote says 61%, but it is very messy...>>
The result may just a rounding issue. For the sample data I get .605....so
it's just rounding up to .61 for you.
Let me know if you want me to send it.
--Gregg

### [5/6] from: greggirwin:mindspring at: 17-Apr-2002 21:18

Hi Graham,
<< I think the maths is okay, but I'm sure the way I'm doing it
is not at all economical. As far as I can tell, you have to
approximate to solve for the irr, and keep approximating
till you reach 0. >>
That's what you have to do, based on everything I found.
--Gregg

### [6/6] from: brett:codeconscious at: 21-Apr-2002 21:12

Hi,

> << Does anyone have an internal rate of return function? >>

I use financial functions off and on - mostly in Excel, but I aim to reduce
my use of that tool if I can.
So I went a bit wild and created some functions too.
NPV - Net present value of periodic cash flows.
DCF - Discounted cash flow where the cash flows are on specific dates.
IRR - Internal Rate of Return using NPV or a DCF function.
SOLVE - The thing that IRR uses. Performs secant iteration to solve
a function. Could potentially be used for Goal Seek functionality.
http://www.codeconscious.com/rebsite/rebol-library/cash-flow-functions.r
Regards,
Brett.