I've got a problem to solve, and I seem to have a mental block, even
though it doesn't sound that hard.
Let's say I have an array A of rank n 2. To make it real, let {."1 A be
a list of deposits to a savings account, and let {:"1 A be the periodic
interest rate paid during that period. To simplify more, let's say each
item represents a year's (or at least a constant period's) entry.
For example, let A be
1000.0 0.05
0.0 0.04
0.0 0.06
500.0 0.05
0.0 0.05
I'd like to calculate the interest earned as a function of time with a
tacit function.
There are many analogous problems; if I can solve this, I might even be
able to do a system dynamics simulation in J. (I seem to remember an
article in a 1990s J proceedings on doing system dynamics in J, but I
haven't been able to find those proceedings in quite a while.)
I can make an auxiliary array (or stitch more columns onto A) to contain
both the current balance (the sum of the previous balance, the interest
paid from the last period, and any new deposit) and the interest being
earned in this period (the product of {:"1 A and the current balance).
For example, let Aprime be
1000.00 0.05 1000.00 50.00
0.00 0.04 1050.00 42.00
0.00 0.06 1092.00 65.52
500.00 0.05 1157.52 57.88
0.00 0.05 1215.40 60.77
I thought the linear recurrence essay might give me a hint, but it
depends upon the transformation matrix M being a constant, and this one
has a variable interest rate times a varying balance.
Ideas?
Thanks,
Bill
--
Bill Harris http://facilitatedsystems.com/weblog/
Facilitated Systems Everett, WA 98208 USA
http://facilitatedsystems.com/ phone: +1 425 374-1845
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm