 Will Stranathan <wstranathan@hotmail.com> wrote:
> Has there been any discussion about the possibility of adding some work to
> Commons somewhere for common financial functions? I don't know if this
> necessarily falls in the scope of the Math project, or if I would need to
> submit a proposal, or if there is any general interest in this.
>
> Some of the functionality that I'm thinking about is things like:
>  Number of periods to bring an annuity to a target value (or pay off a loan
>  i.e., NPER)
>  Calculation of interest and principal for current payment
>  Amortization schedules
>  Minimum payment amount calculations, given an interest rate, principal,
> desired payoff date, etc.
>
> Let me know if there's enough interest for me to put together a proposal (or
> if this need is already met elsewhere).
Sounds like a good idea to me, I'd say go ahead with the proposal.
Friday I came across a derivation of amortization that I had printed out a
couple of years ago, and I just looked for a little Ruby script I had written
at that time to compute amortization schedules (the << operator/method of a
Ruby Array is equivalent to the add method of a Java ArrayList or Vector; I
could have written the following using the push() method to make it read more
like Java):
principal = 10000 # whatever the principal amount is
rate = 7.5 # as an annual percentage
num_periods = 30 * 12 # total number of payment periods
rate /= 100.0 # To convert percent to a real number.
rate /= 12.0 # To convert annual rate to monthly rate.
payment_amount = principal * rate * ( 1.0 / ( ( 1.0 + rate )**num_periods  1.0
) + 1.0 )
payment_interest_portion = Array.new
payment_principal_portion = Array.new
sum_payment_principal_portions = 0
payment_interest_portion[0] = 0
payment_principal_portion[0] = 0
1.upto( num_periods ) { i
sum_payment_principal_portions += payment_principal_portion[i  1]
payment_interest_portion << rate * ( principal 
sum_payment_principal_portions )
payment_principal_portion << payment_amount  payment_interest_portion[i]
}
If I remember correctly, the above code was written directly from the formulas
in the derivation and not ported from existing code, but I'll check, and if so,
I'm willing to contribute it to commonsmath.
Al
=====
Albert Davidson Chou
Get answers to Mac questions at http://www.MacMgrs.org/ .
__________________________________
Do you Yahoo!?
Yahoo! Calendar  Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

To unsubscribe, email: commonsdevunsubscribe@jakarta.apache.org
For additional commands, email: commonsdevhelp@jakarta.apache.org
