[email protected] wrote:
> Lovely solution, using the same idea as Devon's.
> 
> As a fan of duals I rewrite it as
> 
>    acc2 =: 4 : '+/\&.(%&(*/\ y)) x' "1
> 
> acc gives the total value at the beginning of the period.
> The other solutions assume deposit at the beginning of the period
> and give the interest at the end of the period (I think).  That
> would be
> 
>     2 -~/\ -/ (d,0) acc2 1 ,:~ 1 + 0,r
> 50 42 65.52 82.876 87.0198

The interest addon (formerly the interest script) has most of this 
stuff, e.g.

    load 'finance/interest'

    r=. 0.05 0.04 0.06 0.05 0.05
    d=. 1000 0 0 500 0

    accpay 1;1;r;d   NB. payments in arrears
1000 1040 1102.4 1657.52 1740.4

    accpay 0;1;r;d   NB. payments in advance
1050 1092 1157.52 1740.4 1827.42
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to