Reputation: 11
Here i ve a formula to calculate Quarterly-compounded recurring deposits:
<script type="text/javascript">
function Function() {
amount = 1000;
months = 18;
intrest = 12;
quaters = Math.floor(months / 3);
monthpayment = parseInt(amount) * ((Math.pow(intrest / 400 + 1, quaters) - 1) / (1-(Math.pow(intrest / 400 + 1,(-1/3)))));
newpayment = monthpayment - amount * months;
document.getElementById("MaturityAmt").value = monthpayment.toFixed(2);
document.getElementById("IntrestAmt").value = newpayment.toFixed(2);
document.getElementById("Deposit").value=(monthpayment.toFixed(2)-newpayment.toFixed(2))
}
what to change here to get Annually-compounded recurring deposits: Ex: Principal amount 1000 made over 18 monthly installments, compounded yearly at 12% interest rate.
Total Investment: 18000 Maturity Value: 19713.24, Interest Earned: 1713.24
Upvotes: 1
Views: 2665
Reputation: 2293
To calculate the RD, here I have attached the actual formula.
Demo Snippet
rd();
$("input").on('keyup', function(){
rd();
});
function rd(){
var p = $("#installment").val(),
i = $("#interest").val(),
n = $("#month").val(),
e = Math.pow((1+i/400), n/3),
d = Math.pow((1 + i/400),(-1/3)),
m = (p*(e - 1))/(1 - d);
$(".m").text("Maturity amount = " + m.toFixed(2));
$(".n").text("Instalment amount = " + p*n);
$(".o").text("Interest amount = " + (m - p*n).toFixed(2));
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div>
<label>Monthly instalment</label>
<input type="number" id="installment" placeholder="Monthly instalment" value="1000">
</div>
<div>
<label>Rate of interest</label>
<input type="number" id="interest" placeholder="6.40" value="6.40">
</div>
<div>
<label>No of months</label>
<input type="number" id="month" placeholder="12" value="12">
</div>
<h3 class="m"></h3>
<h3 class="n"></h3>
<h3 class="o"></h3>
You can also have a look into the codepen demo
Upvotes: 1
Reputation: 1
Try it: parseInt(amount) * ((Math.pow(intrest / 100 + 1, quaters) - 1) / (1-(Math.pow(intrest / 100 + 1,(-1/3)))));
Upvotes: 0