Re: 17bII programming question Message #26 Posted by Dewdman42 on 7 Oct 2008, 11:01 p.m., in response to message #25 by Don Shepherd
That didn't make any difference in the result, though I'm surprised by that because putting -MIR% to the end of the equation does NOT equal zero.
This solution is a bit different than the S() examples in the book because MIR% is not by itself on the left side of the equation. So its not a matter of merely subtracting it from both sides to get the left side to equal zero.
Here is the original solution from Peter(I have seperated it into chunks to see how things are rearranged:
-----------------------------------------------------------------
MODIRR: (1+MIRR%/100)^SIGMA(L:1:SIZEC($):1:#T($:L))
=
-SIGMA(J :0:SIZEC($):1 :MAX(FLOW($:J):0)*USFV(RSK%:#T($:J))
*SPFV(RSK%:SIGMA(L:J+1:SIZEC($):1:#T($:L))) )
/
(
MIN(FLOW($:0):0)
+SIGMA(J :1:SIZEC($):1 :MIN(FLOW($:J):0)*USPV(SAF%:#T($:J))
*SPPV(SAF%:SIGMA(L:1:J-1:1:#T($:L))))
)
-----------------------------------------------------------------
There are 3 main blocks on the right side of the equation. The second two blocks are grouped together. Multiply this on both sides:
-----------------------------------------------------------------
MODIRR: (1+MIRR%/100)^SIGMA(L:1:SIZEC($):1:#T($:L))
* (
MIN(FLOW($:0):0)
+SIGMA(J :1:SIZEC($):1 :MIN(FLOW($:J):0)*USPV(SAF%:#T($:J))
*SPPV(SAF%:SIGMA(L:1:J-1:1:#T($:L))))
)
=
-SIGMA(J :0:SIZEC($):1 :MAX(FLOW($:J):0)*USFV(RSK%:#T($:J))
*SPFV(RSK%:SIGMA(L:J+1:SIZEC($):1:#T($:L))) )
-----------------------------------------------------------------
Then add the one remaining group on the right side over to the left side to arrive at zero on the right:
-----------------------------------------------------------------
MODIRR: (1+MIRR%/100)^SIGMA(L:1:SIZEC($):1:#T($:L))
* (
MIN(FLOW($:0):0)
+SIGMA(J :1:SIZEC($):1 :MIN(FLOW($:J):0)*USPV(SAF%:#T($:J))
*SPPV(SAF%:SIGMA(L:1:J-1:1:#T($:L))))
)
+ SIGMA(J :0:SIZEC($):1 :MAX(FLOW($:J):0)*USFV(RSK%:#T($:J))
*SPFV(RSK%:SIGMA(L:J+1:SIZEC($):1:#T($:L))) )
= 0
-----------------------------------------------------------------
MIRR is buried inside there. Solving first for an equation that equates to zero is what S() is expecting to see as I understand it.
The above equation does solve MIRR correctly and doesn't iterate to do it. However only when I move it inside S() does it start to iterate, even without the ELSE clause present. But its entirely possible that the nature of this equation does not work well with S(). Perhaps S() needs to see something with -MIR% on the end. First I would need to figure out an equation that has MIRR alone on the left side
-----------------------------------------------------------------
MIR$=some_complicated algorithm that I couldn't figure out
therefore
0=some_complicated_algorithm-MIR%
-----------------------------------------------------------------
Every time I have tried to isolate MIRR onto the left side alone, I've come up with bogus results. if anyone else can figure it out, love to hear it.
Edited: 7 Oct 2008, 11:02 p.m.
|