F / G: = 1 / N - N / (1 + I)^N - 1

My Problem is when I added value G = 10, I = 10, N =10

I get a result of 93.73 which is wrong. Where i calculate 37.31 as correct.

When I do G =1, I = 10, N = 10.

I get a result of 3.73, which is correct.

*CLEARLY* if 3.73, is correct for G=1, then the answer should be 37.3 for G=10.

After all, to transform
Code:

F / G: = 1 / N - N / (1 + I)^N - 1

to solve for F, all you do is multiply both sides by G:

Code:

G * ( F / G ) = G * ( 1 / N - N / (1 + I)^N - 1 )
-->>
F = G * ( 1 / N - N / (1 + I)^N - 1 )

which means the answer for G=10 should be 10 times the answer for G=1.

Let's just translate that pictured formula, exactly, with no simplifications:

Code:

<!DOCTYPE html>
<html>
<body>
<form id="theForm">
Gradient: <input name="gradient"/><br/>
Rate: <input name="rate"/><br/>
Years: <input name="year"/><br>
<input type="button" value="calculate" onclick="fvg()"/>
<hr/>
Amount: <input name="amount" readonly /><br/>
Interest: <input name="interest" readonly />
</form>
<script type="text/javascript">
// UGUS = 1/i - n/( (1+i)^n -1 )
function UGUS( G, i, n )
{
// UGUS formula save that we multiply by G
return G * ( 1/i - ( n / ( Math.pow(1+i,n) - 1 ) ) );
}
function fvg ()
{
var form = document.getElementById("theForm");
var gradient = Number( form.gradient.value );
var interest = form.rate.value / 100;
var periods = Number( form.year.value );
var power = UGUS( gradient, interest, periods );
form.amount.value = power.toFixed(2); // forget Math.round!
form.interest.value = ( power - gradient ).toFixed(2);
}
</script>
</body>
</html>

And for G=1, I=10, N=10 indeed I get 3.73

And for G=10, I=10, N=10 indeed I get 37.25