On 18 Sep 98, at 18:32, Jack Killpatrick wrote:

> Hi All,

> Anyone know of a source for some public domain perl or javascript scripts
> for doing various mortgage calculations? I'm looking for code, not web pages
> with calculators on them.

Sorry but what motgage is exactly?
If it is:
I have X $$$ in the bank, evry year they become X $$$ + 5%... how 
many $$$ I'll have after 10 years?
The formula is
Money(initial capital=$,number of years=y,interest=%)=
$+$*%^y+y*$*((1-%^y)/(1-%)-1)
where if interest=10% %=10/100=0.1
and ^ means raised to.

OK???
eg. 10$, 5%, 3 years
10+10*(5/100)^3+3*10*((1-(5/100)^3)/(1-(5/100)-1)=
10+10*(0.05)^3+30*((1-(0.05)^3)/(1-0.05)-1)=
10+10*0.000125+30*((1-0.000125)/(1-0.05)-1)=
10+0.00125+30*(0.999875/0.95-1)=
10.00125+30*(1.0525-1)=
10.00125+30*0.0525=
10.00125+1.575=11.57625$

This formula works for y>1
for y=0 Money=initial capital
for y=1 Money=initial capital*(1+%)

I'll check the formula with my computer since I'm not an economist 
and all the calculus has been done by hands...
but I'm quite sure it's the right one...
If you build up a function inside an if statement to check y is not 
equal to 0 and 1 it will work in any language...
With this formula you can compute interest over 100 years without 
recursion in one step... of course you need a "raised to the power" 
function in your language.

If you plan to display the ammount of the capital thrugh the years 
it's better you use recursion of course... a neat for loop...

If mortgage means the bank give money to you and ask interest 
and evry year you pay a % of what they borrow (loan, rent???)... 
well Just ask since I haven't thought it yet but please since I'm not 
an economist you should explain in plain english how it works...

BTW the computer wasn't necessary I used the calculator and it 
works... 3 years dont require too much typing :-)
-------------------------------------------
Ivan Sergio Borgonovo [EMAIL PROTECTED]
Webmaster Gorilla Bookstore http://www.gorilla.it
Tel. +39 2 3311105/34530455 Fax. +39 2 34531591
Via Mac Mahon 9, Milano, Italy
-------------------------------------------

____________________________________________________________________
--------------------------------------------------------------------
 Join The Web Consultants Association :  Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------

Reply via email to