Post Reply 
A formula for IRR
05-18-2015, 11:54 AM
Post: #9
RE: A formula for IRR
A couple of things to say here:

1. You don't really need to declare a local variable I, since I is an available global already.
2. The dummy variable "flows" can not be typecast to a list directly that way. To demonstrate (using a predefined list variable):

Code:

EXPORT IRR(L1)
BEGIN
local irr, sz;
flows:=L1;
sz:= SIZE(flows);
irr:= fsolve(ΣLIST(MAKELIST((flows(I)/X^(I-1)),I,1,sz)), X)-1;
RETURN irr;
END;

I included the list variable "flows," only to demonstrate the need for a type: list variable. I know the code is redundant, instead you may prefer this:

Code:

EXPORT IRR(L1)
BEGIN
  RETURN fsolve(ΣLIST(MAKELIST((flows(I)/X^(I-1)),I,1,size(L1))), X)-1;
END;

-Dale-
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
A formula for IRR - salvomic - 05-17-2015, 08:47 PM
RE: A formula for IRR - Gene - 05-17-2015, 09:13 PM
RE: A formula for IRR - salvomic - 05-17-2015, 09:19 PM
RE: A formula for IRR - salvomic - 05-18-2015, 08:03 AM
RE: A formula for IRR - akmon - 05-18-2015, 09:20 AM
RE: A formula for IRR - salvomic - 05-18-2015, 09:33 AM
RE: A formula for IRR - salvomic - 05-18-2015, 06:01 PM
RE: A formula for IRR - salvomic - 05-18-2015, 10:27 AM
RE: A formula for IRR - DrD - 05-18-2015 11:54 AM
RE: A formula for IRR - salvomic - 05-18-2015, 12:31 PM
RE: A formula for IRR - DrD - 05-18-2015, 01:47 PM
RE: A formula for IRR - salvomic - 05-18-2015, 02:08 PM
RE: A formula for IRR - DrD - 05-18-2015, 02:47 PM
RE: A formula for IRR - salvomic - 05-18-2015, 02:56 PM
RE: A formula for IRR - DrD - 05-18-2015, 03:32 PM
RE: A formula for IRR - salvomic - 05-18-2015, 03:45 PM
RE: A formula for IRR - DrD - 05-18-2015, 03:55 PM
RE: A formula for IRR - salvomic - 05-18-2015, 03:57 PM
RE: A formula for IRR - salvomic - 05-18-2015, 05:20 PM
RE: A formula for IRR - salvomic - 05-18-2015, 07:49 PM
RE: A formula for IRR - akmon - 05-18-2015, 07:51 PM
RE: A formula for IRR - salvomic - 05-18-2015, 07:55 PM
RE: A formula for IRR - akmon - 05-18-2015, 10:15 PM
RE: A formula for IRR - salvomic - 05-18-2015, 09:18 PM
RE: A formula for IRR - Alfon - 05-18-2015, 10:30 PM
RE: A formula for IRR - salvomic - 05-19-2015, 08:58 AM
RE: A formula for IRR - akmon - 05-19-2015, 10:32 AM
RE: A formula for IRR - akmon - 05-18-2015, 11:07 PM
RE: A formula for IRR - DrD - 05-19-2015, 11:28 AM
RE: A formula for IRR - Didier Lachieze - 05-19-2015, 11:43 AM
RE: A formula for IRR - DrD - 05-19-2015, 12:10 PM
RE: A formula for IRR - DrD - 05-19-2015, 12:05 PM
RE: A formula for IRR - akmon - 05-19-2015, 12:27 PM
RE: A formula for IRR - salvomic - 05-19-2015, 12:33 PM
RE: A formula for IRR - akmon - 05-19-2015, 12:45 PM
RE: A formula for IRR - DrD - 05-19-2015, 12:49 PM
RE: A formula for IRR - Didier Lachieze - 05-19-2015, 01:02 PM
RE: A formula for IRR - salvomic - 05-19-2015, 01:22 PM
RE: A formula for IRR - salvomic - 05-20-2015, 09:25 PM
RE: A formula for IRR - fhub - 05-20-2015, 10:40 PM
RE: A formula for IRR - salvomic - 05-20-2015, 10:48 PM
RE: A formula for IRR - salvomic - 05-21-2015, 06:20 PM



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