[SLUG] project
Stephen O'Neill
soneill84 at yahoo.co.uk
Fri Jun 9 10:18:01 BST 2006
Bob Garrood wrote:
> # A is for amount borrowed, n for number of years and i the annual interest
> rate.
> m=n*12
> r=(1+i/1200)
> p=A*r^(m-1)*(r-1)/(r^m-1)
> {print p}
> # This assumes that the rate charged per month is 1/12th the annual interest
> rate, which may not now be true.
Hi Bob,
That solution is really neat - and certainly not something that I would
have imagined AWK capable of. I thought that AWK was just for text
stream processing....
Re. the formula I will have a look at that in more depth... on my own I
had got to the point of having:
m = n*12
r = 1 + i/1200
A*(r^m) / (r^m + r^(m-1) + ... + r^0) = Pn
The thing that I didn't know how to express here was Pn without a
recursive loop for the sum - which seems to be what your formula solves.
I'll study your solution until I understand what it does.
Re. the rate charged per month. Interest is calculated daily so differs
for each month (which I want to account for in my spreasheet). Although
using equal monthly rates will still give a good approximation.
So to get the monthly rate we take:
y for number of days in year, d for number of days in month, i for
annual rate:
r = (1 + (i/y) / 100) ^ d
This means that you immediately need programming for accuracy, but I
will revisit factoring that into the method you gave me.
The thing here for me is do I want a quick solution or an accurate
solution. And given that there's a bug in my solution as it is I suspect
that I want the quick solution.
Anyway, I'm sorry for, as a great philosopher once wrote, "waving my
ignorance around for all to see".
Oh, and MathML in HTML anybody?
Cheers for the help,
Steve O
___________________________________________________________
Try the all-new Yahoo! Mail. "The New Version is radically easier to use" The Wall Street Journal
http://uk.docs.yahoo.com/nowyoucan.html
More information about the Scarborough
mailing list